Skip to content

Commit da5f9bc

Browse files
authored
Add CompletionRequest.StreamOptions (#959)
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]>
1 parent bb5bc27 commit da5f9bc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

completion.go

+2
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ type CompletionRequest struct {
215215
Temperature float32 `json:"temperature,omitempty"`
216216
TopP float32 `json:"top_p,omitempty"`
217217
User string `json:"user,omitempty"`
218+
// Options for streaming response. Only set this when you set stream: true.
219+
StreamOptions *StreamOptions `json:"stream_options,omitempty"`
218220
}
219221

220222
// CompletionChoice represents one of possible completions.

0 commit comments

Comments
 (0)