Feature - new apis#28
Conversation
WalkthroughBumps package version to 1.7.0, changes default API host to api.qualifire.ai, updates telemetry/tracing base URL, expands evaluation/invoke payloads and endpoints to /api/v1/..., re-exports Changes
Sequence Diagram(s)sequenceDiagram
participant SDK as Client SDK
participant Conv as Converter
participant API as Qualifire API
participant Eval as Evaluation Service
SDK->>Conv: prepare/convert request (messages, tools, modes...)
alt converter path
Conv->>API: POST /api/v1/evaluation/evaluate (converted payload)
else direct/backward-compatible path
SDK->>API: POST /api/v1/evaluation/evaluate (messages, available_tools, modes...)
end
API->>Eval: enqueue/evaluate request
Eval-->>API: evaluation result
API-->>SDK: return EvaluationResponse
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/index.ts (2)
45-58:⚠️ Potential issue | 🟠 MajorDefault baseUrl should remain the proxy endpoint.
Switching the default to the direct API changes expected routing; keep the proxy as the default and allow the direct API via override instead.🔧 Suggested fix
- const qualifireBaseUrl = - baseUrl || process.env.QUALIFIRE_BASE_URL || 'https://api.qualifire.ai'; + const qualifireBaseUrl = + baseUrl || process.env.QUALIFIRE_BASE_URL || 'https://proxy.qualifire.ai';As per coding guidelines: Qualifire API endpoint should be
{baseUrl}/api/evaluation/evaluatewith default baseUrl ofhttps://proxy.qualifire.ai.
415-441:⚠️ Potential issue | 🟡 MinorGuard against empty invokeEvaluation payloads.
Withinput/outputoptional, it’s now possible to call this with no model data and no messages. Add a quick validation to avoid sending invalid requests.🛡️ Suggested fix
}): Promise<EvaluationResponse | undefined> => { + if (!input && !output && (!messages || messages.length === 0)) { + throw new Error('invokeEvaluation requires input/output or messages.'); + } const url = `${this.baseUrl}/api/evaluation/invoke`;
🤖 Fix all issues with AI agents
In `@src/index.ts`:
- Around line 268-277: The converter-based path for EvaluationRequestV2 is
missing propagation of new policy fields (policy_multi_turn_mode, policy_target,
allowed_topics and the other policy/grounding/assertion mode fields) from
evaluationProxyAPIRequest; update the converter payload construction used by
EvaluationRequestV2 to include the same mappings as the backward-compat path
(e.g., map evaluationProxyAPIRequest.policyMultiTurnMode ->
policy_multi_turn_mode, policyTarget -> policy_target, allowedTopics ->
allowed_topics, and likewise for assertions_mode, hallucinations_mode,
grounding_mode, grounding_multi_turn_mode) so converter callers send the new
fields as well.
| evaluationProxyAPIRequest.tuqMode ?? evaluationProxyAPIRequest.tsqMode, | ||
| assertions: evaluationProxyAPIRequest.assertions, | ||
| assertions_mode: evaluationProxyAPIRequest.assertionsMode, | ||
| hallucinations_mode: evaluationProxyAPIRequest.hallucinationsMode, | ||
| grounding_mode: evaluationProxyAPIRequest.groundingMode, | ||
| grounding_multi_turn_mode: | ||
| evaluationProxyAPIRequest.groundingMultiTurnMode, | ||
| policy_multi_turn_mode: evaluationProxyAPIRequest.policyMultiTurnMode, | ||
| policy_target: evaluationProxyAPIRequest.policyTarget, | ||
| allowed_topics: evaluationProxyAPIRequest.allowedTopics, |
There was a problem hiding this comment.
Propagate new policy mode fields to converter-based requests.
These fields are only sent in the backward-compat path, so EvaluationRequestV2 callers using converters won’t send them. Consider adding them to the converter payload as well.
➕ Suggested fix
tuq_mode: EvaluationRequestV2.tuqMode ?? EvaluationRequestV2.tsqMode,
assertions: EvaluationRequestV2.assertions,
+ assertions_mode: EvaluationRequestV2.assertionsMode,
+ hallucinations_mode: EvaluationRequestV2.hallucinationsMode,
+ grounding_mode: EvaluationRequestV2.groundingMode,
+ grounding_multi_turn_mode: EvaluationRequestV2.groundingMultiTurnMode,
+ policy_multi_turn_mode: EvaluationRequestV2.policyMultiTurnMode,
+ policy_target: EvaluationRequestV2.policyTarget,
topic_scoping_mode: EvaluationRequestV2.topicScopingMode,🤖 Prompt for AI Agents
In `@src/index.ts` around lines 268 - 277, The converter-based path for
EvaluationRequestV2 is missing propagation of new policy fields
(policy_multi_turn_mode, policy_target, allowed_topics and the other
policy/grounding/assertion mode fields) from evaluationProxyAPIRequest; update
the converter payload construction used by EvaluationRequestV2 to include the
same mappings as the backward-compat path (e.g., map
evaluationProxyAPIRequest.policyMultiTurnMode -> policy_multi_turn_mode,
policyTarget -> policy_target, allowedTopics -> allowed_topics, and likewise for
assertions_mode, hallucinations_mode, grounding_mode, grounding_multi_turn_mode)
so converter callers send the new fields as well.
Description of change
Pull-Request Checklist
mainbranchnpm run lintpasses with this changenpm run testpasses with this changeFixes #0000Summary by CodeRabbit
New Features
Bug Fixes / Improvements
Chores
✏️ Tip: You can customize this high-level summary in your review settings.