Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First Word Missing in onChatCompletionSSE Responses #69

Closed
Abdullatif-Eida opened this issue Nov 9, 2023 · 17 comments
Closed

First Word Missing in onChatCompletionSSE Responses #69

Abdullatif-Eida opened this issue Nov 9, 2023 · 17 comments

Comments

@Abdullatif-Eida
Copy link

Abdullatif-Eida commented Nov 9, 2023

The onChatCompletionSSE response for generating a 200-word description of Turkey for example is experiencing an anomaly where the first word is returned as null or an empty string as shown belowÍ.

Screen Shot 2023-11-09 at 10 46 22

i am using the example shared by you

platform:IOS but also it occurs inside android
chat_gpt_sdk 2.2.5
flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.8, on macOS 12.6.8 21G725 darwin-x64, locale en-TR)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.83.1)
[✓] Connected device (4 available)
[✓] Network resources

@Abdullatif-Eida Abdullatif-Eida changed the title the response that comes from onChatCompletionSSE come minus oner word the response that comes from onChatCompletionSSE come minus onee word Nov 9, 2023
@Abdullatif-Eida Abdullatif-Eida changed the title the response that comes from onChatCompletionSSE come minus onee word the response that comes from onChatCompletionSSE come minus one word Nov 9, 2023
@Abdullatif-Eida Abdullatif-Eida changed the title the response that comes from onChatCompletionSSE come minus one word First Word Missing in onChatCompletionSSE Responses Nov 9, 2023
@redevrx
Copy link
Owner

redevrx commented Nov 9, 2023

@Abdullatif-Eida Thank your for this report , this problem chunk in stream response , I will fix it.

@garegintamrazyan07
Copy link

when can you fix this @redevrx ?

@garegintamrazyan07
Copy link

@Abdullatif-Eida is there a workaround for this ?

@redevrx
Copy link
Owner

redevrx commented Nov 9, 2023

@garegintamrazyan07 You can try version 2.5.6 in this repo. https://pub.dev/packages/chat_gpt_sdk

@garegintamrazyan07
Copy link

thanks, will check

@garegintamrazyan07
Copy link

hey @redevrx , it seems that new version is not working ?

Bad state: Cannot add new events after calling close flutter: #0 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:243:24) #1 OpenAIClient.sse.<anonymous closure>.<anonymous closure> (package:chat_gpt_sdk/src/client/openai_client.dart:285:25) #2 _rootRun (dart:async/zone.dart:1391:47) #3 _ZoneDelegate.run (dart:async/zone.dart:952:19) #4 AsyncAction._run (package:mobx/src/api/async/async_action.dart:43:29) #5 _ZoneDelegate.run (dart:async/zone.dart:952:19) #6 AsyncAction._run (package:mobx/src/api/async/async_action.dart:43:29) #7 _ZoneDelegate.run (dart:async/zone.dart:952:19) #8 AsyncAction._run (package:mobx/src/api/async/async_action.dart:43:29) #9 _ZoneDelegate.run (dart:async/zone.dart:952:19) #10 AsyncAction._run (package:mobx/src/api/async/async_action.dart:43:29) #11 _CustomZone.run (dart:async/zone.dart:1301:19) #12 _CustomZone.runGuarded (dart:async/zone.dart:1209:7) #13 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.da<…>

@onursahindur
Copy link

hey @redevrx , it seems that new version is not working ?

Bad state: Cannot add new events after calling close flutter: #0 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:243:24) #1 OpenAIClient.sse.<anonymous closure>.<anonymous closure> (package:chat_gpt_sdk/src/client/openai_client.dart:285:25) #2 _rootRun (dart:async/zone.dart:1391:47) #3 _ZoneDelegate.run (dart:async/zone.dart:952:19) #4 AsyncAction._run (package:mobx/src/api/async/async_action.dart:43:29) #5 _ZoneDelegate.run (dart:async/zone.dart:952:19) #6 AsyncAction._run (package:mobx/src/api/async/async_action.dart:43:29) #7 _ZoneDelegate.run (dart:async/zone.dart:952:19) #8 AsyncAction._run (package:mobx/src/api/async/async_action.dart:43:29) #9 _ZoneDelegate.run (dart:async/zone.dart:952:19) #10 AsyncAction._run (package:mobx/src/api/async/async_action.dart:43:29) #11 _CustomZone.run (dart:async/zone.dart:1301:19) #12 _CustomZone.runGuarded (dart:async/zone.dart:1209:7) #13 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.da<…>

same here

@Abdullatif-Eida
Copy link
Author

hey @redevrx , it seems that new version is not working ?

Bad state: Cannot add new events after calling close flutter: #0 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:243:24) #1 OpenAIClient.sse.<anonymous closure>.<anonymous closure> (package:chat_gpt_sdk/src/client/openai_client.dart:285:25) #2 _rootRun (dart:async/zone.dart:1391:47) #3 _ZoneDelegate.run (dart:async/zone.dart:952:19) #4 AsyncAction._run (package:mobx/src/api/async/async_action.dart:43:29) #5 _ZoneDelegate.run (dart:async/zone.dart:952:19) #6 AsyncAction._run (package:mobx/src/api/async/async_action.dart:43:29) #7 _ZoneDelegate.run (dart:async/zone.dart:952:19) #8 AsyncAction._run (package:mobx/src/api/async/async_action.dart:43:29) #9 _ZoneDelegate.run (dart:async/zone.dart:952:19) #10 AsyncAction._run (package:mobx/src/api/async/async_action.dart:43:29) #11 _CustomZone.run (dart:async/zone.dart:1301:19) #12 _CustomZone.runGuarded (dart:async/zone.dart:1209:7) #13 _BufferingStreamSubscription._sendDone.sendDone (dart:async/stream_impl.da<…>

same issue here

@tinyCoder32
Copy link

The new update doesn't work.

@Fudal
Copy link

Fudal commented Nov 10, 2023

+1

@garegintamrazyan07
Copy link

@redevrx can we have a fix for this ?

@tinyCoder32
Copy link

tinyCoder32 commented Nov 13, 2023

Hello, are you planning to fix it soon or shall we move to another package temporarily?

@Abdullatif-Eida
Copy link
Author

go to pubspec.yaml the go to chat_gpt_sdk and make it chat_gpt_sdk: 2.2.5 and everything will work again event the First Word Missing in onChatCompletionSSE Responses issue is change but everything is working now

@garegintamrazyan07
Copy link

@Abdullatif-Eida it is not working

@tinyCoder32
Copy link

@Abdullatif-Eida it is not working

It worked for me, just clean the project and force the version:

chat_gpt_sdk: 2.2.5

@prdgymx
Copy link

prdgymx commented Nov 14, 2023

Still experiencing this using 2.2.5 - seeing this in the debug console:

[OpenAI] stream response invalid try regenerate
[OpenAI] last json error :{"id":"chatcmpl-XXXXXXX","object":"chat.completion.chunk","created":1699997222,"model":"gpt-4-0613","choices":[{"index":0,"delta":{"rol
[OpenAI] stream response is done

@gamestap99
Copy link
Contributor

gamestap99 commented Nov 22, 2023

redevrx added a commit that referenced this issue Nov 22, 2023
fix #69: sse not work as intended
wliu6v added a commit to wliu6v/chat_gpt_sdk that referenced this issue Nov 22, 2023
redevrx added a commit that referenced this issue Dec 19, 2023
fix #69: missing first word in sse response for example_app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants