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

🐛🔧 #197: Handle max_tokens & content_filtered finish reasons across OpenAI, Azure and Cohere #194

Merged
merged 6 commits into from
Apr 11, 2024

Conversation

roma-glushko
Copy link
Member

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

There is only one stream finish_reason handled as of now which is complete. But others are possible too.

Changes

In this PR, I'm handling the finish reason related to:

  • text length bound passed in request params
  • content moderation/toxicity
  • Cohere streaming workflow doesn't seem to be working as errMapper was not really initialized. I have fixed that in this PR
  • Cohere now ignores stream chunk types that Glide doesn't support like citation related stuff
  • Cohere stream chunks are not set with the correct model name (e.g. some placeholder was used before)

@roma-glushko roma-glushko self-assigned this Apr 7, 2024
@roma-glushko roma-glushko changed the title Handle generation is too long as a finish reason 🐛 Handle generation is too long as a finish reason Apr 7, 2024
Copy link

codecov bot commented Apr 7, 2024

Codecov Report

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

Project coverage is 65.98%. Comparing base (12df04f) to head (2d0cad3).

Files Patch % Lines
pkg/providers/cohere/finish_reason.go 16.00% 21 Missing ⚠️
pkg/providers/cohere/chat_stream.go 44.00% 14 Missing ⚠️
pkg/providers/openai/finish_reasons.go 56.00% 11 Missing ⚠️
pkg/providers/cohere/chat.go 0.00% 1 Missing ⚠️
pkg/routers/config.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #194      +/-   ##
===========================================
+ Coverage    65.69%   65.98%   +0.29%     
===========================================
  Files           74       76       +2     
  Lines         3518     3546      +28     
===========================================
+ Hits          2311     2340      +29     
+ Misses        1082     1081       -1     
  Partials       125      125              

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

@roma-glushko roma-glushko marked this pull request as draft April 7, 2024 20:26
@roma-glushko roma-glushko changed the title 🐛 Handle generation is too long as a finish reason 🐛 #197 Handle generation is too long as a finish reason Apr 8, 2024
@roma-glushko roma-glushko linked an issue Apr 8, 2024 that may be closed by this pull request
@roma-glushko roma-glushko marked this pull request as ready for review April 10, 2024 19:16
@roma-glushko roma-glushko changed the title 🐛 #197 Handle generation is too long as a finish reason 🐛 #197: Handle max_tokens & content_filtered finish reasons across OpenAI, Azure and Cohere Apr 10, 2024
@roma-glushko roma-glushko changed the title 🐛 #197: Handle max_tokens & content_filtered finish reasons across OpenAI, Azure and Cohere 🐛🔧 #197: Handle max_tokens & content_filtered finish reasons across OpenAI, Azure and Cohere Apr 10, 2024
@roma-glushko roma-glushko merged commit a3bcba0 into develop Apr 11, 2024
10 checks passed
@roma-glushko roma-glushko deleted the add-too-long-length-as-finish-reason branch April 11, 2024 17:45
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] Handle generation is too long as a finish reason
1 participant