OvidijusParsiunas / deep-chat

Fully customizable AI chatbot component for your website
https://deepchat.dev
MIT License
1.26k stars 170 forks source link

Direct Connection Fails to Stream Response: OpenAI Assistance #155

Open 7h360df47h3r opened 3 months ago

7h360df47h3r commented 3 months ago

I am encountering an issue when using direct connection using OpenAI API Assistants where this fails to stream the response despite property stream being set to true within the DeepChat component.

Documentation for your reference: https://platform.openai.com/docs/api-reference/assistants-streaming

Thanks in advance for your help!

OvidijusParsiunas commented 3 months ago

Hi @7h360df47h3r.

Thankyou for raising this issue. The Assistants stream API is definitely new and I was not aware that it was released, hence to-date I have just been recommending developers to use stream simulation instead.

This is very cool and I'll see what I can do to implement it for the next release.

I'll update you on the progress!

OvidijusParsiunas commented 3 months ago

I have started to do the work for the streaming API, but it may take me a couple of days to get it all working as it is quite complex and my time these couple of days is unfortunately limited due to UK holidays.

I'll update you on the progress.

7h360df47h3r commented 3 months ago

No worries, it's great that you've already started digging into it.

Enjoy the holidays! You've earned it. Looking forward to touching base once you're back at it.

OvidijusParsiunas commented 2 months ago

Hey, think I got it to work. I have published the code in deep-chat-dev and deep-chat-react-dev versions 9.0.156. These packages work exactly like the main ones except their names are different. You may also notice a few API changes, such as the stream property being moved to connect - which is the new request. Nevertheless, everything is backwards compatible and the old properties should work just fine - although you will get a few console/ts warnings that can be ignored.

The changes will be published in the next release which will happen in the next couple of weeks. Let me know if you have any difficulties or issues in using the dev packages.

Thanks!