arkruntime

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

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

func WithCustomHeaders(m map[string]string) requestOption

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, resourceId string, setters ...requestOption) (streamReader *utils.ChatCompletionStreamReader, err error)

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

func (c *Client) CreateContext(
	goCtx context.Context,
	request model.CreateContextRequest,
	setters ...requestOption,
) (response model.CreateContextResponse, err error)

CreateContext — API call to Create a new context cache instance.

func (*Client) CreateContextChatCompletion

func (c *Client) CreateContextChatCompletion(
	ctx context.Context,
	request model.ContextChatCompletionRequest,
	setters ...requestOption,
) (response model.ChatCompletionResponse, err error)

CreateContextChatCompletion — API call to Create a completion for chat with context cache.

func (*Client) CreateContextChatCompletionStream

func (c *Client) CreateContextChatCompletionStream(
	ctx context.Context,
	request model.ContextChatCompletionRequest,
	setters ...requestOption,
) (stream *utils.ChatCompletionStreamReader, err error)

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

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

func (*Client) DoBatch

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

func (*Client) GetEndpointStsToken

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

func (*Client) GetResourceStsToken

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

type ConfigOption

type ConfigOption func(*clientConfig)

func WithBaseUrl

func WithBaseUrl(url string) ConfigOption

func WithHTTPClient

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

Directories

Path Synopsis
example
completion command
context command

Jump to

Keyboard shortcuts

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