Documentation
¶
Index ¶
- Variables
- func Client(key string) *http.Client
- type Assistant
- type ChatCompletion
- type ChatCompletionChunk
- type ChatCompletionRequest
- type Choice
- type ChoiceChunk
- type Error
- type ErrorCode
- type FinishReason
- type Function
- type FunctionCall
- type LoggedProbability
- type Message
- type Model
- type PromptTokensDetails
- type ResponseFormat
- type Role
- type StreamedChatCompletionRequest
- type System
- type Token
- type TokenProbability
- type Tool
- type ToolCallID
- type ToolChoice
- type ToolOutput
- type Usage
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorCodes = xyz.AccessorFor(ErrorCode.Values)
View Source
var FinishReasons = xyz.AccessorFor(FinishReason.Values)
View Source
var Messages = xyz.AccessorFor(Message.Values)
View Source
var ResponseFormats = xyz.AccessorFor(ResponseFormat.Values)
View Source
var Roles = xyz.AccessorFor(Role.Values)
View Source
var ToolChoices = xyz.AccessorFor(ToolChoice.Values)
View Source
var Tools = xyz.AccessorFor(Tool.Values)
Functions ¶
Types ¶
type ChatCompletion ¶
type ChatCompletion struct {
ID string `json:"id"
is a unique identifier for the chat completion.`
Object isChatCompletion `json:"object"`
Created unix.Seconds `json:"created"
time when the chat completion was created.`
Model Model `json:"model"
used for the chat completion.`
Choices []Choice `json:"choices"
list of chat completion choices. Can be more than one if n is greater than 1.`
Usage Usage `json:"usage"
statistics for the completion request.`
SystemFingerprint string `json:"system_fingerprint,omitempty"
represents the backend configuration that the model runs with.`
}
type ChatCompletionChunk ¶
type ChatCompletionChunk struct {
ID string `json:"id"
is a unique identifier for the chat completion.`
Object isChatCompletionChunk `json:"object"`
Created unix.Seconds `json:"created"
time when the chat completion was created.`
Model Model `json:"model"
used for the chat completion.`
Choices []ChoiceChunk `json:"choices"
list of chat completion choices. Can be more than one if n is greater than 1.`
}
type ChatCompletionRequest ¶
type ChatCompletionRequest struct {
Messages []Message `json:"messages"
comprising the conversation so far.`
Model Model `json:"model"
model to use.`
FrequencyPenalty float64 `` /* 227-byte string literal not displayed */
MaxTokens uint `` /* 166-byte string literal not displayed */
PresencePenalty float64 `` /* 213-byte string literal not displayed */
ResponseFormat ResponseFormat `json:"response_format,omitzero"
An object specifying the format that the model must output.`
Stop []string `json:"stop,omitempty"
up to 4 sequences where the API will stop generating further tokens.`
Temperature *float64 `` /* 250-byte string literal not displayed */
TopP *float64 `` /* 333-byte string literal not displayed */
Tools []Tool `json:"tools,omitempty"
the model may call.`
ToolChoice ToolChoice `json:"tool_choice,omitzero"
controls which (if any) tool is called by the model.`
LogProbs bool `` /* 190-byte string literal not displayed */
TopLogProbs uint `` /* 238-byte string literal not displayed */
}
type Choice ¶
type Choice struct {
Index int `json:"index"
of the choice in the list of choices.`
Message Message `json:"message"
generated by the model.`
LoggedProbabilities []LoggedProbability `json:"logprobs,omitempty"
of the generated tokens.`
FinishReason FinishReason `json:"finish_reason"
why the model stopped generating tokens.`
}
type ChoiceChunk ¶
type ChoiceChunk struct {
Index int `json:"index"
of the choice in the list of choices.`
Delta Message `json:"delta"
generated by streamed model responses.`
FinishReason FinishReason `json:"finish_reason"
why the model stopped generating tokens.`
}
type FinishReason ¶
type FinishReason xyz.Switch[string, struct { Stop FinishReason `json:"stop" the model hit a natural stop point or a provided stop sequence.` Length FinishReason `json:"length" the maximum number of tokens specified in the request was reached` ContentFilter FinishReason `json:"content_filter" the model's content filter stopped the model from generating more tokens.` ToolCalls FinishReason `json:"tool_calls" the model's tool calls stopped the model from generating more tokens.` }]
type Function ¶
type Function struct {
Name string `json:"name"
of the function to call.`
Description string `json:"description,omitempty"
of what the function does, used by the model to choose when and how to call the function.`
Arguments string `json:"arguments,omitempty"
(for function calls) to call the function with.`
}
type FunctionCall ¶
type FunctionCall struct {
ID ToolCallID `json:"id"`
Function Function `json:"function"`
}
type LoggedProbability ¶
type LoggedProbability struct {
Content []TokenProbability `json:"content"`
Refusal []TokenProbability `json:"refusal,omitempty"`
}
type PromptTokensDetails ¶
type ResponseFormat ¶
type ResponseFormat xyz.Tagged[any, struct { JSON ResponseFormat `json:"?type=json_object"` }]
type StreamedChatCompletionRequest ¶
type StreamedChatCompletionRequest struct {
ChatCompletionRequest
Stream isTrue `json:"stream"`
}
type TokenProbability ¶
type TokenProbability struct {
Bytes []rune `json:"bytes"`
Probability float64 `json:"probability"`
Token string `json:"token"`
TopProbabilities []TokenProbability `json:"top_logprobs,omitempty"`
}
type ToolCallID ¶
type ToolCallID string
type ToolChoice ¶
type ToolChoice xyz.Tagged[any, struct { None ToolChoice `json:"none"` Auto ToolChoice `json:"auto"` Required ToolChoice `json:"required"` Specific xyz.Case[ToolChoice, Function] `json:"function?type=function"` }]
type ToolOutput ¶
type ToolOutput struct {
ToolCallID ToolCallID `json:"tool_call_id,omitempty"
identifies the tool call.`
Content string `json:"content"
of the message.`
}
type Usage ¶
type Usage struct {
PromptTokens int `json:"prompt_tokens"
is the number of tokens in the prompt.`
CompletionTokens int `json:"completion_tokens"
is the number of tokens in the generated completion.`
TotalTokens int `json:"total_tokens"
is the total number of tokens used in the request (prompt + completion).`
PromptTokensDetails PromptTokensDetails `json:"prompt_tokens_details"`
}
Click to show internal directories.
Click to hide internal directories.