-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat(ts): upgrade Vercel provider to support AI v6 #2314
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
base: next
Are you sure you want to change the base?
Conversation
|
The Please review and fix the vulnerabilities. You can try running: pnpm audit --fix --prodAudit output |
|
|
||
| // 4. Retrieve tools. | ||
| console.log(`🔄 Retrieving tools...`); | ||
| const tools = await session.tools(); |
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.
While using MCP tools should be extracted from the MCP client and not from the session. Only during native tool use we should extract it from the session.
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.
| "@composio/core": "workspace:*", | ||
| "@composio/vercel": "workspace:*", | ||
| "ai": "catalog:" | ||
| "ai": "^6.0.3" |
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.
If we are updating the core package, let's use catalog itself?
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.
| const { text } = await generateText({ | ||
| model: openai.responses('gpt-4.1'), | ||
| tools: tools, | ||
| model: openai('gpt-4o-mini'), |
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.
Mini models doesn't perform well, can we use latest models?
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.
Sure, that can be changed. I had used gpt-4o-mini because it was the one already introduced in src/stream.ts by 9e002c5#diff-534cbbffb3adc765fa52727a5fb7286ee4fbeb0a846af5aacf1de20b903a0d29 3 weeks ago.
Is gpt-5.2 ok?
| @@ -0,0 +1,84 @@ | |||
| import { openai } from '@ai-sdk/openai'; | |||
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.
For vercel ai sdk 6, the primary feature is their agents, can we have an example using their Agents feature?
import { ToolLoopAgent } from 'ai';
import { weatherTool } from '@/tools/weather';
export const weatherAgent = new ToolLoopAgent({
model: 'anthropic/claude-sonnet-4.5',
instructions: 'You are a helpful weather assistant.',
tools: {
weather: weatherTool,
},
});
const result = await weatherAgent.generate({
prompt: 'What is the weather in San Francisco?',
});
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.
| import { VercelProvider } from '@composio/vercel'; | ||
| import dotenv from 'dotenv'; | ||
| import { MessageRoles } from './types'; | ||
| dotenv.config(); |
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.
Environment variables not loaded after dotenv removal
The dotenv import and dotenv.config() call were removed from stream.ts, but the code still accesses process.env.COMPOSIO_API_KEY on line 10. Unlike other example files in the project (such as openai/src/chat-completions.ts) that properly call dotenv.config() before accessing environment variables, this file no longer loads the .env file. For users running this example with Node.js (rather than Bun, which auto-loads .env files), the COMPOSIO_API_KEY will be undefined, causing the example to fail.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
||
| // 2. Create an MCP session | ||
| console.log('🔄 Creating toolrouter session...'); | ||
| const session = await composio.create('jkomyno', { |
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.
Developer username hardcoded in example files
The example files use the developer's personal username 'jkomyno' as the user identifier in composio.create() calls. Other examples like ai.ts consistently use the generic placeholder 'test-user-id'. Using a specific developer's username in documentation examples is inconsistent and may confuse users following the examples.
This PR:
aiv6 (https://vercel.com/blog/ai-sdk-6)ai@6+@composio/vercel@composio/vercel's peerDependencies to support eitherai@5orai@6@composio/vercelremains the same, but types need to be updated accordingly