OpenAI tool-related fields are dropped when constructing chat message payloads
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
https://github.com/vercel/ai/pull/851
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