Skip to content

Add CompletionRequest.StreamOptions #959

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

Merged

Conversation

stmcginnis
Copy link
Contributor

Describe the change

The legacy completion API supports a stream_options object when stream is set to true. This adds a StreamOptions property to the CompletionRequest struct to support this setting.

Provide OpenAI documentation link

https://platform.openai.com/docs/api-reference/completions/create#completions-create-stream_options

Describe your solution

This adds a StreamOptions property (marshaled as stream_options) to the CompletionRequest struct to expose the setting. This matches the ChatCompletionRequest property.

The legacy completion API supports a `stream_options` object when
`stream` is set to true [0]. This adds a StreamOptions property to the
CompletionRequest struct to support this setting.

[0] https://platform.openai.com/docs/api-reference/completions/create#completions-create-stream_options

Signed-off-by: Sean McGinnis <[email protected]>
Copy link

codecov bot commented Mar 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.88%. Comparing base (774fc9d) to head (ec76779).
Report is 95 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #959      +/-   ##
==========================================
+ Coverage   98.46%   98.88%   +0.41%     
==========================================
  Files          24       27       +3     
  Lines        1364     1786     +422     
==========================================
+ Hits         1343     1766     +423     
+ Misses         15       14       -1     
  Partials        6        6              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Owner

@sashabaranov sashabaranov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@sashabaranov sashabaranov merged commit da5f9bc into sashabaranov:master Apr 29, 2025
3 checks passed
@stmcginnis stmcginnis deleted the legacy-chat-stream-options branch April 29, 2025 13:40
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