Skip to content

[FIRE-987] feature: support new tool_use_quality_check & tuq_mode fields and deprecate tool_selection_quality_check & tsq_mode fields#23

Merged
drorIvry merged 8 commits into
mainfrom
feature/FIRE-987/support-tuq
Jan 8, 2026
Merged

[FIRE-987] feature: support new tool_use_quality_check & tuq_mode fields and deprecate tool_selection_quality_check & tsq_mode fields#23
drorIvry merged 8 commits into
mainfrom
feature/FIRE-987/support-tuq

Conversation

@amos-qualifire

@amos-qualifire amos-qualifire commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

Description of change

Pull-Request Checklist

  • Code is up-to-date with the main branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions outlined in the conventional commit spec

Summary by CodeRabbit

  • New Features
    • Added a tool-use quality check toggle and a mode field to control tool-quality behavior; enabling it requires messages and available tools.
  • Deprecation
    • Previous quality-check field names marked deprecated; migrate to the new names when convenient.
  • Backward Compatibility
    • Legacy field variants remain accepted; error messages now clarify supported frameworks and formats.

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

…lds and deprecate tool_selection_quality_check & tsq_mode fields
@coderabbitai

coderabbitai Bot commented Jan 7, 2026

Copy link
Copy Markdown

Walkthrough

Adds new tool-use quality-check fields and deprecated aliases to request schemas, maps legacy/new field names in evaluation construction, re-exports additional types from ./types, updates validation to require messages/tools when any tool-quality flag is enabled, updates tests, and bumps package version.

Changes

Cohort / File(s) Summary
Public exports
src/index.ts
Reformat export block and add public exports: LLMMessage, ModelMode, PolicyTarget from ./types.
Types & Schemas / Validation
src/types.ts
Change enum type annotation style; add toolUseQualityCheck and optional tuqMode/deprecated tsqMode; keep toolSelectionQualityCheck as deprecated alias; update EvaluationRequestV2Schema and EvaluationProxyAPIRequestSchema to accept/require toolUseQualityCheck and to validate that messages and available_tools are present when any tool-quality flag is enabled; generalize related error messages.
Evaluation request construction / Runtime mapping
src/index.ts
Replace toolSelectionQualityCheck usage with toolUseQualityCheck and map to tool_use_quality_check in evaluation payloads; introduce tuq_mode mapping and accept tuqMode/tsqMode/tuq_mode across backward-compat and converter paths; update framework-converter error messages to list supported frameworks.
Tests
test/types.spec.ts
Rename test payload fields/variables from tool_selection_quality_check/tsq_check to toolUseQualityCheck/tuq_check; update expectations and descriptions to match new field names.
Metadata
package.json
Bump package version from 1.3.0 to 1.4.0.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

released

Suggested reviewers

  • drorIvry

Poem

🐰 I hopped through schemas, flags in tow,
New names and aliases now all aglow.
I nudged exports and tests in line,
A tiny hop — a tidy sign. ✨

🚥 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 accurately describes the main changes: adding support for new tool_use_quality_check & tuq_mode fields while deprecating old tool_selection_quality_check & tsq_mode fields, which aligns with the substantial modifications across src/index.ts, src/types.ts, and test/types.spec.ts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/FIRE-987/support-tuq

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 218e066 and c5286ba.

📒 Files selected for processing (1)
  • package.json
✅ Files skipped from review due to trivial changes (1)
  • package.json

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Comment thread src/index.ts Outdated
Comment on lines +259 to +262
tool_selection_quality_check:
evaluationProxyAPIRequest.tool_selection_quality_check ||
evaluationProxyAPIRequest.toolSelectionQualityCheck,
tool_use_quality_check: evaluationProxyAPIRequest.toolUseQualityCheck,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You don't need to send both of them to the proxy.
Send only tool_use_quality_check to the proxy, with value from tool_use_quality_check || tool_selection_quality_check || toolSelectionQualityCheck

Comment thread src/index.ts Outdated
Comment on lines +263 to +264
tsq_mode: evaluationProxyAPIRequest.tsqMode,
tuq_mode: evaluationProxyAPIRequest.tuqMode,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

send only tuq_mode to the proxy

Comment thread src/index.ts Outdated
Comment on lines +342 to +346
tool_selection_quality_check:
EvaluationRequestV2.toolSelectionQualityCheck,
tool_use_quality_check: EvaluationRequestV2.toolUseQualityCheck,
tsq_mode: EvaluationRequestV2.tsqMode,
tuq_mode: EvaluationRequestV2.tuqMode,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

no need to send both to the proxy

Comment thread src/types.ts Outdated
Comment thread src/types.ts Outdated
amos-qualifire and others added 2 commits January 7, 2026 15:37
Co-authored-by: yuval-qf <yuval@qualifire.ai>
Co-authored-by: yuval-qf <yuval@qualifire.ai>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In @src/types.ts:
- Around line 217-223: The validation condition references a non-existent
snake_case field data.tool_use_quality_check; remove that reference so the check
only uses the actual schema fields (data.tool_selection_quality_check,
data.toolSelectionQualityCheck, data.toolUseQualityCheck, and
data.tool_use_quality_check should NOT be referenced). Update the if condition
around the tool selection/use quality checks (the block that currently checks
data.tool_selection_quality_check || data.tool_use_quality_check ||
data.toolSelectionQualityCheck || data.toolUseQualityCheck) to omit
data.tool_use_quality_check and rely on the existing camelCase fields defined by
EvaluationProxyAPIRequestSchema.

In @test/types.spec.ts:
- Line 88: Update the test to use the camelCase field name `toolUseQualityCheck`
consistently: rename the describe string from "validate tool_use_quality_check
requirements" to "validate toolUseQualityCheck requirements", change any
variable bindings (e.g., test variables or destructured names) that reference
`tool_use_quality_check` to `toolUseQualityCheck`, and update the payload
objects sent in the tests to use the `toolUseQualityCheck` key instead of
`tool_use_quality_check`; apply the same replacements in the other failing
assertions referenced (around the other occurrences at the same test file lines
~111-112 and ~126).
- Line 71: The test payload in test/types.spec.ts uses a non-existent snake_case
field tool_use_quality_check while the validation schema
EvaluationProxyAPIRequestSchema defines the camelCase field toolUseQualityCheck,
so Zod will ignore the snake_case key; fix by updating the test payload to use
toolUseQualityCheck (or add a preprocess to EvaluationProxyAPIRequestSchema to
accept snake_case) so the field is validated correctly, ensuring the test
exercises the real schema field.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4fbdf4a and 6c29851.

📒 Files selected for processing (3)
  • src/index.ts
  • src/types.ts
  • test/types.spec.ts
🧰 Additional context used
🪛 GitHub Actions: Pull Request
src/types.ts

[error] 220-220: TS2551: Property 'tool_use_quality_check' does not exist on type '{ dangerous_content_check: boolean; grounding_check: boolean; hallucinations_check: boolean; harassment_check: boolean; hate_speech_check: boolean; instructions_following_check: boolean; ... 31 more ...; policyTarget?: "input" | ... 2 more ... | undefined; }'. Did you mean 'toolUseQualityCheck'?

🪛 GitHub Check: build (16.x)
src/types.ts

[failure] 220-220:
Property 'tool_use_quality_check' does not exist on type '{ dangerous_content_check: boolean; grounding_check: boolean; hallucinations_check: boolean; harassment_check: boolean; hate_speech_check: boolean; instructions_following_check: boolean; ... 31 more ...; policyTarget?: "input" | ... 2 more ... | undefined; }'. Did you mean 'toolUseQualityCheck'?

🪛 GitHub Check: build (18.x)
src/types.ts

[failure] 220-220:
Property 'tool_use_quality_check' does not exist on type '{ dangerous_content_check: boolean; grounding_check: boolean; hallucinations_check: boolean; harassment_check: boolean; hate_speech_check: boolean; instructions_following_check: boolean; ... 31 more ...; policyTarget?: "input" | ... 2 more ... | undefined; }'. Did you mean 'toolUseQualityCheck'?

🔇 Additional comments (6)
src/types.ts (4)

5-5: LGTM!

The parentheses around typeof expressions are correct TypeScript syntax for extracting indexed access types from const arrays.

Also applies to: 9-9, 13-13


99-101: LGTM!

The new toolUseQualityCheck field with proper deprecation annotation for the old field follows the established pattern in this schema.


125-129: LGTM!

The deprecation comment for tsqMode and the new tuqMode field are consistent with the field renaming pattern.


187-192: LGTM!

Same deprecation/new field pattern applied consistently to EvaluationProxyAPIRequestSchema.

src/index.ts (2)

7-24: LGTM!

The import restructuring and expanded exports (LLMMessage, ModelMode, PolicyTarget) properly expose the new public types from the SDK.


121-121: LGTM!

The JSDoc example correctly demonstrates usage of the new toolUseQualityCheck field with a deprecation note for the old field.

Comment thread src/types.ts Outdated
Comment thread test/types.spec.ts Outdated
Comment thread test/types.spec.ts Outdated
- Added tool_use_quality_check field as snake_case alternative to toolUseQualityCheck
- Updated validation logic to check all field variants
- Modified index.ts to only send new field names to server with fallback support
- Used nullish coalescing operator for tuq_mode fallback logic
- Maintained backward compatibility with deprecated fields

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/types.ts (1)

169-172: Build error fixed; consider updating the deprecation comment on line 169.

Adding tool_use_quality_check to the schema resolves the previous TypeScript compilation error where the validation referenced a non-existent property.

However, line 169 (unchanged) directs users from tool_selection_quality_checktoolSelectionQualityCheck, which is itself now deprecated on line 189. Consider updating line 169 to point directly to toolUseQualityCheck to avoid a two-hop deprecation path.

♻️ Suggested improvement
-    /** @deprecated Use toolSelectionQualityCheck instead */
+    /** @deprecated Use toolUseQualityCheck instead */
     tool_selection_quality_check: z.boolean().default(false),
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c29851 and 6df96a5.

📒 Files selected for processing (2)
  • src/index.ts
  • src/types.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/index.ts
🔇 Additional comments (6)
src/types.ts (6)

5-5: LGTM!

The parenthesized form (typeof X)[number] is syntactically clearer than typeof X[number] and both are semantically equivalent. Good improvement for consistency.

Also applies to: 9-9, 13-13


99-101: LGTM!

Clear deprecation path from toolSelectionQualityCheck to toolUseQualityCheck with consistent field definition.


125-129: LGTM!

Mode fields follow the established pattern. The deprecation chain tsqModetuqMode is clear.


189-194: LGTM!

New fields and deprecations are consistent with the corresponding changes in EvaluationRequestV2Schema.


219-225: LGTM!

The validation now correctly covers all four field variants for backward compatibility. With tool_use_quality_check now added to the schema (line 172), the previous build failure is resolved.


229-244: LGTM!

The generalized error messages ("tool quality check is enabled") are more maintainable than enumerating specific field names.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/types.ts (1)

169-170: Incorrect deprecation message: points to another deprecated field.

The comment directs users to toolSelectionQualityCheck, which is itself deprecated (line 187). Update to point to the canonical field.

📝 Suggested fix
-    /** @deprecated Use toolSelectionQualityCheck instead */
+    /** @deprecated Use toolUseQualityCheck instead */
     tool_selection_quality_check: z.boolean().default(false),
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6df96a5 and 49f7d15.

📒 Files selected for processing (3)
  • src/index.ts
  • src/types.ts
  • test/types.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/types.spec.ts
🧰 Additional context used
🧬 Code graph analysis (2)
src/index.ts (2)
src/types.ts (6)
  • EvaluationProxyAPIRequest (266-268)
  • EvaluationRequestV2 (272-272)
  • EvaluationResponse (269-269)
  • EvaluationProxyAPIRequestSchema (139-243)
  • EvaluationRequestV2Schema (74-137)
  • Framework (5-5)
src/frameworks/canonical.ts (1)
  • CanonicalEvaluationStrategy (3-8)
src/types.ts (1)
src/index.ts (3)
  • Framework (20-20)
  • ModelMode (22-22)
  • PolicyTarget (23-23)
🔇 Additional comments (8)
src/index.ts (4)

7-24: LGTM!

The import reformatting and expanded re-exports (LLMMessage, ModelMode, PolicyTarget) cleanly expose the public API types needed by consumers.


259-264: LGTM!

The mapping correctly consolidates all legacy and new field variants into single proxy fields (tool_use_quality_check, tuq_mode). Using || for the boolean check and ?? for the enum mode is appropriate. This aligns with the past review feedback to send only the canonical fields to the proxy.


342-346: LGTM!

Consistent with evaluateWithBackwardCompatibility — the converter path also properly maps all tool quality check variants to the single tool_use_quality_check proxy field and uses nullish coalescing for tuq_mode.


121-121: LGTM!

The example code correctly demonstrates the new toolUseQualityCheck field with a helpful inline comment about the deprecation.

src/types.ts (4)

5-13: LGTM!

The parenthesized type syntax (typeof X)[number] is the correct TypeScript pattern for extracting union types from const arrays.


99-101: LGTM!

The new toolUseQualityCheck field and mode fields (tsqMode deprecated, tuqMode preferred) are correctly added with appropriate deprecation annotations.

Also applies to: 125-129


187-192: LGTM!

The new fields are correctly added with proper deprecation guidance (tsqModetuqMode, toolSelectionQualityChecktoolUseQualityCheck).


217-242: LGTM!

The validation correctly triggers on any of the three tool quality check variants (tool_selection_quality_check, toolSelectionQualityCheck, toolUseQualityCheck) and the error messages are appropriately generalized. The previous build failure has been resolved.

Comment thread package.json Outdated
},
"packageManager": "pnpm@10.14.0"
}
} No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please end the file with an empty line

@drorIvry drorIvry merged commit 527b82a into main Jan 8, 2026
3 checks passed
@drorIvry drorIvry deleted the feature/FIRE-987/support-tuq branch January 8, 2026 09:57
@coderabbitai coderabbitai Bot mentioned this pull request Feb 1, 2026
7 tasks
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.

3 participants