diff --git a/CLAUDE.md b/CLAUDE.md index 0a2e94e..96eb9ed 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -42,15 +42,17 @@ make check-safety The SDK has a minimal structure centered on the `Client` class: -- **`qualifire/client.py`**: Main `Client` class with two public methods: +- **`qualifire/client.py`**: Main `Client` class with three public methods: - `evaluate()` - Run ad-hoc evaluations with various checks (hallucinations, grounding, PII, content moderation, etc.) - `invoke_evaluation()` - Run pre-configured evaluations from the Qualifire dashboard + - `compile_prompt()` - Compile a prompt with topic scoping and policy targets - **`qualifire/types.py`**: All data classes and enums: - `EvaluationRequest`/`EvaluationResponse` - API request/response structures - `LLMMessage`, `LLMToolCall`, `LLMToolDefinition` - Message and tool types for conversation-based evaluation - `ModelMode` (SPEED/BALANCED/QUALITY) - Quality vs speed trade-off for checks - `SyntaxCheckArgs` - Configuration for syntax validation + - `PolicyTarget`, `CompilePromptResponse` - Types for prompt compilation with topic scoping - **`qualifire/utils.py`**: Helper functions for API key and base URL resolution from environment variables diff --git a/assets/images/coverage.svg b/assets/images/coverage.svg index a4262d3..012a849 100644 --- a/assets/images/coverage.svg +++ b/assets/images/coverage.svg @@ -15,7 +15,7 @@ coverage coverage - 69% - 69% + 70% + 70% diff --git a/pyproject.toml b/pyproject.toml index 5ceac0f..2410c85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "qualifire" -version = "0.13.0" +version = "0.13.1" description = "Qualifire Python SDK" authors = [{ name = "qualifire-dev", email = "dror@qualifire.ai" }] requires-python = ">=3.8,<4" diff --git a/qualifire/client.py b/qualifire/client.py index 0cc6026..8cbac40 100644 --- a/qualifire/client.py +++ b/qualifire/client.py @@ -63,6 +63,10 @@ def evaluate( grounding_multi_turn_mode: bool = False, policy_multi_turn_mode: bool = False, policy_target: PolicyTarget = PolicyTarget.BOTH, + topic_scoping_mode: Optional[ModelMode] = None, + topic_scoping_multi_turn_mode: bool = False, + topic_scoping_target: PolicyTarget = PolicyTarget.BOTH, + allowed_topics: Optional[List[str]] = None, ) -> Union[EvaluationResponse, None]: """ Evaluates the given input and output pairs. @@ -105,6 +109,10 @@ def evaluate( :param grounding_multi_turn_mode: Enable multi-turn mode for grounding check. :param policy_multi_turn_mode: Enable multi-turn mode for policy check. :param policy_target: Target for policy checks (input/output/both). + :param topic_scoping_mode: Model mode for topic scoping check (speed/balanced/quality). + :param topic_scoping_multi_turn_mode: Enable multi-turn mode for topic scoping check. + :param topic_scoping_target: Target topic for topic scoping check. + :param allowed_topics: List of allowed topics for topic scoping check. :return: An EvaluationResponse object containing the evaluation results. :raises Exception: If an error occurs during the evaluation. @@ -224,6 +232,10 @@ def evaluate( grounding_multi_turn_mode=grounding_multi_turn_mode, policy_multi_turn_mode=policy_multi_turn_mode, policy_target=policy_target, + topic_scoping_mode=topic_scoping_mode, + topic_scoping_multi_turn_mode=topic_scoping_multi_turn_mode, + topic_scoping_target=topic_scoping_target, + allowed_topics=allowed_topics, ) response = requests.post( diff --git a/qualifire/types.py b/qualifire/types.py index a9c8d85..7fb184a 100644 --- a/qualifire/types.py +++ b/qualifire/types.py @@ -66,6 +66,10 @@ class EvaluationRequest(BaseModel): grounding_multi_turn_mode: bool = False policy_multi_turn_mode: bool = False policy_target: PolicyTarget = PolicyTarget.BOTH + topic_scoping_mode: Optional[ModelMode] = None + topic_scoping_multi_turn_mode: bool = False + topic_scoping_target: Optional[str] = None + allowed_topics: Optional[List[str]] = None @model_validator(mode="after") def validate_model(self) -> "EvaluationRequest": diff --git a/uv.lock b/uv.lock index 73478f5..a70ee33 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 3 +revision = 2 requires-python = ">=3.8, <4" resolution-markers = [ "python_full_version >= '3.13'",