Documentation
¶
Index ¶
- Constants
- type Audio
- type Document
- type Error
- type ErrorWithStatusCode
- type Function
- type GeneralOpenAIRequest
- type ImageRequest
- type ImageURL
- type JSONSchema
- type Message
- type MessageContent
- type ParsePdfListResponse
- type ParsePdfResponse
- type RerankMeta
- type RerankMetaTokens
- type RerankRequest
- type RerankResponse
- type RerankResult
- type ResponseFormat
- type StreamOptions
- type TextToSpeechRequest
- type Tool
- type Usage
Constants ¶
View Source
const ( ContentTypeText = "text" ContentTypeImageURL = "image_url" ContentTypeInputAudio = "input_audio" )
View Source
const ( StopFinishReason = "stop" StreamObject = "chat.completion.chunk" NonStreamObject = "chat.completion" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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"`
ParallelTooCalls *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 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 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"`
Result []*RerankResult `json:"result"`
}
type RerankResult ¶
type ResponseFormat ¶
type ResponseFormat struct {
JSONSchema *JSONSchema `json:"json_schema,omitempty"`
Type string `json:"type,omitempty"`
}
type StreamOptions ¶
type StreamOptions struct {
IncludeUsage bool `json:"include_usage,omitempty"`
}
type TextToSpeechRequest ¶
Click to show internal directories.
Click to hide internal directories.