Skip to content

Update VercelToolSet to support streamText() method #1393

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

Closed
abhishekpatil4 opened this issue Mar 6, 2025 · 3 comments
Closed

Update VercelToolSet to support streamText() method #1393

abhishekpatil4 opened this issue Mar 6, 2025 · 3 comments

Comments

@abhishekpatil4
Copy link
Contributor

No description provided.

@blackge
Copy link

blackge commented Mar 18, 2025

Hi,

Any update on this? Also do you currently support vercel/ai 4.1.x?

@davidcrouch
Copy link

Would love to know if this issue is on the schedule to be fixed soon. I also note Vercel has just released AI SDK 4.2.

@Karthikeya-Meesala
Copy link
Contributor

Hey @blackge & @davidcrouch - sorry for the wait! Please refer to the below code snippet on how to use streamText():

import { streamText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { VercelAIToolSet } from "composio-core";

const toolset = new VercelAIToolSet({ apiKey: "<composio-api-key>" });
const tools = await toolset.getTools({ actions: ["GMAIL_FETCH_EMAILS"] });

async function main() {
    const prompt = "Fetch the last email from my gmail account & summarise it";

    const { textStream } = streamText({
        model: openai('gpt-4o'),
        system: 'You are a helpful assistant. Use the provided tools when needed.',
        tools,
        prompt,
        maxSteps: 5
    });
    for await (const textPart of textStream) {
        process.stdout.write(textPart);
    }
}

main().catch(console.error);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants