arkruntime

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 19 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) CreateBatchChatCompletion added in v1.0.12

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

CreateBatchChatCompletion — API call to Create a batch completion for the chat 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) CreateContentGenerationTask added in v1.0.18

func (c *Client) CreateContentGenerationTask(
	ctx context.Context,
	request model.CreateContentGenerationTaskRequest,
	setters ...requestOption,
) (response model.CreateContentGenerationTaskResponse, err error)

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) DeleteContentGenerationTask added in v1.0.18

func (c *Client) DeleteContentGenerationTask(
	ctx context.Context,
	request model.DeleteContentGenerationTaskRequest,
	setters ...requestOption,
) (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) DoBatch

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

func (*Client) GenerateImages added in v1.0.18

func (c *Client) GenerateImages(
	ctx context.Context,
	request model.GenerateImagesRequest,
	setters ...requestOption,
) (response model.ImagesResponse, err error)

func (*Client) GetContentGenerationTask added in v1.0.18

func (c *Client) GetContentGenerationTask(
	ctx context.Context,
	request model.GetContentGenerationTaskRequest,
	setters ...requestOption,
) (response model.GetContentGenerationTaskResponse, err 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)

func (*Client) ListContentGenerationTasks added in v1.0.18

func (c *Client) ListContentGenerationTasks(
	ctx context.Context,
	request model.ListContentGenerationTasksRequest,
	setters ...requestOption,
) (response model.ListContentGenerationTasksResponse, err error)

type ConfigOption

type ConfigOption func(*clientConfig)

func WithBaseUrl

func WithBaseUrl(url string) ConfigOption

func WithBatchMaxParallel added in v1.0.12

func WithBatchMaxParallel(maxParallel int) ConfigOption

WithBatchMaxParallel sets the max parallel for batch requests.

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
batch command
completion command
context command
images command

Jump to

Keyboard shortcuts

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