fix(types): preserve JSON Schema keywords in responseSchema#169
Open
jckw wants to merge 2 commits intoadaline:mainfrom
Open
fix(types): preserve JSON Schema keywords in responseSchema#169jckw wants to merge 2 commits intoadaline:mainfrom
jckw wants to merge 2 commits intoadaline:mainfrom
Conversation
Contributor
Greptile SummaryFixed a bug where JSON Schema keywords ( Changes:
Testing:
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 7107c26 |
Comment on lines
+26
to
+27
| }) | ||
| .passthrough(); |
Contributor
There was a problem hiding this comment.
FYI: FunctionParameter and FunctionParameters in function-tool.ts have similar structure but don't use .passthrough() - consider applying the same fix there if they need to preserve JSON Schema keywords
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/types/src/config/response-schema.config.ts
Line: 26-27
Comment:
FYI: `FunctionParameter` and `FunctionParameters` in `function-tool.ts` have similar structure but don't use `.passthrough()` - consider applying the same fix there if they need to preserve JSON Schema keywords
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When chatComplete is called with responseSchema.strict = true, Adaline strips nested JSON Schema keys during parsing, so the forwarded schema is altered and strict structured fails.
Summary
additionalProperties,$defs, and$refsurviveRoot Cause
ResponseSchemaPropertyandResponseSchemaStructureused plainz.object(...), which strips unknown keys by default. This removed valid JSON Schema keywords before request execution.Fix
packages/types/src/config/response-schema.config.tsResponseSchemaProperty: add.passthrough()ResponseSchemaStructure: add.passthrough()Validation
pnpm exec vitest run core/providers/openai/tests/models/chat-models/base-chat-model.openai.test.ts