Documentation ¶
Index ¶
- Constants
- Variables
- func CheckKeySourceSkill(skill string) bool
- func CheckProviderSkill(skill string) bool
- func DelKeyResource(provider string, resourceId string)
- func DelProvider(provider string)
- func GetAIModel(ctx eocontext.EoContext) string
- func GetAIModelInputToken(ctx eocontext.EoContext) int
- func GetAIModelMode(ctx eocontext.EoContext) string
- func GetAIModelOutputToken(ctx eocontext.EoContext) int
- func GetAIModelTotalToken(ctx eocontext.EoContext) int
- func GetAIProvider(ctx eocontext.EoContext) string
- func GetAIStatus(ctx eocontext.EoContext) string
- func GetAIStatusExceeded(ctx eocontext.EoContext) string
- func GetAIStatusExpired(ctx eocontext.EoContext) string
- func GetAIStatusInvalid(ctx eocontext.EoContext) string
- func GetAIStatusInvalidRequest(ctx eocontext.EoContext) string
- func GetAIStatusNormal(ctx eocontext.EoContext) string
- func GetAIStatusQuotaExhausted(ctx eocontext.EoContext) string
- func GetAIStatusTimeout(ctx eocontext.EoContext) string
- func LoadModels(providerContent []byte, dirFs embed.FS) (map[string]*Model, error)
- func MapToStruct[T any](tmp map[string]interface{}) *T
- func NewBalanceHandler(id string, base string, timeout time.Duration) (eocontext.BalanceHandler, error)
- func NewBaseNode(id string, ip string, port int) *_BaseNode
- func SetAIModel(ctx eocontext.EoContext, model string)
- func SetAIModelInputToken(ctx eocontext.EoContext, token int)
- func SetAIModelMode(ctx eocontext.EoContext, mode string)
- func SetAIModelOutputToken(ctx eocontext.EoContext, token int)
- func SetAIModelTotalToken(ctx eocontext.EoContext, token int)
- func SetAIProvider(ctx eocontext.EoContext, provider string)
- func SetAIProviderStatuses(ctx eocontext.EoContext, status AIProviderStatus)
- func SetAIStatus(ctx eocontext.EoContext, status string)
- func SetAIStatusExceeded(ctx eocontext.EoContext)
- func SetAIStatusExpired(ctx eocontext.EoContext)
- func SetAIStatusInvalid(ctx eocontext.EoContext)
- func SetAIStatusInvalidRequest(ctx eocontext.EoContext)
- func SetAIStatusNormal(ctx eocontext.EoContext)
- func SetAIStatusQuotaExhausted(ctx eocontext.EoContext)
- func SetAIStatusTimeout(ctx eocontext.EoContext)
- func SetKeyResource(provider string, resource IKeyResource)
- func SetProvider(provider string, p IProvider)
- type AIProviderStatus
- type ClientRequest
- type ClientResponse
- type FGenerateConfig
- type IChildConverter
- type IConverter
- type IConverterDriver
- type IConverterFactory
- type IKeyResource
- type IManager
- type IProvider
- type KeyPool
- type KeyPoolManager
- type Manager
- type Message
- type Mode
- type Model
- type ModelMode
- type ModelType
- type Provider
- type ProviderManager
Constants ¶
View Source
const ( FinishReasonUnspecified = "FINISH_REASON_UNSPECIFIED" FinishStop = "STOP" FinishMaxTokens = "MAX_TOKENS" FinishSafety = "SAFETY" FinishRecitation = "RECITATION" FinishLanguage = "LANGUAGE" FinishOther = "OTHER" FinishBlockList = "BLOCKLIST" FinishProhibitedContent = "PROHIBITED_CONTENT" FinishSPII = "SPII" FinishMalformedFunctionCall = "MALFORMED_FUNCTION_CALL" )
Variables ¶
View Source
var ( AIModelInputTokenLabel = "ai_model_input_token" AIModelOutputTokenLabel = "ai_model_output_token" AIModelTotalTokenLabel = "ai_model_total_token" AIModelModeLabel = "ai_model_mode" AIModelLabel = "ai_model" AIProviderLabel = "ai_provider" AIProviderStatusesLabel = "ai_provider_statuses" AIModelStatusLabel = "ai_model_status" )
View Source
var ( StatusNormal = "normal" StatusInvalidRequest = "invalid request" StatusQuotaExhausted = "quota exhausted" StatusExpired = "expired" StatusExceeded = "exceeded" StatusInvalid = "invalid" StatusTimeout = "timeout" )
Functions ¶
func CheckKeySourceSkill ¶ added in v0.19.5
func CheckProviderSkill ¶ added in v0.19.5
func DelKeyResource ¶ added in v0.19.5
func DelProvider ¶ added in v0.19.5
func DelProvider(provider string)
func GetAIModel ¶ added in v0.19.5
func GetAIModelInputToken ¶ added in v0.19.5
func GetAIModelMode ¶ added in v0.19.5
func GetAIModelOutputToken ¶ added in v0.19.5
func GetAIModelTotalToken ¶ added in v0.19.5
func GetAIProvider ¶ added in v0.19.5
func GetAIStatus ¶ added in v0.19.5
func GetAIStatusExceeded ¶ added in v0.19.5
func GetAIStatusExpired ¶ added in v0.19.5
func GetAIStatusInvalid ¶ added in v0.19.5
func GetAIStatusInvalidRequest ¶ added in v0.19.5
func GetAIStatusNormal ¶ added in v0.19.5
func GetAIStatusQuotaExhausted ¶ added in v0.19.5
func GetAIStatusTimeout ¶ added in v0.19.5
func LoadModels ¶ added in v0.19.5
func MapToStruct ¶ added in v0.19.5
MapToStruct 将 map 转换为结构体实例
func NewBalanceHandler ¶ added in v0.19.5
func NewBaseNode ¶ added in v0.19.5
func SetAIModel ¶ added in v0.19.5
func SetAIModelInputToken ¶ added in v0.19.5
func SetAIModelMode ¶ added in v0.19.5
func SetAIModelOutputToken ¶ added in v0.19.5
func SetAIModelTotalToken ¶ added in v0.19.5
func SetAIProvider ¶ added in v0.19.5
func SetAIProviderStatuses ¶ added in v0.19.5
func SetAIProviderStatuses(ctx eocontext.EoContext, status AIProviderStatus)
func SetAIStatus ¶ added in v0.19.5
func SetAIStatusExceeded ¶ added in v0.19.5
func SetAIStatusExpired ¶ added in v0.19.5
func SetAIStatusInvalid ¶ added in v0.19.5
func SetAIStatusInvalidRequest ¶ added in v0.19.5
func SetAIStatusNormal ¶ added in v0.19.5
func SetAIStatusQuotaExhausted ¶ added in v0.19.5
func SetAIStatusTimeout ¶ added in v0.19.5
func SetKeyResource ¶ added in v0.19.5
func SetKeyResource(provider string, resource IKeyResource)
func SetProvider ¶ added in v0.19.5
Types ¶
type AIProviderStatus ¶ added in v0.19.5
type AIProviderStatus struct { Provider string `json:"provider"` Model string `json:"model"` Key string `json:"key"` Status string `json:"status"` }
func GetAIProviderStatuses ¶ added in v0.19.5
func GetAIProviderStatuses(ctx eocontext.EoContext) []AIProviderStatus
type ClientRequest ¶ added in v0.19.5
type ClientRequest struct {
Messages []*Message `json:"messages"`
}
type ClientResponse ¶ added in v0.19.5
type FGenerateConfig ¶
type IChildConverter ¶
type IChildConverter interface { IConverter Endpoint() string }
type IConverter ¶
type IConverterDriver ¶
type IConverterDriver interface { GetModel(model string) (FGenerateConfig, bool) GetConverter(model string) (IConverter, bool) }
type IConverterFactory ¶ added in v0.19.5
type IConverterFactory interface {
Create(cfg string) (IConverterDriver, error)
}
type IKeyResource ¶ added in v0.19.5
type IKeyResource interface { ID() string Health() bool Priority() int // Up 上线 Up() // Down 下线 Down() IsBreaker() bool // Breaker 熔断 Breaker() ConverterDriver() IConverterDriver }
func KeyResources ¶ added in v0.19.5
func KeyResources(provider string) ([]IKeyResource, bool)
type IManager ¶
type IManager interface { Get(id string) (IConverterFactory, bool) Set(id string, driver IConverterFactory) Del(id string) }
type IProvider ¶ added in v0.19.5
type IProvider interface { Provider() string Model() string ModelConfig() map[string]interface{} Priority() int Health() bool Down() BalanceHandler() eoscContext.BalanceHandler }
func GetProvider ¶ added in v0.19.5
type KeyPoolManager ¶ added in v0.19.5
type KeyPoolManager struct {
// contains filtered or unexported fields
}
func NewKeyPoolManager ¶ added in v0.19.5
func NewKeyPoolManager() *KeyPoolManager
func (*KeyPoolManager) Del ¶ added in v0.19.5
func (m *KeyPoolManager) Del(id string)
func (*KeyPoolManager) DelKeySource ¶ added in v0.19.5
func (m *KeyPoolManager) DelKeySource(id, resourceId string)
func (*KeyPoolManager) KeyResources ¶ added in v0.19.5
func (m *KeyPoolManager) KeyResources(id string) ([]IKeyResource, bool)
func (*KeyPoolManager) Set ¶ added in v0.19.5
func (m *KeyPoolManager) Set(id string, resource IKeyResource)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) Set ¶
func (m *Manager) Set(id string, driver IConverterFactory)
type ProviderManager ¶ added in v0.19.5
type ProviderManager struct {
// contains filtered or unexported fields
}
func NewProviderManager ¶ added in v0.19.5
func NewProviderManager() *ProviderManager
func (*ProviderManager) Del ¶ added in v0.19.5
func (m *ProviderManager) Del(provider string)
func (*ProviderManager) Get ¶ added in v0.19.5
func (m *ProviderManager) Get(provider string) (IProvider, bool)
func (*ProviderManager) Providers ¶ added in v0.19.5
func (m *ProviderManager) Providers() []IProvider
func (*ProviderManager) Set ¶ added in v0.19.5
func (m *ProviderManager) Set(provider string, p IProvider)
Click to show internal directories.
Click to hide internal directories.