ai icon indicating copy to clipboard operation
ai copied to clipboard

OpenAI tool-related fields are dropped when constructing chat message payloads

Open maks-ivanov opened this issue 2 years ago • 1 comments

Description

In 2.2.30 release there's new support for tool calling, but it seems that the new fields are not properly handled when constructing message payloads. Example logic: https://github.com/vercel/ai/blob/e4a97b62ef62fb80a02a12d8f405653c818ed7f1/packages/core/react/use-chat.ts#L100-110

In this example Message.tool_call_id and Message.tool_calls are implicitly deemed "extra" and not included in message payloads unless sendExtraMessageFields flag is set. I believe this not the intended behavior.

Thank you to all the contributors and especially @Archimagus for this work!

Code example

No response

Additional context

No response

maks-ivanov avatar Dec 21 '23 20:12 maks-ivanov

https://github.com/vercel/ai/pull/851

lgrammel avatar Dec 21 '23 20:12 lgrammel

Please check out our new tool calling with AI SDK Core and useChat:

  • https://sdk.vercel.ai/docs/ai-sdk-core/tools-and-tool-calling
  • https://sdk.vercel.ai/docs/ai-sdk-ui/chatbot-with-tool-calling

lgrammel avatar May 24 '24 15:05 lgrammel