Documentation
¶
Index ¶
- func CheckIp(ctx context.Context, ipWhitelist, ipBlacklist []string) error
- func ConvChatCompletionsToResponsesRequest(request *ghttp.Request) sdkm.OpenAIResponsesReq
- func ConvResponsesStreamToChatCompletionsResponse(ctx context.Context, res sdkm.OpenAIResponsesStreamRes) sdkm.ChatCompletionResponse
- func ConvResponsesToChatCompletionsRequest(request *ghttp.Request, isChatCompletions bool) sdkm.ChatCompletionRequest
- func ConvResponsesToChatCompletionsResponse(ctx context.Context, res sdkm.OpenAIResponsesRes) sdkm.ChatCompletionResponse
- func GetCompletionTokens(ctx context.Context, model, completion string) int
- func GetCorpCode(ctx context.Context, corpId string) string
- func GetImageGenerationQuota(model *model.Model, quality, size string) (generationQuota mcommon.GenerationQuota)
- 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 GetMultimodalSearchTokens(ctx context.Context, webSearchOptions any, reqModel *model.Model) (searchTokens 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 NewAnthropicClient(ctx context.Context, model *model.Model, key, baseURL, path string) (*anthropic.Client, error)
- func NewClient(ctx context.Context, corp string, model *model.Model, ...) (sdk.Client, error)
- func NewGoogleClient(ctx context.Context, model *model.Model, key, baseURL, path string) (*google.Client, error)
- func NewOpenAIClient(ctx context.Context, model *model.Model, key, baseURL, path string) (*openai.Client, 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 ConvChatCompletionsToResponsesRequest ¶ added in v1.5.0
func ConvChatCompletionsToResponsesRequest(request *ghttp.Request) sdkm.OpenAIResponsesReq
func ConvResponsesStreamToChatCompletionsResponse ¶ added in v1.5.0
func ConvResponsesStreamToChatCompletionsResponse(ctx context.Context, res sdkm.OpenAIResponsesStreamRes) sdkm.ChatCompletionResponse
func ConvResponsesToChatCompletionsRequest ¶ added in v1.5.0
func ConvResponsesToChatCompletionsRequest(request *ghttp.Request, isChatCompletions bool) sdkm.ChatCompletionRequest
func ConvResponsesToChatCompletionsResponse ¶ added in v1.5.0
func ConvResponsesToChatCompletionsResponse(ctx context.Context, res sdkm.OpenAIResponsesRes) sdkm.ChatCompletionResponse
func GetCompletionTokens ¶ added in v0.5.0
func GetImageGenerationQuota ¶ added in v1.5.0
func GetImageGenerationQuota(model *model.Model, quality, size string) (generationQuota mcommon.GenerationQuota)
func GetMidjourneyQuota ¶ added in v0.4.0
func GetMultimodalAudioTokens ¶ added in v0.5.0
func GetMultimodalSearchTokens ¶ added in v1.4.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 NewAnthropicClient ¶ added in v1.1.0
func NewGoogleClient ¶ added in v1.1.0
func NewOpenAIClient ¶ added in v1.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
User *model.User
App *model.App
AppKey *model.Key
Group *model.Group
}
Click to show internal directories.
Click to hide internal directories.