vercel / ai

Build AI-powered applications with React, Svelte, Vue, and Solid
https://sdk.vercel.ai/docs
Other
10.31k stars 1.55k forks source link

All number of `maxSteps` are always executed with Google Vertex AI even when it leads to repetition #3470

Open mauricekleine opened 3 weeks ago

mauricekleine commented 3 weeks ago

Description

When using the vertexProvider (import { createVertex } from '@ai-sdk/google-vertex';) and setting maxSteps to any number, streamText always runs exactly the number of maxSteps defined, even if it leads to repetitive tool calls with the same arguments

Code example

No response

Additional context

No response

lgrammel commented 3 weeks ago

can you share the tools you're using?

mauricekleine commented 3 weeks ago

@lgrammel they're tools that call other LLMs, like so:

export const myTool = tool({
    description: "...",
    execute: async (args) => {
        const result = await generateText({
            model: vertex,
            prompt: "..."
            system: "..."
        });

        return { text: result.text };
    },
    parameters: z.object({ ... })
});