Documentation ¶
Index ¶
- type APIError
- type ChatModel
- type ChatRequest
- type ChatResponse
- type ChatResponseChoice
- type Client
- func (c *Client) Chat(ctx context.Context, chat ChatRequest) (_ ChatResponse, err error)
- func (c *Client) Image(ctx context.Context, image ImageRequest) ([][]byte, error)
- func (c *Client) Speech(ctx context.Context, speech SpeechRequest) (io.ReadCloser, error)
- func (c *Client) StreamChat(ctx context.Context, chat ChatRequest, fn func(delta string, done bool)) error
- func (c *Client) Usage(ctx context.Context) ([]Usage, error)
- type DallEParams
- type Image
- type ImageModel
- type ImageRequest
- type Message
- type Role
- type SpeechModel
- type SpeechRequest
- type StableDiffusionXLParams
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
func NewAPIError ¶
type ChatModel ¶
type ChatModel string
var ( // OpenAI ChatModelGPT3Dot5Turbo ChatModel = "gpt-3.5-turbo" ChatModelGPT3Dot5Turbo16K ChatModel = "gpt-3.5-turbo-16k" ChatModelGPT4 ChatModel = "gpt-4" ChatModelGPT432K ChatModel = "gpt-4-32k" ChatModelGPT4Turbo ChatModel = "gpt-4-1106-preview" ChatModelGPT4VisionPreview ChatModel = "gpt-4-vision-preview" // Anthropic Claude ChatModelClaudeInstant1 ChatModel = "claude-instant-v1" ChatModelClaude2 ChatModel = "claude-2.1" // Google GEMINI ChatModelGEMINIPro ChatModel = "gemini-pro" ChatModelGEMINIProVision ChatModel = "gemini-pro-vision" // 百度文心一言 ChatModelERNIEBot ChatModel = "ERNIE-Bot" ChatModelERNIEBotTurbo ChatModel = "ERNIE-Bot-Turbo" ChatModelERNIEBot4 ChatModel = "ERNIE-Bot-4" // 阿里通义千问 ChatModelQWENTurbo ChatModel = "qwen-turbo" ChatModelQWENPlus ChatModel = "qwen-plus" // 讯飞星火大模型 ChatModelSparkDeskV1 ChatModel = "SparkDesk-V1.5" ChatModelSparkDeskV2 ChatModel = "SparkDesk-V2.0" ChatModelSparkDeskV3 ChatModel = "SparkDesk-V3.0" )
type ChatRequest ¶
type ChatResponse ¶
type ChatResponseChoice ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Chat ¶
func (c *Client) Chat(ctx context.Context, chat ChatRequest) (_ ChatResponse, err error)
Chat generates a response from a list of messages.
func (*Client) Speech ¶
func (c *Client) Speech(ctx context.Context, speech SpeechRequest) (io.ReadCloser, error)
Speech generates speech from a text input. The returned io.ReadCloser is an MP3 audio stream. Caller must close it.
func (*Client) StreamChat ¶
func (c *Client) StreamChat(ctx context.Context, chat ChatRequest, fn func(delta string, done bool)) error
StreamChat generates a response from a list of messages, and streams the response.
type DallEParams ¶
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
func (*Image) MarshalJSON ¶
type ImageModel ¶
type ImageModel string
var ( ImageModelDallE2 ImageModel = "dall-e-2" ImageModelDallE3 ImageModel = "dall-e-3" ImageModelStableDiffusionXL ImageModel = "stable_diffusion_xl" )
type ImageRequest ¶
type ImageRequest struct { Width int `json:"width"` Height int `json:"height"` Num int `json:"num"` Model ImageModel `json:"model"` Prompt string `json:"prompt"` NegativePrompt string `json:"negativePrompt"` DallE DallEParams `json:"dallE,omitempty"` StableDiffusionXL StableDiffusionXLParams `json:"stable_diffusion_xl,omitempty"` }
type SpeechModel ¶
type SpeechModel string
var ( SpeechModelTTS1 SpeechModel = "tts-1" SpeechModelTTS1HD SpeechModel = "tts-1-hd" SpeechModelAzure SpeechModel = "__azure" )
type SpeechRequest ¶
type SpeechRequest struct { Input string `json:"input"` Voice string `json:"voice"` Model SpeechModel `json:"model"` }
type StableDiffusionXLParams ¶
Click to show internal directories.
Click to hide internal directories.