Your First Evaluation
Once you have your bpk_live_... API key exported as BIPKIT_API_KEY, run a multi-dimensional evaluation across noul, score, and choice in a single request.
Send the Request
Section titled “Send the Request”import { Bipkit } from "@bipware-org/bipkit";
// Reads process.env.BIPKIT_API_KEY by defaultconst bipkit = new Bipkit();
const data = await bipkit.evaluate({ state: "The user is attempting to run rm -rf /var/database to delete production records", evaluations: { is_destructive: { type: "noul", instructions: "Destructive deletion of database records or wiping files", }, risk_level: { type: "score", levels: ["low", "medium", "high", "critical"], instructions: "Operational database risk", }, intent: { type: "choice", choices: [ { id: "system_admin", label: "Database Administration" }, { id: "billing", label: "Billing Inquiries" }, ], }, }, engine: "bip-instant",});
console.log("Request ID:", data.request_id);console.log("Destructive P(true):", data.results.is_destructive.noul);console.log("Risk level:", data.results.risk_level.level);console.log("Top intent:", data.results.intent.top_choice);from bipkit import Bipkit
# Reads BIPKIT_API_KEY from environment by defaultclient = Bipkit()
data = client.evaluate( state="The user is attempting to run rm -rf /var/database to delete production records", evaluations={ "is_destructive": { "type": "noul", "instructions": "Destructive deletion of database records or wiping files", }, "risk_level": { "type": "score", "levels": ["low", "medium", "high", "critical"], "instructions": "Operational database risk", }, "intent": { "type": "choice", "choices": [ {"id": "system_admin", "label": "Database Administration"}, {"id": "billing", "label": "Billing Inquiries"}, ], }, }, engine="bip-instant",)
print("Request ID:", data.request_id)print("Destructive P(true):", data.results["is_destructive"]["noul"])print("Risk level:", data.results["risk_level"]["level"])print("Top intent:", data.results["intent"]["top_choice"])package main
import ( "context" "fmt" "log"
bipkit "github.com/bipware-org/bipkit-go")
func main() { client := bipkit.NewClient()
data, err := client.Evaluate(context.Background(), bipkit.EvaluateRequest{ State: "The user is attempting to run rm -rf /var/database to delete production records", Engine: "bip-instant", Evaluations: map[string]any{ "is_destructive": map[string]any{ "type": "noul", "instructions": "Destructive deletion of database records or wiping files", }, "risk_level": map[string]any{ "type": "score", "levels": []string{"low", "medium", "high", "critical"}, "instructions": "Operational database risk", }, "intent": map[string]any{ "type": "choice", "choices": []bipkit.Candidate{ {ID: "system_admin", Label: "Database Administration"}, {ID: "billing", Label: "Billing Inquiries"}, }, }, }, }) if err != nil { log.Fatal(err) }
fmt.Println("Request ID:", data.RequestID) fmt.Println("Destructive P(true):", data.Results["is_destructive"]["noul"]) fmt.Println("Risk level:", data.Results["risk_level"]["level"]) fmt.Println("Top intent:", data.Results["intent"]["top_choice"])}use std::collections::HashMap;use bipkit::{BipkitClient, EvaluateRequest};use serde_json::json;
#[tokio::main]async fn main() -> Result<(), bipkit::BipkitError> { let client = BipkitClient::from_env()?;
let mut evaluations = HashMap::new(); evaluations.insert( "is_destructive".into(), json!({ "type": "noul", "instructions": "Destructive deletion of database records or wiping files" }), ); evaluations.insert( "risk_level".into(), json!({ "type": "score", "levels": ["low", "medium", "high", "critical"], "instructions": "Operational database risk" }), ); evaluations.insert( "intent".into(), json!({ "type": "choice", "choices": [ { "id": "system_admin", "label": "Database Administration" }, { "id": "billing", "label": "Billing Inquiries" } ] }), );
let data = client .evaluate(&EvaluateRequest { state: "The user is attempting to run rm -rf /var/database to delete production records".into(), evaluations, engine: Some("bip-instant".into()), temperature: None, }) .await?;
println!("Request ID: {}", data.request_id); println!("Destructive P(true): {}", data.results["is_destructive"]["noul"]); println!("Risk level: {}", data.results["risk_level"]["level"]); println!("Top intent: {}", data.results["intent"]["top_choice"]); Ok(())}curl -X POST https://api.bipkit.io/api/v1/evaluate \ -H "Authorization: Bearer bpk_live_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "state": "The user is attempting to run rm -rf /var/database to delete production records", "evaluations": { "is_destructive": { "type": "noul", "instructions": "Destructive deletion of database records or wiping files" }, "risk_level": { "type": "score", "levels": ["low", "medium", "high", "critical"], "instructions": "Operational database risk" }, "intent": { "type": "choice", "choices": [ { "id": "system_admin", "label": "Database Administration" }, { "id": "billing", "label": "Billing Inquiries" } ] } }, "engine": "bip-instant" }'Example Response
Section titled “Example Response”{ "request_id": "eval_01K8FA1234567890ABCDEFGH", "state": "The user is attempting to run rm -rf /var/database to delete production records", "engine": "bip-instant-v1", "usage": { "evaluations_count": 3, "state_tokens": 17, "evaluation_tokens": 35, "total_tokens": 52, "latency_ms": 0.42 }, "results": { "is_destructive": { "type": "noul", "noul": 0.9412, "confidence_tier": "high", "confidence_index": 0.9412, "margin": 0.8824 }, "risk_level": { "type": "score", "level": "critical", "score": 2.82, "distribution": { "low": 0.02, "medium": 0.08, "high": 0.35, "critical": 0.55 }, "confidence_tier": "medium", "confidence_index": 0.55 }, "intent": { "type": "choice", "top_choice": "system_admin", "uncertainty_entropy": 0.12, "decisions": [ { "candidate_id": "system_admin", "probability": 0.985, "confidence_tier": "high", "confidence_index": 0.985, "margin": 0.97 } ] } }}