Documentation
¶
Index ¶
- Constants
- type ChatChoice
- type ChatMessage
- type ChatRequest
- type ChatResponse
- type Config
- type DoubaoChat
- type DoubaoChatChoice
- type DoubaoChatFunction
- type DoubaoChatLogprobs
- type DoubaoChatMessage
- type DoubaoChatPromptTokensDetails
- type DoubaoChatResponse
- type DoubaoChatTokenLogprob
- type DoubaoChatToolCall
- type DoubaoChatTopLogprob
- type DoubaoChatUsage
- type Gpt
Constants ¶
View Source
const ( DefaultChatStream = false DefaultChatMaxTokens = 4096 DefaultChatFrequencyPenalty = 0 DefaultChatPresencePenalty = 0 DefaultChatTemperature = 1 DefaultChatTopP = 0.7 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatChoice ¶ added in v0.12.0
type ChatChoice struct {
Message ChatMessage `json:"message"`
}
type ChatMessage ¶ added in v0.12.0
type ChatRequest ¶ added in v0.13.0
type ChatRequest struct {
Model string `json:"model"`
Messages []ChatMessage `json:"messages"`
Stream bool `json:"stream"`
MaxTokens int64 `json:"max_tokens"`
FrequencyPenalty float64 `json:"frequency_penalty"`
PresencePenalty float64 `json:"presence_penalty"`
Temperature float64 `json:"temperature"`
TopP float64 `json:"top_p"`
}
type ChatResponse ¶ added in v0.12.0
type ChatResponse struct {
Id string `json:"id"`
Choices []ChatChoice `json:"choices"`
}
type Config ¶
func DefaultConfig ¶
func DefaultConfig() *Config
type DoubaoChat ¶ added in v0.12.0
func (*DoubaoChat) Chat ¶ added in v0.13.0
func (c *DoubaoChat) Chat(_ context.Context, request *ChatRequest) (ChatResponse, error)
type DoubaoChatChoice ¶ added in v0.13.0
type DoubaoChatChoice struct {
Index int `json:"index"`
FinishReason string `json:"finish_reason"`
Message DoubaoChatMessage `json:"message"`
Logprobs DoubaoChatLogprobs `json:"logprobs"`
}
type DoubaoChatFunction ¶ added in v0.13.0
type DoubaoChatLogprobs ¶ added in v0.13.0
type DoubaoChatLogprobs struct {
Content []DoubaoChatTokenLogprob `json:"content"`
}
type DoubaoChatMessage ¶ added in v0.13.0
type DoubaoChatMessage struct {
Role string `json:"role"`
Content string `json:"content"`
ToolCalls []DoubaoChatToolCall `json:"tool_calls"`
}
type DoubaoChatPromptTokensDetails ¶ added in v0.13.0
type DoubaoChatPromptTokensDetails struct {
CachedTokens int `json:"cached_tokens"`
}
type DoubaoChatResponse ¶ added in v0.13.0
type DoubaoChatResponse struct {
Id string `json:"id"`
Model string `json:"model"`
Created int64 `json:"created"`
Object string `json:"object"`
Choices []DoubaoChatChoice `json:"choices"`
Usage DoubaoChatUsage `json:"usage"`
}
type DoubaoChatTokenLogprob ¶ added in v0.13.0
type DoubaoChatTokenLogprob struct {
Token string `json:"token"`
Bytes []int `json:"bytes"`
Logprob float64 `json:"logprob"`
TopLogprobs []DoubaoChatTopLogprob `json:"top_logprobs"`
}
type DoubaoChatToolCall ¶ added in v0.13.0
type DoubaoChatToolCall struct {
Id string `json:"id"`
Type string `json:"type"`
Function DoubaoChatFunction `json:"function"`
}
type DoubaoChatTopLogprob ¶ added in v0.13.0
type DoubaoChatUsage ¶ added in v0.13.0
type DoubaoChatUsage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
PromptTokensDetails DoubaoChatPromptTokensDetails `json:"prompt_tokens_details"`
}
Click to show internal directories.
Click to hide internal directories.