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

fix (provider/openai): introduce compatibility mode #1595

Merged
merged 1 commit into from
May 15, 2024

Conversation

lgrammel
Copy link
Collaborator

Summary

Introduces a compatibility mode for OpenAI. OpenAI language models do not send stream_options in compatibility mode. Compatibility mode is enabled by default when using createOpenAI. When using the default instance openai, it is set to strict

Reason

  1. OpenAI did not sent token usage when streaming for some users
  2. PR feat (provider/openai): set stream_options/include_usage to true when streaming #1578 introduced sending stream_options to get token usage
  3. This broke streaming for Groq, Fireworks and possibly other providers
  4. This PR introduces a compatibility mode to fix it without breaking changes.

@lgrammel lgrammel requested a review from shuding May 15, 2024 14:06
@lgrammel lgrammel self-assigned this May 15, 2024
@lgrammel lgrammel merged commit 4e3c922 into main May 15, 2024
6 checks passed
@lgrammel lgrammel deleted the lg/fix-openai-compat branch May 15, 2024 14:12
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

Successfully merging this pull request may close these issues.

2 participants