Skip to content

Conversation

@drorIvry
Copy link
Collaborator

@drorIvry drorIvry commented Jan 28, 2026

Description

Related Issue

Type of Change

  • 📚 Examples / docs / tutorials / dependencies update
  • 🔧 Bug fix (non-breaking change which fixes an issue)
  • 🥂 Improvement (non-breaking change which improves an existing feature)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 🔐 Security fix

Checklist

  • I've read the CODE_OF_CONDUCT.md document.
  • I've read the CONTRIBUTING.md guide.
  • I've updated the code style using make codestyle.
  • I've written tests for all new methods and classes that I created.
  • I've written the docstring in Google format for all the methods and classes that I used.

Summary by CodeRabbit

  • New Features

    • Added topic-scoping options to evaluation requests: configurable scoping mode, multi-turn scoping behavior, scoping target, and allowed-topics filtering.
    • Added prompt-compilation capability and policy-target options for finer control over prompts and policy application.
  • Chores

    • Package version updated to 0.13.1.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 28, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

Added four optional topic-scoping parameters to Client.evaluate() and corresponding fields on EvaluationRequest; the client forwards these new fields to the request without changing control flow or error handling. Project version bumped to 0.13.1.

Changes

Cohort / File(s) Summary
API Extension
qualifire/client.py
Added parameters to Client.evaluate(): topic_scoping_mode: Optional[ModelMode] = None, topic_scoping_multi_turn_mode: bool = False, topic_scoping_target: PolicyTarget = PolicyTarget.BOTH, and allowed_topics: Optional[List[str]] = None; forwarded them into EvaluationRequest; updated docstring.
Request Type Extension
qualifire/types.py
Added public fields to EvaluationRequest: topic_scoping_mode: Optional[ModelMode] = None, topic_scoping_multi_turn_mode: bool = False, topic_scoping_target: Optional[str] = None, and allowed_topics: Optional[List[str]] = None.
Metadata
pyproject.toml
Bumped package version from 0.13.0 to 0.13.1.
Docs/Architecture
CLAUDE.md
Updated architecture notes to reflect new compile_prompt() mention and new types PolicyTarget and CompilePromptResponse in types documentation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 I hopped through code with a twitch and a wink,
Four tiny fields added quicker than a blink,
From client to request they now softly bound,
Topics scoped and targeted — nimble and sound,
A carrot of features, jaunty and round. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding topic scoping functionality to the SDK, which is accurately reflected in the changes across client.py, types.py, and version bump.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@qualifire/client.py`:
- Around line 66-69: Document and/or constrain topic_scoping_target and add an
explicit enable flag: update the signature and docs around topic_scoping_target
to either (a) accept free-form topic names and explicitly state that in the
docstring for topic_scoping_target/allowed_topics, or (b) replace Optional[str]
with a new enum (e.g., TopicScopingTarget) that lists permitted values (similar
to PolicyTarget) and update all references accordingly; also add a boolean
topic_scoping_check parameter (default False) to mirror other checks and make
enabling explicit (treat allowed_topics as ignored unless topic_scoping_check is
True), and update validation logic where topic_scoping_target, allowed_topics,
and topic_scoping_multi_turn_mode are used to enforce these rules.
🧹 Nitpick comments (1)
qualifire/client.py (1)

112-115: Consider clarifying the docstring for topic_scoping_target.

The docstring for topic_scoping_target says "Target topic for topic scoping check" which doesn't clarify what values are accepted. Consider documenting:

  1. Valid values (e.g., "input", "output", "both" or free-form text)
  2. How the parameters work together (e.g., is allowed_topics required when topic_scoping_mode is set?)

Comment on lines 66 to 69
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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# Check if TopicScopingTarget enum exists
ast-grep --pattern 'class TopicScopingTarget'

Repository: qualifire-dev/qualifire-python-sdk

Length of output: 60


🏁 Script executed:

# Check PolicyTarget enum definition and usage
rg -n 'PolicyTarget' --type=py -A 3 -B 1

Repository: qualifire-dev/qualifire-python-sdk

Length of output: 1232


🏁 Script executed:

# Check the evaluate() method signature to see all parameters
rg -n 'def evaluate' --type=py -A 20

Repository: qualifire-dev/qualifire-python-sdk

Length of output: 1771


🏁 Script executed:

# Check what other checks have boolean flags
rg -n '_check: bool' --type=py

Repository: qualifire-dev/qualifire-python-sdk

Length of output: 1836


🏁 Script executed:

# Look for EvaluationRequest class to understand parameter mapping
rg -n 'class EvaluationRequest' --type=py -A 30

Repository: qualifire-dev/qualifire-python-sdk

Length of output: 2366


🏁 Script executed:

# Check docstrings in client.py for topic scoping parameters
rg -n 'topic_scoping' --type=py -B 2 -A 2

Repository: qualifire-dev/qualifire-python-sdk

Length of output: 2215


🏁 Script executed:

# Check if there are any comments or validation related to topic_scoping_target values
rg -n 'topic.scoping.*target' --type=py -i -B 3 -A 3

Repository: qualifire-dev/qualifire-python-sdk

Length of output: 2118


🏁 Script executed:

# Check the complete evaluate method signature including docstring
sed -n '38,120p' qualifire/client.py

Repository: qualifire-dev/qualifire-python-sdk

Length of output: 5370


Document valid values for topic_scoping_target and consider adding an explicit enable flag for consistency.

The topic_scoping_target parameter is typed as Optional[str] without constraints or documentation of valid values. In contrast, policy_target (line 65) uses a PolicyTarget enum to clarify accepted values (input/output/both). If topic_scoping_target accepts free-form topic names, this should be documented explicitly. Alternatively, if values are constrained, define an enum for better SDK usability.

Additionally, all other checks in the API have explicit boolean enable flags (e.g., grounding_check, pii_check, content_moderation_check), but topic scoping lacks a topic_scoping_check: bool parameter. This creates ambiguity around enabling topic scoping—is it implicitly enabled when allowed_topics is provided, or should an explicit flag be required for consistency?

🤖 Prompt for AI Agents
In `@qualifire/client.py` around lines 66 - 69, Document and/or constrain
topic_scoping_target and add an explicit enable flag: update the signature and
docs around topic_scoping_target to either (a) accept free-form topic names and
explicitly state that in the docstring for topic_scoping_target/allowed_topics,
or (b) replace Optional[str] with a new enum (e.g., TopicScopingTarget) that
lists permitted values (similar to PolicyTarget) and update all references
accordingly; also add a boolean topic_scoping_check parameter (default False) to
mirror other checks and make enabling explicit (treat allowed_topics as ignored
unless topic_scoping_check is True), and update validation logic where
topic_scoping_target, allowed_topics, and topic_scoping_multi_turn_mode are used
to enforce these rules.

Copy link
Contributor

@yuval-qf yuval-qf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left one minor comment

policy_target: PolicyTarget = PolicyTarget.BOTH,
topic_scoping_mode: Optional[ModelMode] = None,
topic_scoping_multi_turn_mode: bool = False,
topic_scoping_target: Optional[str] = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use an enum / Literal for the target? like the PolicyTarget

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to bump the version in pyproject.toml

@drorIvry drorIvry merged commit d092769 into qualifire-dev:main Jan 29, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants