When using functions combined with streaming completions, the ChatFunctionCallArgumentsSerializerAndDeserializer is used to deserialize arguments. This is broken because quotes get stripped from the chunks that get returned. This leads to a JSON deserialization exception of the combined chunks (when the arguments JSON gets parsed).
The token ":{" is decoded to :{ and then decoded again, so losing all quotes in the process. This leads to a Jackson parse exception later when the aggregate of the chunks is (attempted to be) deserialised into the arguments.
I tried to use my own ChatFunctionCallMixIn but failed to plug that in. Also: there seems to be no way to override the mapper in OpenAiService which is kind of bummer because then I could have just plugged in a fix (in stead of patching the source below)
Changes
Added a call to the mapper to encode quotes before decoding them again. Without this fix the JSON arguments string loses all quotes and becomes invalid for parsing later on
Description
When using functions combined with streaming completions, the ChatFunctionCallArgumentsSerializerAndDeserializer is used to deserialize arguments. This is broken because quotes get stripped from the chunks that get returned. This leads to a JSON deserialization exception of the combined chunks (when the arguments JSON gets parsed).
The token ":{" is decoded to :{ and then decoded again, so losing all quotes in the process. This leads to a Jackson parse exception later when the aggregate of the chunks is (attempted to be) deserialised into the arguments.
I tried to use my own ChatFunctionCallMixIn but failed to plug that in. Also: there seems to be no way to override the mapper in OpenAiService which is kind of bummer because then I could have just plugged in a fix (in stead of patching the source below)
Changes
Added a call to the mapper to encode quotes before decoding them again. Without this fix the JSON arguments string loses all quotes and becomes invalid for parsing later on
New API Checklist