common

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCorpCode added in v0.3.0

func GetCorpCode(ctx context.Context, corpId string) string

func GetImageQuota added in v0.4.0

func GetImageQuota(model *model.Model, size string) (imageQuota mcommon.ImageQuota)

func GetMidjourneyQuota added in v0.4.0

func GetMidjourneyQuota(model *model.Model, request *ghttp.Request, path string) (mcommon.MidjourneyQuota, error)

func GetMultimodalTokens added in v0.4.0

func GetMultimodalTokens(ctx context.Context, model string, multiContent []interface{}, reqModel *model.Model) (textTokens, imageTokens int)

func HandleMessages added in v0.4.0

func HandleMessages(messages []sdkm.ChatCompletionMessage) []sdkm.ChatCompletionMessage

func IsAborted added in v0.3.0

func IsAborted(err error) bool

func IsMaxRetry added in v0.3.0

func IsMaxRetry(isEnableModelAgent bool, agentTotal, keyTotal, retry int) bool

func IsNeedRetry added in v0.3.0

func IsNeedRetry(err error) (isRetry bool, isDisabled bool)

func New

func New() service.ICommon

func NewClient added in v0.3.0

func NewClient(ctx context.Context, model *model.Model, key, baseURL, path string) (sdk.Chat, error)

func NewEmbeddingClient added in v0.4.0

func NewEmbeddingClient(ctx context.Context, model *model.Model, key, baseURL, path string) (*sdk.EmbeddingClient, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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