Description

Use a basic tool, such as

{
toolTest: {
        description: 'Test tool - use this if the user asks to test the tools',
        parameters: z.object({}),
        execute: async () => {
            console.log('Test tool executed')
            return { message: 'Test tool executed' }
        },
    },
}

Then use a prompt such as "test the tools" and observe the console log and the model will respond acknowledging the test.

  • WORKS when using an OpenAI model such as openai('gpt-4o')
  • WORKS when using a Google Gen AI model such as google('gemini-1.5-pro-latest')
  • DOES NOT WORK when using a Google Gen AI model AND { useSearchGrounding: true } option

Code example

const result = await ai({
    model: google('gemini-1.5-pro-latest', {
        useSearchGrounding: true,
    }),
    //model: openai('gpt-4o'),
    prompt: "test the tools" 
    tools: {
        toolTest: {
                description: 'Test tool - use this if the user asks to test the tools',
                parameters: z.object({}),
                execute: async () => {
                    console.log('Test tool executed')
                    return { message: 'Test tool executed' }
                },
            },
        }),
    maxToolRoundtrips: 3,
    temperature: 0.85,
    maxSteps: 3,
    })

AI provider

google('gemini-1.5-pro-latest')

Additional context

No response

Next issue in about 19 hours