Documentation ¶
Index ¶
- func NewClientConfig(apiKey, ak, sk string, setters ...ConfigOption) clientConfig
- func WithCustomHeader(key, value string) requestOption
- func WithCustomHeaders(m map[string]string) requestOption
- type Client
- func (c *Client) BotChatCompletionRequestStreamDo(ctx context.Context, method, url, botId string, setters ...requestOption) (streamReader *utils.BotChatCompletionStreamReader, err error)
- func (c *Client) ChatCompletionRequestStreamDo(ctx context.Context, method, url, resourceId string, setters ...requestOption) (streamReader *utils.ChatCompletionStreamReader, err error)
- func (c *Client) CreateBotChatCompletion(ctx context.Context, request model.BotChatCompletionRequest, ...) (response model.BotChatCompletionResponse, err error)
- func (c *Client) CreateBotChatCompletionStream(ctx context.Context, request model.BotChatCompletionRequest, ...) (stream *utils.BotChatCompletionStreamReader, err error)
- func (c *Client) CreateChatCompletion(ctx context.Context, request model.ChatRequest, setters ...requestOption) (response model.ChatCompletionResponse, err error)
- func (c *Client) CreateChatCompletionStream(ctx context.Context, request model.ChatRequest, setters ...requestOption) (stream *utils.ChatCompletionStreamReader, err error)
- func (c *Client) CreateEmbeddings(ctx context.Context, conv model.EmbeddingRequestConverter, ...) (res model.EmbeddingResponse, err error)
- func (c *Client) CreateTokenization(ctx context.Context, conv model.TokenizationRequestConverter, ...) (res model.TokenizationResponse, err error)
- func (c *Client) Do(ctx context.Context, method, url, resourceType, resourceId string, ...) (err error)
- func (c *Client) GetEndpointStsToken(ctx context.Context, endpointId string) (string, error)
- func (c *Client) GetResourceStsToken(ctx context.Context, resourceType string, resourceId string) (string, error)
- type ConfigOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClientConfig ¶
func NewClientConfig(apiKey, ak, sk string, setters ...ConfigOption) clientConfig
func WithCustomHeader ¶
func WithCustomHeader(key, value string) requestOption
func WithCustomHeaders ¶ added in v1.0.152
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithAkSk ¶
func NewClientWithAkSk(ak, sk string, setters ...ConfigOption) *Client
func NewClientWithApiKey ¶
func NewClientWithApiKey(apiKey string, setters ...ConfigOption) *Client
func (*Client) BotChatCompletionRequestStreamDo ¶ added in v1.0.146
func (*Client) ChatCompletionRequestStreamDo ¶
func (*Client) CreateBotChatCompletion ¶ added in v1.0.146
func (c *Client) CreateBotChatCompletion( ctx context.Context, request model.BotChatCompletionRequest, setters ...requestOption, ) (response model.BotChatCompletionResponse, err error)
CreateBotChatCompletion — API call to Create a completion for the bot chat.
func (*Client) CreateBotChatCompletionStream ¶ added in v1.0.146
func (c *Client) CreateBotChatCompletionStream( ctx context.Context, request model.BotChatCompletionRequest, setters ...requestOption, ) (stream *utils.BotChatCompletionStreamReader, err error)
CreateBotChatCompletionStream — API call to create a chat completion w/ streaming support. It sets whether to stream back partial progress. If set, tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.
func (*Client) CreateChatCompletion ¶
func (c *Client) CreateChatCompletion( ctx context.Context, request model.ChatRequest, setters ...requestOption, ) (response model.ChatCompletionResponse, err error)
CreateChatCompletion — API call to Create a completion for the chat message.
func (*Client) CreateChatCompletionStream ¶
func (c *Client) CreateChatCompletionStream( ctx context.Context, request model.ChatRequest, setters ...requestOption, ) (stream *utils.ChatCompletionStreamReader, err error)
CreateChatCompletionStream — API call to create a chat completion w/ streaming support. It sets whether to stream back partial progress. If set, tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.
func (*Client) CreateEmbeddings ¶
func (c *Client) CreateEmbeddings( ctx context.Context, conv model.EmbeddingRequestConverter, setters ...requestOption, ) (res model.EmbeddingResponse, err error)
CreateEmbeddings returns an EmbeddingResponse which will contain an Embedding for every item in |body.Input|.
Body should be of type EmbeddingRequestStrings for embedding strings or EmbeddingRequestTokens for embedding groups of text already converted to tokens.
func (*Client) CreateTokenization ¶ added in v1.0.151
func (c *Client) CreateTokenization( ctx context.Context, conv model.TokenizationRequestConverter, setters ...requestOption, ) (res model.TokenizationResponse, err error)
func (*Client) GetEndpointStsToken ¶
type ConfigOption ¶ added in v1.0.161
type ConfigOption func(*clientConfig)
func WithBaseUrl ¶
func WithBaseUrl(url string) ConfigOption
func WithHTTPClient ¶ added in v1.0.151
func WithHTTPClient(client *http.Client) ConfigOption
func WithRegion ¶
func WithRegion(region string) ConfigOption
func WithRetryTimes ¶
func WithRetryTimes(retryTimes int) ConfigOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ConfigOption