Closed tnunamak closed 4 months ago
Hi @tnunamak.
I have a quick change in the codebase to make choices
optional and return {text: ''}
if they are not present. You can access this code in deep-chat-dev
and deep-chat-react-dev
package versions 9.0.129
. These packages work exactly the same as the normal ones except their names are different. If all will be good I will promote the changes to the core package later this week.
Small note, for anyone reading this thread - whilst mixing directConnection property with request can be a simple solution - it can provide some hurdles in the long run. If anything changes in the OpenAI API (or other directConnection service) in the future - we will have to make changes in how we call it, hence there is a chance that your target server may not be compatible to those changes. Also, when it comes to directConnection services that make multiple calls to different urls (e.g. OpenAI assistant), the request url
will not be used as they have multiple hardcoded urls.
The best long-term direction to take is to ofcourse rely entirely on the request property and handle the required message processing on your server (example servers). I understand that this solution can be cumbersome, especially if you want to get going quick, hence I just wanted to bring it to your attention just-in-case.
Also for completeness, it is worth mentioning that you can also use the responseInterceptor to modify the incoming message bodies.
Hopefully this helps. Let me know if you have any questions and most importantly if the upgrade is sufficient. Thanks!
@OvidijusParsiunas thank you, it seems like that fixed it!
The fix has now been released in Deep Chat version 1.4.11
.
I am using Deep Chat with a custom, OpenAI-compatible API as shown (styles omitted).
It seems that sometimes,
extractResultData
is called with a value for whichchoices
is undefined, soresult.choices[0].delta
throws an error. I'm not sure why this is happening, because the event stream data sent by my backend looks correct and works with other clients.In this case, the error appeared during streaming around the time that "1, 2, ___" was displayed. Logs from my backend are showing that there is nothing unusual about the event stream data being sent:
I'm happy to try debugging further, if you have any suggestions.