fix(llm): use JSON object structured output - #121
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughChangesThe any-llm integration now uses JSON Object response formatting with Pydantic schemas embedded in the final user message. Provider compatibility is tracked centrally, unsupported providers are rejected by configuration and the adapter factory, and tests cover transport, provider classification, and error paths. JSON Object Output Compatibility
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant AnyLLMStructuredProvider
participant PydanticModel
participant LLMCompletionClient
participant AnyLLM
AnyLLMStructuredProvider->>PydanticModel: Generate JSON schema
AnyLLMStructuredProvider->>LLMCompletionClient: Send schema and json_object response format
LLMCompletionClient->>AnyLLM: Request completion with streaming disabled
AnyLLM-->>LLMCompletionClient: Return JSON Object response
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #121 +/- ##
=======================================
Coverage 99.86% 99.86%
=======================================
Files 115 115
Lines 12239 12327 +88
Branches 730 736 +6
=======================================
+ Hits 12222 12310 +88
Misses 12 12
Partials 5 5 ☔ View full report in Codecov by Harness. |
PR Summary by QodoFix structured LLM output by using OpenAI JSON Object mode + prompt schema
AI Description
Diagram
High-Level Assessment
Files changed (9)
|
Code Review by Qodo
1.
|
0c1f0b4 to
14c9097
Compare
|
Code review by qodo was updated up to the latest commit 14c9097 |
Summary
response_format={"type":"json_object"}Root cause
The production OpenCode Go endpoint accepts the configured base URL and custom
User-Agent, but rejects OpenAIjson_schemastructured-output requests. The same endpoint succeeds with JSON Object mode. The prior SDK-native structured-output call therefore failed upstream even though routing and headers were correct.Scope
This does not change provider priority, add runtime configuration, modify README or
.envexamples, or upgrade any-llm.Validation
prek run --all-filesuv run --with pytest --with pytest-cov -- pytest --cov --cov-branch --cov-report=xml(1255 passed)Summary by CodeRabbit