arkruntime

package
v1.0.140 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 18 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 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) ChatCompletionRequestStreamDo

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

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) Do

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

func (*Client) GetEndpointStsToken

func (c *Client) GetEndpointStsToken(ctx context.Context, endpointId 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

Jump to

Keyboard shortcuts

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