ai icon indicating copy to clipboard operation
ai copied to clipboard

Handle function calls that come after the start of a message

Open woodbridge opened this issue 1 year ago • 5 comments

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.

woodbridge avatar Sep 27 '23 18:09 woodbridge

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'.

MaxLeiter avatar Oct 05 '23 07:10 MaxLeiter

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!

MaxLeiter avatar Oct 13 '23 15:10 MaxLeiter

Can someone provide a reproduction? I don't believe OpenAI should be including the function calls after text in a message.

MaxLeiter avatar Oct 17 '23 21:10 MaxLeiter

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 :)

StefanDjokovic avatar Oct 18 '23 06:10 StefanDjokovic

Heya, this happens very often to me now too. Any movement? Thansk!

gediminastub avatar Feb 20 '24 08:02 gediminastub

The old function calling in useChat has been deprecated.

lgrammel avatar Jun 05 '24 09:06 lgrammel