-
Notifications
You must be signed in to change notification settings - Fork 254
Allow schemas with tools and support overriding providers #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enables the simultaneous use of response schemas and tools in VS Code test commands, which were previously mutually exclusive. The change consolidates the two separate streaming methods into a unified approach.
- Removes the restriction preventing tools and response schemas from being used together
- Consolidates
handleResponseSchemaStreamandhandleRegularTextStreaminto a singlehandleTextStreammethod - Updates documentation to reflect that tools can coexist with response schemas
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/poml-vscode/command/testCommand.ts | Removes mutual exclusion logic, consolidates streaming methods, and implements unified handling of tools and response schemas |
| docs/language/standalone.md | Updates documentation to remove the mutual exclusion statement and clarifies tools can work with response schemas |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| import { createGoogleGenerativeAI } from '@ai-sdk/google'; | ||
| import { createAzure } from '@ai-sdk/azure'; | ||
| import { ModelMessage, streamText, tool, jsonSchema, Tool, streamObject, TextStreamPart, TextPart, ImagePart, ToolCallPart, ToolResultPart } from 'ai'; | ||
| import { ModelMessage, streamText, tool, jsonSchema, Tool, TextStreamPart, TextPart, ImagePart, ToolCallPart, ToolResultPart } from 'ai'; |
Copilot
AI
Aug 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The streamObject import was removed but may still be needed elsewhere in the codebase. Consider verifying all usage has been migrated to the new unified approach.
| // Immediately throw the error | ||
| throw error; | ||
| }, | ||
| tools: prompt.tools ? this.toVercelTools(prompt.tools) : undefined, |
Copilot
AI
Aug 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using experimental_output suggests this is an unstable API. Consider adding a comment explaining this is experimental and may change in future versions.
| tools: prompt.tools ? this.toVercelTools(prompt.tools) : undefined, | |
| tools: prompt.tools ? this.toVercelTools(prompt.tools) : undefined, | |
| // NOTE: The `experimental_output` property is an experimental/unstable API and may change or be removed in future versions of the library. |
| parsePartial: async ({ text }) => { | ||
| try { | ||
| return { partial: JSON.parse(text) }; | ||
| } catch { |
Copilot
AI
Aug 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The empty catch block silently ignores parsing errors. Consider logging the error or adding a comment explaining why the error is intentionally ignored.
| } catch { | |
| } catch (err) { | |
| console.warn('Failed to parse partial JSON output:', err, 'Input text:', text); |
…emove-schema-and-tool-use-restriction
Uh oh!
There was an error while loading. Please reload this page.