Documentation ¶
Index ¶
- type ChatCompletion
- type ChatCompletionChoice
- type ChatCompletionMessage
- type ChatCompletionRequest
- type ChatCompletionResponseFormat
- type Embedding
- type EmbeddingList
- type EmbeddingsRequest
- type Error
- type ErrorResponse
- type FinishReason
- type Function
- type FunctionCall
- type MessageContent
- type MessageContentURL
- type MessageRole
- type Model
- type ModelList
- type ResponseFormat
- type Server
- type SpeechRequest
- type Tool
- type ToolCall
- type ToolType
- type Transcription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatCompletion ¶
type ChatCompletion struct { Object string `json:"object"` // "chat.completion" | "chat.completion.chunk" ID string `json:"id"` Model string `json:"model"` Created int64 `json:"created"` Choices []ChatCompletionChoice `json:"choices"` }
type ChatCompletionChoice ¶
type ChatCompletionChoice struct { Index int `json:"index"` Delta *ChatCompletionMessage `json:"delta,omitempty"` Message *ChatCompletionMessage `json:"message,omitempty"` FinishReason *FinishReason `json:"finish_reason"` }
type ChatCompletionMessage ¶
type ChatCompletionMessage struct { Role MessageRole `json:"role,omitempty"` Content string `json:"content"` Contents []MessageContent `json:"-"` ToolCalls []ToolCall `json:"tool_calls,omitempty"` ToolCallID string `json:"tool_call_id,omitempty"` }
https://platform.openai.com/docs/api-reference/chat/object
func (*ChatCompletionMessage) MarshalJSON ¶
func (m *ChatCompletionMessage) MarshalJSON() ([]byte, error)
func (*ChatCompletionMessage) UnmarshalJSON ¶
func (m *ChatCompletionMessage) UnmarshalJSON(data []byte) error
type ChatCompletionRequest ¶
type ChatCompletionRequest struct { Model string `json:"model"` Messages []ChatCompletionMessage `json:"messages"` Stream bool `json:"stream,omitempty"` Stop any `json:"stop,omitempty"` Tools []Tool `json:"tools,omitempty"` MaxTokens *int `json:"max_tokens,omitempty"` Temperature *float32 `json:"temperature,omitempty"` ResponseFormat *ChatCompletionResponseFormat `json:"response_format,omitempty"` }
type ChatCompletionResponseFormat ¶
type ChatCompletionResponseFormat struct {
Type ResponseFormat `json:"type"`
}
type Embedding ¶
type Embedding struct { Object string `json:"object"` // "embedding" Index int `json:"index"` Embedding []float32 `json:"embedding"` }
https://platform.openai.com/docs/api-reference/embeddings/object
type EmbeddingList ¶
type EmbeddingList struct { Object string `json:"object"` // "list" Model string `json:"model"` Data []Embedding `json:"data"` }
https://platform.openai.com/docs/api-reference/embeddings/create
type ErrorResponse ¶
type ErrorResponse struct {
Error Error `json:"error,omitempty"`
}
type FinishReason ¶
type FinishReason string
// https://platform.openai.com/docs/api-reference/chat/object
var ( FinishReasonStop FinishReason = "stop" FinishReasonLength FinishReason = "length" FinishReasonToolCalls FinishReason = "tool_calls" FinishReasonContentFilter FinishReason = "content_filter" )
type FunctionCall ¶
type MessageContent ¶
type MessageContent struct { Type string `json:"type,omitempty"` Text string `json:"text,omitempty"` ImageURL *MessageContentURL `json:"image_url,omitempty"` }
type MessageContentURL ¶
type MessageContentURL struct {
URL string `json:"url"`
}
type MessageRole ¶
type MessageRole string
var ( MessageRoleSystem MessageRole = "system" MessageRoleUser MessageRole = "user" MessageRoleAssistant MessageRole = "assistant" MessageRoleTool MessageRole = "tool" )
type Model ¶
type Model struct { Object string `json:"object"` // "model" ID string `json:"id"` Created int64 `json:"created"` OwnedBy string `json:"owned_by"` }
https://platform.openai.com/docs/api-reference/models/object
type ResponseFormat ¶
type ResponseFormat string
var ( ResponseFormatText ResponseFormat = "text" ResponseFormatJSON ResponseFormat = "json_object" )
type SpeechRequest ¶
type SpeechRequest struct { Model string `json:"model"` Input string `json:"input"` Voice string `json:"voice"` }
https://platform.openai.com/docs/api-reference/audio/createSpeech
type ToolCall ¶
type ToolCall struct { ID string `json:"id"` Type ToolType `json:"type"` Function *FunctionCall `json:"function,omitempty"` }
type ToolType ¶
type ToolType string
https://platform.openai.com/docs/api-reference/chat/object
var (
ToolTypeFunction ToolType = "function"
)
Click to show internal directories.
Click to hide internal directories.