Skip to content

Add Prediction field #970

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
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ type ChatCompletionRequest struct {
ReasoningEffort string `json:"reasoning_effort,omitempty"`
// Metadata to store with the completion.
Metadata map[string]string `json:"metadata,omitempty"`
// Configuration for a predicted output.
Prediction *Prediction `json:"prediction,omitempty"`
}

type StreamOptions struct {
Expand Down Expand Up @@ -330,6 +332,11 @@ type LogProbs struct {
Content []LogProb `json:"content"`
}

type Prediction struct {
Content string `json:"content"`
Type string `json:"type"`
}

type FinishReason string

const (
Expand Down
6 changes: 4 additions & 2 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ type Usage struct {

// CompletionTokensDetails Breakdown of tokens used in a completion.
type CompletionTokensDetails struct {
AudioTokens int `json:"audio_tokens"`
ReasoningTokens int `json:"reasoning_tokens"`
AudioTokens int `json:"audio_tokens"`
ReasoningTokens int `json:"reasoning_tokens"`
AcceptedPredictionTokens int `json:"accepted_prediction_tokens"`
RejectedPredictionTokens int `json:"rejected_prediction_tokens"`
}

// PromptTokensDetails Breakdown of tokens used in the prompt.
Expand Down
Loading