forked from TheoKanning/openai-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for stream_options in chat completions
Fixes: TheoKanning#502
- Loading branch information
1 parent
e7de81c
commit 217fb8b
Showing
4 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
api/src/main/java/com/theokanning/openai/completion/chat/StreamOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.theokanning.openai.completion.chat; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* <p>Options for streaming response. Only set this when you set stream: true</p> | ||
* see <a href="https://platform.openai.com/docs/api-reference/chat/create#chat-create-stream_options">OpenAi documentation</a> | ||
*/ | ||
@Data | ||
@NoArgsConstructor(force = true) | ||
@AllArgsConstructor | ||
public class StreamOptions { | ||
|
||
/** | ||
* If set, an additional chunk will be streamed before the data: [DONE] message. | ||
* The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. | ||
* All other chunks will also include a usage field, but with a null value. | ||
*/ | ||
@JsonProperty("include_usage") | ||
Boolean includeUsage; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters