ai
ai copied to clipboard
Handle function calls that come after the start of a message
Currently, function calls that come later in a message stream will be treated as part of the message content and displayed directly to the user, eg:
Now searching library....{"function_call"....}
This change parses them into the expected function_call message format to work as expected.
Thanks @woodbridge. I haven't taken a close look yet but it seems like there's a typescript error:
Error: react/use-chat.ts(308,28): error TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
Hey @woodbridge, sorry for the delay here. Would you mind reviewing @StefanDjokovic's comments, then I can give it a final look and approval? Thank you!
Can someone provide a reproduction? I don't believe OpenAI should be including the function calls after text in a message.
Hi @MaxLeiter , here is a "minimal" repro based on the ai-chatbot https://github.com/StefanDjokovic/ai-chatbot-repro/pull/1
You can see that at the end of the conversation the "{function: ...}" is printed instead of calling the actual function.
You can also repro this behaviour on ChatGPT with plugins, it is expected for GPT to be able to chat and do function calls in between its own message. Let me know if there is anything else I can do to help here :)
Heya, this happens very often to me now too. Any movement? Thansk!
The old function calling in useChat
has been deprecated.