Documentation
¶
Index ¶
- Constants
- type Audio
- type ChatCompletionsStreamResponse
- type ChatCompletionsStreamResponseChoice
- type Document
- type EmbeddingRequest
- type EmbeddingResponse
- type EmbeddingResponseItem
- type Error
- type ErrorWithStatusCode
- type Function
- type GeneralOpenAIRequest
- type ImageData
- type ImageRequest
- type ImageResponse
- type ImageURL
- type JSONSchema
- type Message
- type MessageContent
- type ParsePdfListResponse
- type ParsePdfResponse
- type PromptTokensDetails
- type RerankMeta
- type RerankMetaTokens
- type RerankRequest
- type RerankResponse
- type RerankResult
- type ResponseFormat
- type Segment
- type SlimRerankResponse
- type StreamOptions
- type SttJSONResponse
- type SttVerboseJSONResponse
- type TextResponse
- type TextResponseChoice
- type TextToSpeechRequest
- type Tool
- type Usage
Constants ¶
View Source
const ( ContentTypeText = "text" ContentTypeImageURL = "image_url" ContentTypeInputAudio = "input_audio" )
View Source
const ( StopFinishReason = "stop" ChatCompletionChunk = "chat.completion.chunk" ChatCompletion = "chat.completion" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatCompletionsStreamResponse ¶ added in v0.1.5
type ChatCompletionsStreamResponseChoice ¶ added in v0.1.5
type EmbeddingRequest ¶ added in v0.1.5
type EmbeddingResponse ¶ added in v0.1.5
type EmbeddingResponse struct { Object string `json:"object"` Model string `json:"model"` Data []*EmbeddingResponseItem `json:"data"` Usage `json:"usage"` }
type EmbeddingResponseItem ¶ added in v0.1.5
type Error ¶
type Error struct { Code any `json:"code,omitempty"` Message string `json:"message,omitempty"` Type string `json:"type,omitempty"` Param string `json:"param,omitempty"` }
func (*Error) JSONOrEmpty ¶
type ErrorWithStatusCode ¶
func (*ErrorWithStatusCode) JSONOrEmpty ¶
func (e *ErrorWithStatusCode) JSONOrEmpty() string
type GeneralOpenAIRequest ¶
type GeneralOpenAIRequest struct { Prediction any `json:"prediction,omitempty"` Prompt any `json:"prompt,omitempty"` Input any `json:"input,omitempty"` Metadata any `json:"metadata,omitempty"` Functions any `json:"functions,omitempty"` LogitBias any `json:"logit_bias,omitempty"` FunctionCall any `json:"function_call,omitempty"` ToolChoice any `json:"tool_choice,omitempty"` Stop any `json:"stop,omitempty"` MaxCompletionTokens *int `json:"max_completion_tokens,omitempty"` TopLogprobs *int `json:"top_logprobs,omitempty"` Style *string `json:"style,omitempty"` Quality *string `json:"quality,omitempty"` Audio *Audio `json:"audio,omitempty"` PresencePenalty *float64 `json:"presence_penalty,omitempty"` ResponseFormat *ResponseFormat `json:"response_format,omitempty"` Store *bool `json:"store,omitempty"` ServiceTier *string `json:"service_tier,omitempty"` FrequencyPenalty *float64 `json:"frequency_penalty,omitempty"` Logprobs *bool `json:"logprobs,omitempty"` StreamOptions *StreamOptions `json:"stream_options,omitempty"` Temperature *float64 `json:"temperature,omitempty"` TopP *float64 `json:"top_p,omitempty"` ParallelToolCalls *bool `json:"parallel_tool_calls,omitempty"` EncodingFormat string `json:"encoding_format,omitempty"` Model string `json:"model,omitempty"` Instruction string `json:"instruction,omitempty"` User string `json:"user,omitempty"` Size string `json:"size,omitempty"` Modalities []string `json:"modalities,omitempty"` Messages []*Message `json:"messages,omitempty"` Tools []*Tool `json:"tools,omitempty"` N int `json:"n,omitempty"` Dimensions int `json:"dimensions,omitempty"` Seed float64 `json:"seed,omitempty"` MaxTokens int `json:"max_tokens,omitempty"` TopK int `json:"top_k,omitempty"` NumCtx int `json:"num_ctx,omitempty"` Stream bool `json:"stream,omitempty"` }
func (GeneralOpenAIRequest) ParseInput ¶
func (r GeneralOpenAIRequest) ParseInput() []string
type ImageRequest ¶
type ImageRequest struct { Model string `json:"model"` Prompt string `json:"prompt"` Size string `json:"size,omitempty"` Quality string `json:"quality,omitempty"` ResponseFormat string `json:"response_format,omitempty"` Style string `json:"style,omitempty"` User string `json:"user,omitempty"` N int `json:"n,omitempty"` }
type ImageResponse ¶ added in v0.1.5
type JSONSchema ¶
type Message ¶
type Message struct { Content any `json:"content,omitempty"` ReasoningContent string `json:"reasoning_content,omitempty"` Name *string `json:"name,omitempty"` Role string `json:"role,omitempty"` ToolCallID string `json:"tool_call_id,omitempty"` ToolCalls []*Tool `json:"tool_calls,omitempty"` }
func (*Message) IsStringContent ¶
func (*Message) ParseContent ¶
func (m *Message) ParseContent() []MessageContent
func (*Message) StringContent ¶
func (*Message) ToStringContentMessage ¶
func (m *Message) ToStringContentMessage()
type MessageContent ¶
type ParsePdfListResponse ¶
type ParsePdfListResponse struct {
Markdowns []string `json:"markdowns"`
}
type ParsePdfResponse ¶
type PromptTokensDetails ¶ added in v0.1.4
type PromptTokensDetails struct { CachedTokens int64 `json:"cached_tokens"` CacheCreationTokens int64 `json:"cache_creation_tokens,omitempty"` }
func (*PromptTokensDetails) Add ¶ added in v0.1.5
func (d *PromptTokensDetails) Add(other *PromptTokensDetails)
type RerankMeta ¶
type RerankMeta struct { Tokens *RerankMetaTokens `json:"tokens,omitempty"` Model string `json:"model,omitempty"` }
type RerankMetaTokens ¶
type RerankRequest ¶
type RerankRequest struct { TopN *int `json:"top_n,omitempty"` MaxChunksPerDoc *int `json:"max_chunks_per_doc,omitempty"` ReturnDocuments *bool `json:"return_documents,omitempty"` OverlapTokens *int `json:"overlap_tokens,omitempty"` Model string `json:"model"` Query string `json:"query"` Documents []string `json:"documents"` }
type RerankResponse ¶
type RerankResponse struct { Meta RerankMeta `json:"meta"` ID string `json:"id"` Results []*RerankResult `json:"results"` }
type RerankResult ¶
type ResponseFormat ¶
type ResponseFormat struct { JSONSchema *JSONSchema `json:"json_schema,omitempty"` Type string `json:"type,omitempty"` }
type Segment ¶ added in v0.1.5
type Segment struct { Text string `json:"text"` Tokens []int `json:"tokens"` ID int `json:"id"` Seek int `json:"seek"` Start float64 `json:"start"` End float64 `json:"end"` Temperature float64 `json:"temperature"` AvgLogprob float64 `json:"avg_logprob"` CompressionRatio float64 `json:"compression_ratio"` NoSpeechProb float64 `json:"no_speech_prob"` }
type SlimRerankResponse ¶ added in v0.1.5
type SlimRerankResponse struct {
Meta RerankMeta `json:"meta"`
}
type StreamOptions ¶
type StreamOptions struct {
IncludeUsage bool `json:"include_usage,omitempty"`
}
type SttJSONResponse ¶ added in v0.1.5
type SttJSONResponse struct {
Text string `json:"text,omitempty"`
}
type SttVerboseJSONResponse ¶ added in v0.1.5
type TextResponse ¶ added in v0.1.5
type TextResponseChoice ¶ added in v0.1.5
type TextToSpeechRequest ¶
type Usage ¶
type Usage struct { PromptTokens int64 `json:"prompt_tokens"` CompletionTokens int64 `json:"completion_tokens"` TotalTokens int64 `json:"total_tokens"` WebSearchCount int64 `json:"web_search_count,omitempty"` PromptTokensDetails *PromptTokensDetails `json:"prompt_tokens_details,omitempty"` }
func (*Usage) ToModelUsage ¶ added in v0.1.7
Click to show internal directories.
Click to hide internal directories.