-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Why use JsonNode instead of String? #338
Comments
Hi, the useage of JsonNode is also causing some Errors in receiving Json Arguments via streams. If a message Junk is Possible faulty Json Arguments like this are a result Speaking of this part in the OpenAiService Class in Line 460:
Behaviour is easily reproducable with this simple test: |
The issue is probably because it tries to leverage the same structure of full messages to chunks. This example didn't work for me |
First I thought it was a Jackson version but it's gpt-4-1106-preview that works different than GPT-4 and GPT-3.5-turbo. Even the example doesn't work |
Is there any news on this issue?
I would get
Note that the quoting of the first parameter seems to be OK. This however at first glance makes the quoting or lack thereof totally unpredicatable and thus hard to work around. |
See my solution on #422 . The JsonNode removes some of the " causing that issue. |
I noticed that the arguments property in com.theokanning.openai.completion.chat.ChatFunctionCall class, which is supposed to be a serialized JSON string, is being represented as a JsonNode in the code. I would like to understand why JsonNode is chosen over directly using the String type. Since TextNode also stores a string, I'm not quite sure why String type wasn't used directly. What are the advantages of using JsonNode? I apologize for not considering its benefits earlier.
The text was updated successfully, but these errors were encountered: