Documentation ¶
Index ¶
- Constants
- Variables
- type BaseResp
- type BotSetting
- type ChatCompletionProRequest
- type ChatCompletionProResponse
- type ChatCompletionProStream
- type ChatCompletionRequest
- type ChatCompletionResponse
- type ChatCompletionStream
- type ChatMessageChoice
- type ChatMessageProChoice
- type Client
- func (c *Client) CreateCompletion(ctx context.Context, request *ChatCompletionRequest) (*ChatCompletionResponse, error)
- func (c *Client) CreateCompletionPro(ctx context.Context, request *ChatCompletionProRequest, ...) (*ChatCompletionProResponse, error)
- func (c *Client) CreateCompletionProStream(ctx context.Context, request *ChatCompletionProRequest, ...) (*ChatCompletionProStream, error)
- func (c *Client) CreateCompletionStream(ctx context.Context, request *ChatCompletionRequest) (*ChatCompletionStream, error)
- func (c *Client) CreateEmbeddings(ctx context.Context, request *CreateEmbeddingsRequest) (*CreateEmbeddingsResponse, error)
- func (c *Client) CreateTextToSpeech(ctx context.Context, request *CreateT2ARequest) (*CreateT2AResponse, error)
- func (c *Client) CreateTextToSpeechPro(ctx context.Context, request *CreateT2ARequest) (*CreateT2AResponse, error)
- type CompletionProOption
- type Config
- type CreateEmbeddingsRequest
- type CreateEmbeddingsResponse
- type CreateT2ARequest
- type CreateT2AResponse
- type ExtraInfo
- type Function
- type FunctionCall
- type Glyph
- type Message
- type Parameters
- type ProMessage
- type ReplyConstraints
- type RoleMeta
- type TimberWeight
- type Usage
Constants ¶
View Source
const ( Abab5 = "abab5-chat" Abab5Dot5 = "abab5.5-chat" Abab5Dot5s = "abab5.5s-chat" Abab6 = "abab6-chat" Embo01 = "embo-01" Speech01 = "speech-01" Speech01Pro = "speech-01-pro" // alias speech-01=speech-01-pro ModelBot = "MM智能助理" ChatMessageRoleUser = "USER" ChatMessageRoleBot = "BOT" EmbeddingsDbType = "db" EmbeddingsQueryType = "query" )
View Source
const (
APIV1 = "https://api.minimax.chat/v1"
)
Variables ¶
View Source
var ( ErrCompletionUnsupportedModel = errors.New("this model is not supported with this method, please use CreateChatCompletion client method instead") //nolint:lll ErrCompletionStreamNotSupported = errors.New("streaming is not supported with this method, please use CreateCompletionStream") //nolint:lll ErrTooManyEmptyStreamMessages = errors.New("too many empty messages") ErrCreateTextToSpeechProNotSupported = errors.New("params is not supported, please use CreateTextToSpeechPro") )
Functions ¶
This section is empty.
Types ¶
type BotSetting ¶
type ChatCompletionProRequest ¶ added in v1.1.0
type ChatCompletionProRequest struct { Model string `json:"model"` Messages []ProMessage `json:"messages"` BotSetting []BotSetting `json:"bot_setting"` SampleMessages []Message `json:"sample_messages,omitempty"` Stream bool `json:"stream,omitempty"` TokensToGenerate int64 `json:"tokens_to_generate,omitempty"` Temperature float32 `json:"temperature,omitempty"` TopP float32 `json:"top_p,omitempty"` MaskSensitiveInfo bool `json:"mask_sensitive_info,omitempty"` Functions []*Function `json:"functions,omitempty"` FunctionCall *FunctionCall `json:"function_call,omitempty"` ReplyConstraints ReplyConstraints `json:"reply_constraints"` Plugins []string `json:"plugins"` }
type ChatCompletionProResponse ¶ added in v1.1.0
type ChatCompletionProResponse struct { ID string `json:"id"` Created int64 `json:"created"` Model string `json:"model"` Reply string `json:"reply"` Choices []ChatMessageProChoice `json:"choices"` Usage Usage `json:"usage"` InputSensitive bool `json:"input_sensitive,omitempty"` InputSensitiveType int64 `json:"input_sensitive_type,omitempty"` OutputSensitive bool `json:"output_sensitive,omitempty"` OutputSensitiveType int64 `json:"output_sensitive_type"` BaseResp BaseResp `json:"base_resp,omitempty"` }
type ChatCompletionProStream ¶ added in v1.1.0
type ChatCompletionProStream struct {
// contains filtered or unexported fields
}
type ChatCompletionRequest ¶
type ChatCompletionRequest struct { Model string `json:"model"` Messages []Message `json:"messages"` Stream bool `json:"stream,omitempty"` Prompt string `json:"prompt"` TokensToGenerate int64 `json:"tokens_to_generate,omitempty"` Temperature float32 `json:"temperature,omitempty"` TopP float32 `json:"top_p,omitempty"` UseStandardSSE bool `json:"use_standard_sse,omitempty"` BeamWidth int `json:"beam_width,omitempty"` RoleMeta *RoleMeta `json:"role_meta"` ContinueLastMessage bool `json:"continue_last_message"` SkipInfoMask bool `json:"skip_info_mask"` }
type ChatCompletionResponse ¶
type ChatCompletionResponse struct { ID string `json:"id"` Created int64 `json:"created"` Model string `json:"model"` Reply string `json:"reply"` Choices []ChatMessageChoice `json:"choices"` Usage Usage `json:"usage"` InputSensitive bool `json:"input_sensitive,omitempty"` InputSensitiveType int64 `json:"input_sensitive_type,omitempty"` OutputSensitive bool `json:"output_sensitive,omitempty"` OutputSensitiveType int64 `json:"output_sensitive_type"` BaseResp BaseResp `json:"base_resp,omitempty"` }
type ChatCompletionStream ¶
type ChatCompletionStream struct {
// contains filtered or unexported fields
}
type ChatMessageChoice ¶
type ChatMessageProChoice ¶ added in v1.1.0
type ChatMessageProChoice struct { FinishReason string `json:"finish_reason,omitempty"` Index int64 `json:"index"` Messages []ProMessage `json:"messages"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithConfig ¶
func (*Client) CreateCompletion ¶
func (c *Client) CreateCompletion(ctx context.Context, request *ChatCompletionRequest) (*ChatCompletionResponse, error)
func (*Client) CreateCompletionPro ¶ added in v1.1.0
func (c *Client) CreateCompletionPro(ctx context.Context, request *ChatCompletionProRequest, opts ...CompletionProOption) (*ChatCompletionProResponse, error)
func (*Client) CreateCompletionProStream ¶ added in v1.1.0
func (c *Client) CreateCompletionProStream(ctx context.Context, request *ChatCompletionProRequest, opts ...CompletionProOption) (*ChatCompletionProStream, error)
func (*Client) CreateCompletionStream ¶
func (c *Client) CreateCompletionStream(ctx context.Context, request *ChatCompletionRequest) (*ChatCompletionStream, error)
func (*Client) CreateEmbeddings ¶
func (c *Client) CreateEmbeddings(ctx context.Context, request *CreateEmbeddingsRequest) (*CreateEmbeddingsResponse, error)
func (*Client) CreateTextToSpeech ¶
func (c *Client) CreateTextToSpeech(ctx context.Context, request *CreateT2ARequest) (*CreateT2AResponse, error)
func (*Client) CreateTextToSpeechPro ¶
func (c *Client) CreateTextToSpeechPro(ctx context.Context, request *CreateT2ARequest) (*CreateT2AResponse, error)
type CompletionProOption ¶ added in v1.1.0
type CompletionProOption func(*ChatCompletionProRequest)
func WithBotSetting ¶
func WithBotSetting(rolePrompt string, settings ...[]BotSetting) CompletionProOption
func WithReplyConstraints ¶
func WithReplyConstraints(v ReplyConstraints) CompletionProOption
type Config ¶
type Config struct { BaseURL string HTTPClient *http.Client EmptyMessageLimit uint // contains filtered or unexported fields }
func DefaultConfig ¶
type CreateEmbeddingsRequest ¶
type CreateT2ARequest ¶
type CreateT2ARequest struct { Model string `json:"model"` Text string `json:"text"` TimberWeights []TimberWeight `json:"timber_weights,omitempty"` VoiceId string `json:"voice_id,omitempty"` Speed float32 `json:"speed,omitempty"` Vol float32 `json:"vol,omitempty"` Pitch int `json:"pitch,omitempty"` AudioSampleRate int `json:"audio_sample_rate,omitempty"` Bitrate int `json:"bitrate,omitempty"` Path string `json:"-"` Name string `json:"-"` }
type CreateT2AResponse ¶
type Function ¶
type Function struct { Name string `json:"name"` Description string `json:"description"` Parameters Parameters `json:"parameters"` }
type FunctionCall ¶
type Parameters ¶
type ProMessage ¶ added in v1.1.0
type ReplyConstraints ¶
type TimberWeight ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.