Documentation ¶
Index ¶
- func CheckIp(ctx context.Context, ipWhitelist, ipBlacklist []string) error
- func GetCompletionTokens(ctx context.Context, model, completion string) int
- func GetCorpCode(ctx context.Context, corpId string) string
- func GetImageQuota(model *model.Model, size string) (imageQuota mcommon.ImageQuota)
- func GetMidjourneyQuota(model *model.Model, request *ghttp.Request, path string) (mcommon.MidjourneyQuota, error)
- func GetMultimodalAudioTokens(ctx context.Context, model string, messages []sdkm.ChatCompletionMessage, ...) (textTokens, audioTokens int)
- func GetMultimodalTokens(ctx context.Context, model string, multiContent []interface{}, ...) (textTokens, imageTokens int)
- func GetPromptTokens(ctx context.Context, model string, messages []sdkm.ChatCompletionMessage) int
- func HandleMessages(messages []sdkm.ChatCompletionMessage) []sdkm.ChatCompletionMessage
- func IsAborted(err error) bool
- func IsMaxRetry(isEnableModelAgent bool, agentTotal, keyTotal, retry int) bool
- func IsNeedRetry(err error) (isRetry bool, isDisabled bool)
- func New() service.ICommon
- func NewClient(ctx context.Context, corp string, model *model.Model, ...) (sdk.Client, error)
- func NewEmbeddingClient(ctx context.Context, model *model.Model, key, baseURL, path string) (*sdk.EmbeddingClient, error)
- func NewModerationClient(ctx context.Context, model *model.Model, key, baseURL, path string) (*sdk.ModerationClient, error)
- func NewRealtimeClient(ctx context.Context, model *model.Model, key, baseURL, path string) (*sdk.RealtimeClient, error)
- type ApplicationDefaultCredentials
- type MAK
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCompletionTokens ¶ added in v0.5.0
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 GetMultimodalAudioTokens ¶ added in v0.5.0
func GetMultimodalTokens ¶ added in v0.4.0
func GetPromptTokens ¶ added in v0.5.0
func HandleMessages ¶ added in v0.4.0
func HandleMessages(messages []sdkm.ChatCompletionMessage) []sdkm.ChatCompletionMessage
func IsMaxRetry ¶ added in v0.3.0
func IsNeedRetry ¶ added in v0.3.0
func NewEmbeddingClient ¶ added in v0.4.0
func NewModerationClient ¶ added in v0.5.0
Types ¶
type ApplicationDefaultCredentials ¶ added in v0.5.0
type ApplicationDefaultCredentials struct { Type string `json:"type"` ProjectId string `json:"project_id"` PrivateKeyId string `json:"private_key_id"` PrivateKey string `json:"private_key"` ClientEmail string `json:"client_email"` ClientId string `json:"client_id"` AuthUri string `json:"auth_uri"` TokenUri string `json:"token_uri"` AuthProviderX509CertUrl string `json:"auth_provider_x509_cert_url"` ClientX509CertUrl string `json:"client_x509_cert_url"` UniverseDomain string `json:"universe_domain"` }
type MAK ¶ added in v0.5.0
type MAK struct { Corp string Model string Messages []sdkm.ChatCompletionMessage ReqModel *model.Model RealModel *model.Model ModelAgent *model.ModelAgent Key *model.Key FallbackModelAgent *model.ModelAgent FallbackModel *model.Model AgentTotal int KeyTotal int RealKey string BaseUrl string Path string }
Click to show internal directories.
Click to hide internal directories.