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

🐛 #200: Implemented a custom json per line stream reader to read Cohere chat streams correctly #201

Merged
merged 4 commits into from
Apr 15, 2024

Conversation

roma-glushko
Copy link
Member

@roma-glushko roma-glushko commented Apr 11, 2024

Cohere has a unique format of their streams which is not SSE but json chunk per line.

In this PR,

  • I'm implementing a custom stream reader to correctly handle Cohere streams
  • Start handling the stream-start event to propagate generationID to all following chunks

Testing

Changes were tested via Glide Python client:
Screenshot 2024-04-11 at 23 31 03

@roma-glushko roma-glushko linked an issue Apr 11, 2024 that may be closed by this pull request
@roma-glushko roma-glushko marked this pull request as draft April 11, 2024 20:57
@roma-glushko roma-glushko marked this pull request as ready for review April 14, 2024 09:06
Copy link

codecov bot commented Apr 15, 2024

Codecov Report

Attention: Patch coverage is 81.03448% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 67.34%. Comparing base (45d9aa1) to head (e2eb8ab).

Files Patch % Lines
pkg/providers/cohere/stream_reader.go 75.67% 8 Missing and 1 partial ⚠️
pkg/providers/cohere/chat_stream.go 90.47% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #201      +/-   ##
===========================================
+ Coverage    65.89%   67.34%   +1.44%     
===========================================
  Files           77       78       +1     
  Lines         3548     3586      +38     
===========================================
+ Hits          2338     2415      +77     
+ Misses        1085     1043      -42     
- Partials       125      128       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@roma-glushko roma-glushko merged commit 9a0ee6d into develop Apr 15, 2024
10 checks passed
@roma-glushko roma-glushko deleted the 200-cohere-parsing-stream-chat-correctly branch April 15, 2024 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 [Lang] Cohere: Streaming Workflow is not working
1 participant