const response = await qualifire.evaluate({ input: "What is the capital of France?", output: "Paris", contentModerationCheck: true, hallucinationsCheck: true,});
res = client.evaluate( input="What is the capital of France?", output="Paris", content_moderation_check=True, hallucinations_check=True,)
const response = await qualifire.evaluate({ messages: [ { role: "user", content: "What is the capital of France?" }, { role: "assistant", content: "Paris" }, ], contentModerationCheck: true, hallucinationsCheck: true, groundingCheck: true, piiCheck: true, promptInjections: true, assertions: ["don't give medical advice"], allowedTopics: ["billing", "account management", "technical support"],});
res = client.evaluate( input="what is the capital of France", output="Paris", prompt_injections=True, pii_check=True, hallucinations_check=True, grounding_check=True, content_moderation_check=True, assertions=["don't give medical advice"], allowed_topics=["billing", "account management", "technical support"],)
// Simple input/outputconst response = await qualifire.invokeEvaluation({ input: "What is the capital of France?", output: "Paris", evaluationId: "g2r8puzojwb8q6yi2f6x162a", // Get this from the evaluations page});// With messages and tools (for tool use quality evaluation)const response = await qualifire.invokeEvaluation({ evaluationId: "g2r8puzojwb8q6yi2f6x162a", messages: [ { role: "user", content: "What's the weather in NYC?" }, { role: "assistant", content: "Let me check.", tool_calls: [{ name: "get_weather", arguments: { location: "NYC" } }] }, ], availableTools: [ { name: "get_weather", description: "Get weather for a location", parameters: { type: "object", properties: { location: { type: "string" } } } }, ],});
# Simple input/outputres = client.invoke_evaluation( input="what is the capital of France", output="Paris", evaluation_id="g2r8puzojwb8q6yi2f6x162a", # Get this from the evaluations page)# With messages and tools (for tool use quality evaluation)from qualifire.types import LLMMessage, LLMToolCall, LLMToolDefinitionres = client.invoke_evaluation( evaluation_id="g2r8puzojwb8q6yi2f6x162a", messages=[ LLMMessage(role="user", content="What's the weather in NYC?"), LLMMessage(role="assistant", content="Let me check.", tool_calls=[ LLMToolCall(name="get_weather", arguments={"location": "NYC"}), ]), ], available_tools=[ LLMToolDefinition(name="get_weather", description="Get weather for a location", parameters={"type": "object", "properties": {"location": {"type": "string"}}}), ],)
print(res.status) # Status of the evaluationprint(res.score) # Overall scorefor item in res.evaluationResults: print(f"Type: {item.type}") for result in item.results: print(f" - {result.name}: {result.label} (score: {result.score})") print(f" Reason: {result.reason}")
Control the quality/speed tradeoff for each check:
Mode
Description
speed
Fastest, lower accuracy
balanced
Default balance
quality
Highest accuracy, slower
const response = await qualifire.evaluate({ messages: [ { role: "user", content: "What is the capital of France?" }, { role: "assistant", content: "Paris" }, ], hallucinationsCheck: true, groundingCheck: true, assertions: ["don't give medical advice"], hallucinationsMode: "quality", groundingMode: "balanced", assertionsMode: "speed", consistencyMode: "balanced",});
from qualifire.types import ModelModeres = client.evaluate( input="what is the capital of France", output="Paris", hallucinations_check=True, grounding_check=True, assertions=["don't give medical advice"], hallucinations_mode=ModelMode.QUALITY, grounding_mode=ModelMode.BALANCED, assertions_mode=ModelMode.SPEED, consistency_mode=ModelMode.BALANCED,)
Multi-Turn Evaluation
Enable multi-turn context for grounding and policy checks:
from qualifire.types import LLMMessage, LLMToolCall, LLMToolDefinition, ModelModeres = client.evaluate( messages=[ LLMMessage( role="user", content="What is the weather tomorrow in New York?", ), LLMMessage( role="assistant", content="please run the following tool", tool_calls=[ LLMToolCall( id="tool_call_id", name="get_weather_forecast", arguments={ "location": "New York, NY", "date": "tomorrow", }, ), ], ), ], available_tools=[ LLMToolDefinition( name="get_weather_forecast", description="Provides the weather forecast for a given location and date.", parameters={ "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g., San Francisco, CA", }, "date": { "type": "string", "description": "The date for the forecast, e.g., tomorrow, or YYYY-MM-DD", }, }, "required": ["location", "date"], }, ), ], tool_use_quality_check=True, tuq_mode=ModelMode.BALANCED,)
Metadata
Attach custom key-value metadata to any evaluation. Metadata is persisted alongside the invocation and can be used for filtering and grouping in the Qualifire UI.All values must be strings. The API returns a 422 error if any value is not a string.
const response = await qualifire.evaluate({ input: "What is the capital of France?", output: "Paris", hallucinationsCheck: true, metadata: { environment: "production", userId: "user-123", sessionId: "sess-abc", },});
res = client.evaluate( input="What is the capital of France?", output="Paris", hallucinations_check=True, metadata={ "environment": "production", "user_id": "user-123", "session_id": "sess-abc", },)
Metadata also works with invokeEvaluation / invoke_evaluation:
const response = await qualifire.invokeEvaluation({ input: "What is the capital of France?", output: "Paris", evaluationId: "g2r8puzojwb8q6yi2f6x162a", metadata: { environment: "staging" },});
res = client.invoke_evaluation( input="What is the capital of France?", output="Paris", evaluation_id="g2r8puzojwb8q6yi2f6x162a", metadata={"environment": "staging"},)
Policy Target
Control whether checks apply to input, output, or both:
from qualifire.types import PolicyTargetres = client.evaluate( messages=[...], policy_target=PolicyTarget.OUTPUT, # INPUT, OUTPUT, or BOTH)
Policy Include Tools
Include tool definitions and tool calls in the policy assertion context. When enabled, assertions can reference available tools and tool call arguments — for example, “must use the search tool before answering”.
const response = await qualifire.evaluate({ messages: [ { role: "user", content: "Find the weather in NYC" }, { role: "assistant", content: "Let me check.", tool_calls: [{ name: "get_weather", arguments: { location: "NYC" } }] }, ], assertions: ["must use the get_weather tool"], policyIncludeTools: true,});
from qualifire.types import LLMMessage, LLMToolCall, LLMToolDefinitionres = client.evaluate( messages=[ LLMMessage(role="user", content="Find the weather in NYC"), LLMMessage( role="assistant", content="Let me check.", tool_calls=[LLMToolCall(name="get_weather", arguments={"location": "NYC"})], ), ], available_tools=[ LLMToolDefinition( name="get_weather", description="Get weather for a location", parameters={"type": "object", "properties": {"location": {"type": "string"}}}, ), ], assertions=["must use the get_weather tool"], policy_include_tools=True,)