fix: flatten geospatialQueryTool schema for OpenAI-compatible endpoints#620
fix: flatten geospatialQueryTool schema for OpenAI-compatible endpoints#620itsautomata wants to merge 1 commit into
Conversation
|
@itsautomata is attempting to deploy a commit to the QCX-MAIN Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughGeospatial schema is refactored from a discriminated union to a flat object with optional fields, and the reverse geocoding tool is updated with explicit input validation for required coordinates. ChangesGeospatial Tool & Schema Consolidation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📋 Issue PlannerLet us write the prompt for your AI agent so you can ship faster (with fewer bugs). View plan for ticket: ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: f1041769-5aba-4e23-8bb3-800912a767d7
📒 Files selected for processing (2)
lib/agents/tools/geospatial.tsxlib/schema/geospatial.tsx
📜 Review details
🔇 Additional comments (1)
lib/agents/tools/geospatial.tsx (1)
351-354: LGTM!
3e03207 to
f1265f1
Compare
xAI's /v1/chat/completions rejects `anyOf` in tool parameter schemas. geospatialQuerySchema used `z.discriminatedUnion`, which zod compiles to `anyOf`. Every researcher invocation involving Grok 400'd silently causing a multimodal/model issue. - flatten geospatialQuerySchema from discriminatedUnion to z.object with optional fields and per-queryType description; runtime behavior unchanged (execute() already used `as any` for branch- specific fields) - add runtime guard for required fields (search, geocode, reverse, directions, distance, map), replacing the parse-time field enforcement
f1265f1 to
845e5e1
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@itsautomata did you fix the xai_latest endpoint functionality with this pull request? what model did you test this pull request with? |
|
@ngoiyaeric this PR is complementary to #603 (but the fix applies independently) as it doesn't touch the xAI endpoint but the layer below model selection (the source problem was the schema structure). |
|
@itsautomata does the query type refractory improve the system's capability to classify the prompt for the geospatial tool? Does it respond to the query for geospatial function? |
|
@ngoiyaeric no visible or measured classification improvement I can testify for, but it fixes the xAI bug: now, models with strict schema validation like xAI (and any future provider with similar requirements) work the same as Gemini does today |
This PR fixes the Grok multimodal failure caused by xAI rejecting
anyOfin tool parameter schemas.Key Changes
lib/schema/geospatial.tsx: flattengeospatialQuerySchemawith optional fields. Per-queryTyperequirements moved into thequeryTypedescription.lib/agents/tools/geospatial.tsx: add runtime guard for required fields (search, geocode, reverse, directions, distance, map), replacing the parse-time field enforcement.fixes #581