Add Prediction field (#970)

* Add Prediction field to ChatCompletionRequest

* Include prediction tokens in response
This commit is contained in:
Daniel Peng
2025-04-29 06:38:27 -07:00
committed by GitHub
parent 6836cf6a6f
commit 93a611cf4f
2 changed files with 11 additions and 2 deletions

View File

@@ -273,6 +273,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 {
@@ -340,6 +342,11 @@ type LogProbs struct {
Content []LogProb `json:"content"`
}
type Prediction struct {
Content string `json:"content"`
Type string `json:"type"`
}
type FinishReason string
const (

View File

@@ -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.