vercel / ai

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

OpenAI provider does not support all tool names #1972

Open mohamedcherifmo opened 2 weeks ago

mohamedcherifmo commented 2 weeks ago

Description

Create a tool called multi_tooluse.parallel within the tools (to overcome hallucination issue in GTP4-o) An error is produced Invalid 'tools[0].function.name': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9-]+$'.

Code example

const messageStream = await streamUI({ model: openai('gpt-4o'), tools: { "multi_tool_use.parallel": { }

Additional context

No response

lgrammel commented 2 weeks ago

This is a restriction by OpenAI afaik. However we could look into mapping tool names automatically.