Add Prediction field (#970)
* Add Prediction field to ChatCompletionRequest * Include prediction tokens in response
This commit is contained in:
7
chat.go
7
chat.go
@@ -273,6 +273,8 @@ type ChatCompletionRequest struct {
|
|||||||
ReasoningEffort string `json:"reasoning_effort,omitempty"`
|
ReasoningEffort string `json:"reasoning_effort,omitempty"`
|
||||||
// Metadata to store with the completion.
|
// Metadata to store with the completion.
|
||||||
Metadata map[string]string `json:"metadata,omitempty"`
|
Metadata map[string]string `json:"metadata,omitempty"`
|
||||||
|
// Configuration for a predicted output.
|
||||||
|
Prediction *Prediction `json:"prediction,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type StreamOptions struct {
|
type StreamOptions struct {
|
||||||
@@ -340,6 +342,11 @@ type LogProbs struct {
|
|||||||
Content []LogProb `json:"content"`
|
Content []LogProb `json:"content"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Prediction struct {
|
||||||
|
Content string `json:"content"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
}
|
||||||
|
|
||||||
type FinishReason string
|
type FinishReason string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ type Usage struct {
|
|||||||
type CompletionTokensDetails struct {
|
type CompletionTokensDetails struct {
|
||||||
AudioTokens int `json:"audio_tokens"`
|
AudioTokens int `json:"audio_tokens"`
|
||||||
ReasoningTokens int `json:"reasoning_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.
|
// PromptTokensDetails Breakdown of tokens used in the prompt.
|
||||||
|
|||||||
Reference in New Issue
Block a user