Skip to content

Add GuidedChoice to ChatCompletionRequest #1034

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ func (r *ChatCompletionResponseFormatJSONSchema) UnmarshalJSON(data []byte) erro
return nil
}

// ChatCompletionRequestExtensions contains non-standard OpenAI API extensions.
type ChatCompletionRequestExtensions struct {
// GuidedChoice restricts output to a set of predefined choices.
GuidedChoice []string `json:"guided_choice,omitempty"`
}

// ChatCompletionRequest represents a request structure for chat completion API.
type ChatCompletionRequest struct {
Model string `json:"model"`
Expand Down Expand Up @@ -309,6 +315,8 @@ type ChatCompletionRequest struct {
ChatTemplateKwargs map[string]any `json:"chat_template_kwargs,omitempty"`
// Specifies the latency tier to use for processing the request.
ServiceTier ServiceTier `json:"service_tier,omitempty"`
// Embedded struct for non-OpenAI extensions
ChatCompletionRequestExtensions
}

type StreamOptions struct {
Expand Down
Loading