arkruntime

package
v1.0.154 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 16 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithBaseUrl

func WithBaseUrl(url string) configOption

func WithCustomHeader

func WithCustomHeader(key, value string) requestOption

func WithCustomHeaders added in v1.0.152

func WithCustomHeaders(m map[string]string) requestOption

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

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 (c *Client) BotChatCompletionRequestStreamDo(ctx context.Context, method, url, botId string, setters ...requestOption) (streamReader *utils.BotChatCompletionStreamReader, err error)

func (*Client) ChatCompletionRequestStreamDo

func (c *Client) ChatCompletionRequestStreamDo(ctx context.Context, method, url, resourceId string, setters ...requestOption) (streamReader *utils.ChatCompletionStreamReader, err error)

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.ChatCompletionRequest,
	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.ChatCompletionRequest,
	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) Do

func (c *Client) Do(ctx context.Context, method, url, resourceType, resourceId string, v model.Response, setters ...requestOption) (err error)

func (*Client) GetEndpointStsToken

func (c *Client) GetEndpointStsToken(ctx context.Context, endpointId string) (string, error)

func (*Client) GetResourceStsToken added in v1.0.146

func (c *Client) GetResourceStsToken(ctx context.Context, resourceType string, resourceId string) (string, error)

type ClientConfig

type ClientConfig struct {
	BaseURL            string
	HTTPClient         *http.Client
	EmptyMessagesLimit uint
	RetryTimes         int
	// contains filtered or unexported fields
}

ClientConfig is a configuration of a client.

func NewClientConfig

func NewClientConfig(apiKey, ak, sk string, setters ...configOption) ClientConfig

Directories

Path Synopsis
example
bot

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL