Documentation
¶
Index ¶
- Constants
- Variables
- func HashedIdentity(identity string) string
- func ParsePluginUniversalEvent(data []byte, statusText string, ...)
- func ValidateProviderConfigs(settings map[string]any, configs []ProviderConfig) error
- type AgentStrategyDeclaration
- type AgentStrategyIdentity
- type AgentStrategyOutputSchema
- type AgentStrategyParameter
- type AgentStrategyParameterType
- type AgentStrategyProviderDeclaration
- type AgentStrategyProviderIdentity
- type AnyScope
- type AppSelectorScope
- type BasePluginIdentifier
- type ConfigOption
- type ConfigType
- type DatasourceDeclaration
- type DefaultParameterName
- type EndpointDeclaration
- type EndpointMethod
- type EndpointProviderDeclaration
- type ErrorResponse
- type FieldModelSchema
- type I18nObject
- type InvokePluginRequest
- type InvokePluginUserIdentity
- type ModelConfigScope
- type ModelCredentialSchema
- type ModelDeclaration
- type ModelParameterRule
- type ModelParameterType
- type ModelPosition
- type ModelPriceConfig
- type ModelProviderConfigurateMethod
- type ModelProviderCredentialFormSchema
- type ModelProviderCredentialSchema
- type ModelProviderDeclaration
- type ModelProviderFormOption
- type ModelProviderFormShowOnObject
- type ModelProviderFormType
- type ModelProviderHelpEntity
- type ModelType
- type OAuthSchema
- type ParameterAutoGenerate
- type ParameterAutoGenerateType
- type ParameterTemplate
- type PluginBasicInfoInterface
- type PluginCategory
- type PluginClusterLifetime
- type PluginDeclaration
- func (p *PluginDeclaration) Category() PluginCategory
- func (p *PluginDeclaration) FillInDefaultValues()
- func (p *PluginDeclaration) Identity() string
- func (p *PluginDeclaration) ManifestValidate() error
- func (p *PluginDeclaration) MarshalJSON() ([]byte, error)
- func (p *PluginDeclaration) UnmarshalJSON(data []byte) error
- type PluginDeclarationPlatformArch
- type PluginDeclarationWithoutAdvancedFields
- type PluginEventType
- type PluginExtensions
- type PluginFullDuplexLifetime
- type PluginLifetime
- type PluginLogEvent
- type PluginMeta
- type PluginPermissionAppRequirement
- type PluginPermissionEndpointRequirement
- type PluginPermissionModelRequirement
- type PluginPermissionNodeRequirement
- type PluginPermissionRequirement
- func (p *PluginPermissionRequirement) AllowInvokeApp() bool
- func (p *PluginPermissionRequirement) AllowInvokeLLM() bool
- func (p *PluginPermissionRequirement) AllowInvokeModel() bool
- func (p *PluginPermissionRequirement) AllowInvokeModeration() bool
- func (p *PluginPermissionRequirement) AllowInvokeNode() bool
- func (p *PluginPermissionRequirement) AllowInvokeRerank() bool
- func (p *PluginPermissionRequirement) AllowInvokeSpeech2Text() bool
- func (p *PluginPermissionRequirement) AllowInvokeStorage() bool
- func (p *PluginPermissionRequirement) AllowInvokeTTS() bool
- func (p *PluginPermissionRequirement) AllowInvokeTextEmbedding() bool
- func (p *PluginPermissionRequirement) AllowInvokeTool() bool
- func (p *PluginPermissionRequirement) AllowRegisterEndpoint() bool
- type PluginPermissionStorageRequirement
- type PluginPermissionToolRequirement
- type PluginResourceRequirement
- type PluginRunner
- type PluginRuntime
- func (r *PluginRuntime) AddRestarts()
- func (r *PluginRuntime) Configuration() *PluginDeclaration
- func (s *PluginRuntime) Error(log string)
- func (r *PluginRuntime) HashedIdentity() (string, error)
- func (r *PluginRuntime) InitState()
- func (s *PluginRuntime) Log(log string)
- func (r *PluginRuntime) OnStop(f func())
- func (r *PluginRuntime) RuntimeState() PluginRuntimeState
- func (r *PluginRuntime) SetActive()
- func (r *PluginRuntime) SetActiveAt(t time.Time)
- func (r *PluginRuntime) SetLaunching()
- func (r *PluginRuntime) SetPending()
- func (r *PluginRuntime) SetRestarting()
- func (r *PluginRuntime) SetScheduledAt(t time.Time)
- func (r *PluginRuntime) Stop()
- func (r *PluginRuntime) Stopped() bool
- func (r *PluginRuntime) TriggerStop()
- func (r *PluginRuntime) UpdateScheduledAt(t time.Time)
- func (s *PluginRuntime) Warn(log string)
- type PluginRuntimeSessionIOInterface
- type PluginRuntimeState
- type PluginRuntimeType
- type PluginServerlessLifetime
- type PluginUniqueIdentifier
- func (p PluginUniqueIdentifier) Author() string
- func (p PluginUniqueIdentifier) Checksum() string
- func (p PluginUniqueIdentifier) PluginID() string
- func (p PluginUniqueIdentifier) RemoteLike() bool
- func (p PluginUniqueIdentifier) String() string
- func (p PluginUniqueIdentifier) Validate() error
- func (p PluginUniqueIdentifier) Version() manifest_entities.Version
- type PluginUniversalEvent
- type ProviderConfig
- type RemoteAssetPayload
- type RemotePluginRegisterAssetChunk
- type RemotePluginRegisterEventType
- type RemotePluginRegisterHandshake
- type RemotePluginRegisterPayload
- type SESSION_MESSAGE_TYPE
- type SessionMessage
- type ToolDeclaration
- type ToolDescription
- type ToolIdentity
- type ToolOutputSchema
- type ToolParameter
- type ToolParameterForm
- type ToolParameterOption
- type ToolParameterType
- type ToolProviderDeclaration
- type ToolProviderIdentity
- type ToolSelectorScope
Constants ¶
View Source
const ( SECRET_INPUT = "secret-input" TEXT_INPUT = "text-input" SELECT = "select" STRING = "string" NUMBER = "number" FILE = "file" FILES = "files" BOOLEAN = "boolean" APP_SELECTOR = "app-selector" MODEL_SELECTOR = "model-selector" // TOOL_SELECTOR = "tool-selector" TOOLS_SELECTOR = "array[tools]" ANY = "any" )
View Source
const ( PLUGIN_RUNTIME_STATUS_ACTIVE = "active" PLUGIN_RUNTIME_STATUS_LAUNCHING = "launching" PLUGIN_RUNTIME_STATUS_STOPPED = "stopped" PLUGIN_RUNTIME_STATUS_RESTARTING = "restarting" PLUGIN_RUNTIME_STATUS_PENDING = "pending" )
Variables ¶
View Source
var ( PluginNameRegex = regexp.MustCompile(`^[a-z0-9_-]{1,128}$`) AuthorRegex = regexp.MustCompile(`^[a-z0-9_-]{1,64}$`) )
View Source
var PARAMETER_RULE_TEMPLATE = map[DefaultParameterName]ModelParameterRule{ TEMPERATURE: { Label: &I18nObject{ EnUS: "Temperature", ZhHans: "温度", JaJp: "温度", PtBr: "Temperatura", }, Type: parser.ToPtr(PARAMETER_TYPE_FLOAT), Help: &I18nObject{ EnUS: "Controls randomness. Lower temperature results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive. Higher temperature results in more random completions.", ZhHans: "温度控制随机性。较低的温度会导致较少的随机完成。随着温度接近零,模型将变得确定性和重复性。较高的温度会导致更多的随机完成。", JaJp: "温度はランダム性を制御します。温度が低いほどランダムな完成が少なくなります。温度がゼロに近づくと、モデルは決定論的で繰り返しになります。温度が高いほどランダムな完成が多くなります。", PtBr: "A temperatura controla a aleatoriedade. Menores temperaturas resultam em menos conclusões aleatórias. À medida que a temperatura se aproxima de zero, o modelo se tornará determinístico e repetitivo. Temperaturas mais altas resultam em mais conclusões aleatórias.", }, Required: false, Default: parser.ToPtr(any(0.0)), Min: parser.ToPtr(0.0), Max: parser.ToPtr(1.0), Precision: parser.ToPtr(2), }, TOP_P: { Label: &I18nObject{ EnUS: "Top P", ZhHans: "Top P", JaJp: "Top P", PtBr: "Top P", }, Type: parser.ToPtr(PARAMETER_TYPE_FLOAT), Help: &I18nObject{ EnUS: "Controls diversity via nucleus sampling: 0.5 means half of all likelihood-weighted options are considered.", ZhHans: "通过核心采样控制多样性:0.5表示考虑了一半的所有可能性加权选项。", JaJp: "核サンプリングを通じて多様性を制御します:0.5は、すべての可能性加权オプションの半分を考慮します。", PtBr: "Controla a diversidade via amostragem de núcleo: 0.5 significa que metade das opções com maior probabilidade são consideradas.", }, Required: false, Default: parser.ToPtr(any(1.0)), Min: parser.ToPtr(0.0), Max: parser.ToPtr(1.0), Precision: parser.ToPtr(2), }, TOP_K: { Label: &I18nObject{ EnUS: "Top K", ZhHans: "Top K", }, Type: parser.ToPtr(PARAMETER_TYPE_INT), Help: &I18nObject{ EnUS: "Limits the number of tokens to consider for each step by keeping only the k most likely tokens.", ZhHans: "通过只保留每一步中最可能的 k 个标记来限制要考虑的标记数量。", }, Required: false, Default: parser.ToPtr(any(50)), Min: parser.ToPtr(1.0), Max: parser.ToPtr(100.0), Precision: parser.ToPtr(0), }, PRESENCE_PENALTY: { Label: &I18nObject{ EnUS: "Presence Penalty", ZhHans: "存在惩罚", JaJp: "存在ペナルティ", PtBr: "Penalidade de presença", }, Type: parser.ToPtr(PARAMETER_TYPE_FLOAT), Help: &I18nObject{ EnUS: "Applies a penalty to the log-probability of tokens already in the text.", ZhHans: "对文本中已有的标记的对数概率施加惩罚。", JaJp: "テキストに既に存在するトークンの対数確率にペナルティを適用します。", PtBr: "Aplica uma penalidade à probabilidade logarítmica de tokens já presentes no texto.", }, Required: false, Default: parser.ToPtr(any(0.0)), Min: parser.ToPtr(0.0), Max: parser.ToPtr(1.0), Precision: parser.ToPtr(2), }, FREQUENCY_PENALTY: { Label: &I18nObject{ EnUS: "Frequency Penalty", ZhHans: "频率惩罚", JaJp: "頻度ペナルティ", PtBr: "Penalidade de frequência", }, Type: parser.ToPtr(PARAMETER_TYPE_FLOAT), Help: &I18nObject{ EnUS: "Applies a penalty to the log-probability of tokens that appear in the text.", ZhHans: "对文本中出现的标记的对数概率施加惩罚。", JaJp: "テキストに出現するトークンの対数確率にペナルティを適用します。", PtBr: "Aplica uma penalidade à probabilidade logarítmica de tokens que aparecem no texto.", }, Required: false, Default: parser.ToPtr(any(0.0)), Min: parser.ToPtr(0.0), Max: parser.ToPtr(1.0), Precision: parser.ToPtr(2), }, MAX_TOKENS: { Label: &I18nObject{ EnUS: "Max Tokens", ZhHans: "最大标记", JaJp: "最大トークン", PtBr: "Máximo de tokens", }, Type: parser.ToPtr(PARAMETER_TYPE_INT), Help: &I18nObject{ EnUS: "Specifies the upper limit on the length of generated results. If the generated results are truncated, you can increase this parameter.", ZhHans: "指定生成结果长度的上限。如果生成结果截断,可以调大该参数。", JaJp: "生成結果の長さの上限を指定します。生成結果が切り捨てられた場合は、このパラメータを大きくすることができます。", PtBr: "Especifica o limite superior para o comprimento dos resultados gerados. Se os resultados gerados forem truncados, você pode aumentar este parâmetro.", }, Required: false, Default: parser.ToPtr(any(64)), Min: parser.ToPtr(1.0), Max: parser.ToPtr(2048.0), Precision: parser.ToPtr(0), }, RESPONSE_FORMAT: { Label: &I18nObject{ EnUS: "Response Format", ZhHans: "回复格式", JaJp: "応答形式", PtBr: "Formato de resposta", }, Type: parser.ToPtr(PARAMETER_TYPE_STRING), Help: &I18nObject{ EnUS: "Set a response format, ensure the output from llm is a valid code block as possible, such as JSON, XML, etc.", ZhHans: "设置一个返回格式,确保llm的输出尽可能是有效的代码块,如JSON、XML等", JaJp: "応答形式を設定します。llmの出力が可能な限り有効なコードブロックであることを確認します。", PtBr: "Defina um formato de resposta para garantir que a saída do llm seja um bloco de código válido o mais possível, como JSON, XML, etc.", }, Required: false, Options: []string{"JSON", "XML"}, }, JSON_SCHEMA: { Label: &I18nObject{ EnUS: "JSON Schema", }, Type: parser.ToPtr(PARAMETER_TYPE_STRING), Help: &I18nObject{ EnUS: "Set a response json schema will ensure LLM to adhere it.", ZhHans: "设置返回的json schema,llm将按照它返回", }, Required: false, }, }
Functions ¶
func HashedIdentity ¶
func ParsePluginUniversalEvent ¶
func ParsePluginUniversalEvent( data []byte, statusText string, sessionHandler func(sessionId string, data []byte), heartbeatHandler func(), errorHandler func(err string), infoHandler func(message string), )
ParsePluginUniversalEvent parses bytes into struct contains basic info of a message it's the outermost layer of the protocol error_handler will be called when data is not standard or itself it's an error message
func ValidateProviderConfigs ¶
func ValidateProviderConfigs(settings map[string]any, configs []ProviderConfig) error
ValidateProviderConfigs validates the provider configs
Types ¶
type AgentStrategyDeclaration ¶
type AgentStrategyDeclaration struct { Identity AgentStrategyIdentity `json:"identity" yaml:"identity" validate:"required"` Description I18nObject `json:"description" yaml:"description" validate:"required"` Parameters []AgentStrategyParameter `json:"parameters" yaml:"parameters" validate:"omitempty,dive"` OutputSchema AgentStrategyOutputSchema `json:"output_schema" yaml:"output_schema" validate:"omitempty,json_schema"` Features []string `json:"features" yaml:"features" validate:"omitempty,dive,lt=256"` }
type AgentStrategyIdentity ¶
type AgentStrategyIdentity struct {
ToolIdentity `json:",inline" yaml:",inline"`
}
type AgentStrategyParameter ¶
type AgentStrategyParameter struct { Name string `json:"name" yaml:"name" validate:"required,gt=0,lt=1024"` Label I18nObject `json:"label" yaml:"label" validate:"required"` Help I18nObject `json:"help" yaml:"help" validate:"omitempty"` Type AgentStrategyParameterType `json:"type" yaml:"type" validate:"required,agent_strategy_parameter_type"` AutoGenerate *ParameterAutoGenerate `json:"auto_generate" yaml:"auto_generate" validate:"omitempty"` Template *ParameterTemplate `json:"template" yaml:"template" validate:"omitempty"` Scope *string `json:"scope" yaml:"scope" validate:"omitempty,max=1024,is_scope"` Required bool `json:"required" yaml:"required"` Default any `json:"default" yaml:"default" validate:"omitempty,is_basic_type"` Min *float64 `json:"min" yaml:"min" validate:"omitempty"` Max *float64 `json:"max" yaml:"max" validate:"omitempty"` Precision *int `json:"precision" yaml:"precision" validate:"omitempty"` Options []ToolParameterOption `json:"options" yaml:"options" validate:"omitempty,dive"` }
type AgentStrategyParameterType ¶
type AgentStrategyParameterType string
const ( AGENT_STRATEGY_PARAMETER_TYPE_STRING AgentStrategyParameterType = STRING AGENT_STRATEGY_PARAMETER_TYPE_NUMBER AgentStrategyParameterType = NUMBER AGENT_STRATEGY_PARAMETER_TYPE_BOOLEAN AgentStrategyParameterType = BOOLEAN AGENT_STRATEGY_PARAMETER_TYPE_SELECT AgentStrategyParameterType = SELECT AGENT_STRATEGY_PARAMETER_TYPE_SECRET_INPUT AgentStrategyParameterType = SECRET_INPUT AGENT_STRATEGY_PARAMETER_TYPE_FILE AgentStrategyParameterType = FILE AGENT_STRATEGY_PARAMETER_TYPE_FILES AgentStrategyParameterType = FILES AGENT_STRATEGY_PARAMETER_TYPE_APP_SELECTOR AgentStrategyParameterType = APP_SELECTOR AGENT_STRATEGY_PARAMETER_TYPE_MODEL_SELECTOR AgentStrategyParameterType = MODEL_SELECTOR AGENT_STRATEGY_PARAMETER_TYPE_TOOLS_SELECTOR AgentStrategyParameterType = TOOLS_SELECTOR AGENT_STRATEGY_PARAMETER_TYPE_ANY AgentStrategyParameterType = ANY )
type AgentStrategyProviderDeclaration ¶
type AgentStrategyProviderDeclaration struct { Identity AgentStrategyProviderIdentity `json:"identity" yaml:"identity" validate:"required"` Strategies []AgentStrategyDeclaration `json:"strategies" yaml:"strategies" validate:"required,dive"` StrategyFiles []string `json:"-" yaml:"-"` }
func (*AgentStrategyProviderDeclaration) MarshalJSON ¶
func (a *AgentStrategyProviderDeclaration) MarshalJSON() ([]byte, error)
func (*AgentStrategyProviderDeclaration) UnmarshalJSON ¶
func (a *AgentStrategyProviderDeclaration) UnmarshalJSON(data []byte) error
func (*AgentStrategyProviderDeclaration) UnmarshalYAML ¶
func (a *AgentStrategyProviderDeclaration) UnmarshalYAML(value *yaml.Node) error
type AgentStrategyProviderIdentity ¶
type AgentStrategyProviderIdentity struct {
ToolProviderIdentity `json:",inline" yaml:",inline"`
}
type AnyScope ¶
type AnyScope string
const ( ANY_SCOPE_STRING AnyScope = "string" ANY_SCOPE_NUMBER AnyScope = "number" ANY_SCOPE_OBJECT AnyScope = "object" ANY_SCOPE_ARRAY_NUMBER AnyScope = "array[number]" ANY_SCOPE_ARRAY_STRING AnyScope = "array[string]" ANY_SCOPE_ARRAY_OBJECT AnyScope = "array[object]" ANY_SCOPE_ARRAY_FILES AnyScope = "array[file]" )
type AppSelectorScope ¶
type AppSelectorScope string
const ( APP_SELECTOR_SCOPE_ALL AppSelectorScope = "all" APP_SELECTOR_SCOPE_CHAT AppSelectorScope = "chat" APP_SELECTOR_SCOPE_WORKFLOW AppSelectorScope = "workflow" APP_SELECTOR_SCOPE_COMPLETION AppSelectorScope = "completion" )
type BasePluginIdentifier ¶
type BasePluginIdentifier struct {
PluginID string `json:"plugin_id"`
}
type ConfigOption ¶
type ConfigOption struct { Value string `json:"value" validate:"required,lt=128"` Label I18nObject `json:"label" validate:"required"` }
type ConfigType ¶
type ConfigType string
const ( CONFIG_TYPE_SECRET_INPUT ConfigType = SECRET_INPUT CONFIG_TYPE_TEXT_INPUT ConfigType = TEXT_INPUT CONFIG_TYPE_SELECT ConfigType = SELECT CONFIG_TYPE_BOOLEAN ConfigType = BOOLEAN CONFIG_TYPE_MODEL_SELECTOR ConfigType = MODEL_SELECTOR CONFIG_TYPE_APP_SELECTOR ConfigType = APP_SELECTOR // CONFIG_TYPE_TOOL_SELECTOR ConfigType = TOOL_SELECTOR CONFIG_TYPE_TOOLS_SELECTOR ConfigType = TOOLS_SELECTOR CONFIG_TYPE_ANY ConfigType = ANY )
type DatasourceDeclaration ¶
type DatasourceDeclaration struct { CredentialsSchema []ProviderConfig `json:"credentials_schema" yaml:"credentials_schema" validate:"omitempty,dive"` OAuthSchema *OAuthSchema `json:"oauth_schema" yaml:"oauth_schema" validate:"omitempty,dive"` }
type DefaultParameterName ¶
type DefaultParameterName string
const ( TEMPERATURE DefaultParameterName = "temperature" TOP_P DefaultParameterName = "top_p" TOP_K DefaultParameterName = "top_k" PRESENCE_PENALTY DefaultParameterName = "presence_penalty" FREQUENCY_PENALTY DefaultParameterName = "frequency_penalty" MAX_TOKENS DefaultParameterName = "max_tokens" RESPONSE_FORMAT DefaultParameterName = "response_format" JSON_SCHEMA DefaultParameterName = "json_schema" )
type EndpointDeclaration ¶
type EndpointDeclaration struct { Path string `json:"path" yaml:"path" validate:"required"` Method EndpointMethod `json:"method" yaml:"method" validate:"required,is_available_endpoint_method"` Hidden bool `json:"hidden" yaml:"hidden" validate:"omitempty"` }
type EndpointMethod ¶
type EndpointMethod string
const ( EndpointMethodHead EndpointMethod = "HEAD" EndpointMethodGet EndpointMethod = "GET" EndpointMethodPost EndpointMethod = "POST" EndpointMethodPut EndpointMethod = "PUT" EndpointMethodDelete EndpointMethod = "DELETE" EndpointMethodOptions EndpointMethod = "OPTIONS" )
type EndpointProviderDeclaration ¶
type EndpointProviderDeclaration struct { Settings []ProviderConfig `json:"settings" yaml:"settings" validate:"omitempty,dive"` Endpoints []EndpointDeclaration `json:"endpoints" yaml:"endpoint_declarations" validate:"omitempty,dive"` EndpointFiles []string `json:"-" yaml:"-"` }
func (*EndpointProviderDeclaration) UnmarshalJSON ¶
func (e *EndpointProviderDeclaration) UnmarshalJSON(data []byte) error
func (*EndpointProviderDeclaration) UnmarshalYAML ¶
func (e *EndpointProviderDeclaration) UnmarshalYAML(node *yaml.Node) error
type ErrorResponse ¶
type ErrorResponse struct { Message string `json:"message"` ErrorType string `json:"error_type"` Args map[string]any `json:"args" validate:"omitempty,max=10"` // max 10 args }
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type FieldModelSchema ¶
type FieldModelSchema struct { Label I18nObject `json:"label" yaml:"label" validate:"required"` Placeholder *I18nObject `json:"placeholder" yaml:"placeholder" validate:"omitempty"` }
type I18nObject ¶
type I18nObject struct { EnUS string `json:"en_US" yaml:"en_US" validate:"required,gt=0,lt=1024"` JaJp string `json:"ja_JP,omitempty" yaml:"ja_JP,omitempty" validate:"lt=1024"` ZhHans string `json:"zh_Hans,omitempty" yaml:"zh_Hans,omitempty" validate:"lt=1024"` PtBr string `json:"pt_BR,omitempty" yaml:"pt_BR,omitempty" validate:"lt=1024"` }
func NewI18nObject ¶
func NewI18nObject(def string) I18nObject
type InvokePluginRequest ¶
type InvokePluginRequest[T any] struct { InvokePluginUserIdentity BasePluginIdentifier UniqueIdentifier PluginUniqueIdentifier `json:"unique_identifier"` ConversationID *string `json:"conversation_id"` MessageID *string `json:"message_id"` AppID *string `json:"app_id"` EndpointID *string `json:"endpoint_id"` Data T `json:"data" validate:"required"` }
type ModelConfigScope ¶
type ModelConfigScope string
const ( MODEL_CONFIG_SCOPE_ALL ModelConfigScope = "all" MODEL_CONFIG_SCOPE_LLM ModelConfigScope = "llm" MODEL_CONFIG_SCOPE_TEXT_EMBEDDING ModelConfigScope = "text-embedding" MODEL_CONFIG_SCOPE_RERANK ModelConfigScope = "rerank" MODEL_CONFIG_SCOPE_TTS ModelConfigScope = "tts" MODEL_CONFIG_SCOPE_SPEECH2TEXT ModelConfigScope = "speech2text" MODEL_CONFIG_SCOPE_MODERATION ModelConfigScope = "moderation" MODEL_CONFIG_SCOPE_VISION ModelConfigScope = "vision" MODEL_CONFIG_SCOPE_DOCUMENT ModelConfigScope = "document" MODEL_CONFIG_SCOPE_TOOL_CALL ModelConfigScope = "tool-call" )
type ModelCredentialSchema ¶
type ModelCredentialSchema struct { Model FieldModelSchema `json:"model" yaml:"model" validate:"required"` CredentialFormSchemas []ModelProviderCredentialFormSchema `json:"credential_form_schemas" yaml:"credential_form_schemas" validate:"omitempty,lte=32,dive"` }
type ModelDeclaration ¶
type ModelDeclaration struct { Model string `json:"model" yaml:"model" validate:"required,lt=256"` Label I18nObject `json:"label" yaml:"label" validate:"required"` ModelType ModelType `json:"model_type" yaml:"model_type" validate:"required,model_type"` Features []string `json:"features" yaml:"features" validate:"omitempty,lte=256,dive,lt=256"` FetchFrom ModelProviderConfigurateMethod `json:"fetch_from" yaml:"fetch_from" validate:"omitempty,model_provider_configurate_method"` ModelProperties map[string]any `json:"model_properties" yaml:"model_properties" validate:"omitempty"` Deprecated bool `json:"deprecated" yaml:"deprecated"` ParameterRules []ModelParameterRule `json:"parameter_rules" yaml:"parameter_rules" validate:"omitempty,lte=128,dive,parameter_rule"` PriceConfig *ModelPriceConfig `json:"pricing" yaml:"pricing" validate:"omitempty"` }
func (ModelDeclaration) MarshalJSON ¶
func (m ModelDeclaration) MarshalJSON() ([]byte, error)
func (*ModelDeclaration) UnmarshalJSON ¶
func (m *ModelDeclaration) UnmarshalJSON(data []byte) error
func (*ModelDeclaration) UnmarshalYAML ¶
func (m *ModelDeclaration) UnmarshalYAML(value *yaml.Node) error
type ModelParameterRule ¶
type ModelParameterRule struct { Name string `json:"name" yaml:"name" validate:"required,lt=256"` UseTemplate *string `json:"use_template" yaml:"use_template" validate:"omitempty,lt=256"` Label *I18nObject `json:"label" yaml:"label" validate:"omitempty"` Type *ModelParameterType `json:"type" yaml:"type" validate:"omitempty,model_parameter_type"` Help *I18nObject `json:"help" yaml:"help" validate:"omitempty"` Required bool `json:"required" yaml:"required"` Default *any `json:"default" yaml:"default" validate:"omitempty,is_basic_type"` Min *float64 `json:"min" yaml:"min" validate:"omitempty"` Max *float64 `json:"max" yaml:"max" validate:"omitempty"` Precision *int `json:"precision" yaml:"precision" validate:"omitempty"` Options []string `json:"options" yaml:"options" validate:"omitempty,dive,lt=256"` }
func (*ModelParameterRule) TransformTemplate ¶
func (m *ModelParameterRule) TransformTemplate() error
func (*ModelParameterRule) UnmarshalJSON ¶
func (m *ModelParameterRule) UnmarshalJSON(data []byte) error
func (*ModelParameterRule) UnmarshalYAML ¶
func (m *ModelParameterRule) UnmarshalYAML(value *yaml.Node) error
type ModelParameterType ¶
type ModelParameterType string
const ( PARAMETER_TYPE_FLOAT ModelParameterType = "float" PARAMETER_TYPE_INT ModelParameterType = "int" PARAMETER_TYPE_STRING ModelParameterType = "string" PARAMETER_TYPE_BOOLEAN ModelParameterType = "boolean" PARAMETER_TYPE_TEXT ModelParameterType = "text" )
type ModelPosition ¶
type ModelPosition struct { LLM *[]string `json:"llm,omitempty" yaml:"llm,omitempty"` TextEmbedding *[]string `json:"text_embedding,omitempty" yaml:"text_embedding,omitempty"` Rerank *[]string `json:"rerank,omitempty" yaml:"rerank,omitempty"` TTS *[]string `json:"tts,omitempty" yaml:"tts,omitempty"` Speech2text *[]string `json:"speech2text,omitempty" yaml:"speech2text,omitempty"` Moderation *[]string `json:"moderation,omitempty" yaml:"moderation,omitempty"` }
type ModelPriceConfig ¶
type ModelPriceConfig struct { Input decimal.Decimal `json:"input" yaml:"input" validate:"required"` Output *decimal.Decimal `json:"output" yaml:"output" validate:"omitempty"` Unit decimal.Decimal `json:"unit" yaml:"unit" validate:"required"` Currency string `json:"currency" yaml:"currency" validate:"required"` }
type ModelProviderConfigurateMethod ¶
type ModelProviderConfigurateMethod string
const ( CONFIGURATE_METHOD_PREDEFINED_MODEL ModelProviderConfigurateMethod = "predefined-model" CONFIGURATE_METHOD_CUSTOMIZABLE_MODEL ModelProviderConfigurateMethod = "customizable-model" )
type ModelProviderCredentialFormSchema ¶
type ModelProviderCredentialFormSchema struct { Variable string `json:"variable" yaml:"variable" validate:"required,lt=256"` Label I18nObject `json:"label" yaml:"label" validate:"required"` Type ModelProviderFormType `json:"type" yaml:"type" validate:"required,model_provider_form_type"` Required bool `json:"required" yaml:"required"` Default *string `json:"default" yaml:"default" validate:"omitempty,lt=256"` Options []ModelProviderFormOption `json:"options" yaml:"options" validate:"omitempty,lte=128,dive"` Placeholder *I18nObject `json:"placeholder" yaml:"placeholder" validate:"omitempty"` MaxLength int `json:"max_length" yaml:"max_length"` ShowOn []ModelProviderFormShowOnObject `json:"show_on" yaml:"show_on" validate:"omitempty,lte=16,dive"` }
func (*ModelProviderCredentialFormSchema) UnmarshalJSON ¶
func (m *ModelProviderCredentialFormSchema) UnmarshalJSON(data []byte) error
func (*ModelProviderCredentialFormSchema) UnmarshalYAML ¶
func (m *ModelProviderCredentialFormSchema) UnmarshalYAML(value *yaml.Node) error
type ModelProviderCredentialSchema ¶
type ModelProviderCredentialSchema struct {
CredentialFormSchemas []ModelProviderCredentialFormSchema `json:"credential_form_schemas" yaml:"credential_form_schemas" validate:"omitempty,lte=32,dive"`
}
type ModelProviderDeclaration ¶
type ModelProviderDeclaration struct { Provider string `json:"provider" yaml:"provider" validate:"required,lt=256"` Label I18nObject `json:"label" yaml:"label" validate:"required"` Description *I18nObject `json:"description" yaml:"description,omitempty" validate:"omitempty"` IconSmall *I18nObject `json:"icon_small" yaml:"icon_small,omitempty" validate:"omitempty"` IconLarge *I18nObject `json:"icon_large" yaml:"icon_large,omitempty" validate:"omitempty"` Background *string `json:"background" yaml:"background,omitempty" validate:"omitempty"` Help *ModelProviderHelpEntity `json:"help" yaml:"help,omitempty" validate:"omitempty"` SupportedModelTypes []ModelType `json:"supported_model_types" yaml:"supported_model_types" validate:"required,lte=16,dive,model_type"` ConfigurateMethods []ModelProviderConfigurateMethod `json:"configurate_methods" yaml:"configurate_methods" validate:"required,lte=16,dive,model_provider_configurate_method"` ProviderCredentialSchema *ModelProviderCredentialSchema `json:"provider_credential_schema" yaml:"provider_credential_schema,omitempty" validate:"omitempty"` ModelCredentialSchema *ModelCredentialSchema `json:"model_credential_schema" yaml:"model_credential_schema,omitempty" validate:"omitempty"` Position *ModelPosition `json:"position,omitempty" yaml:"position,omitempty"` Models []ModelDeclaration `json:"models" yaml:"model_declarations,omitempty"` ModelFiles []string `json:"-" yaml:"-"` PositionFiles map[string]string `json:"-" yaml:"-"` }
func (*ModelProviderDeclaration) MarshalJSON ¶
func (m *ModelProviderDeclaration) MarshalJSON() ([]byte, error)
func (*ModelProviderDeclaration) UnmarshalJSON ¶
func (m *ModelProviderDeclaration) UnmarshalJSON(data []byte) error
func (*ModelProviderDeclaration) UnmarshalYAML ¶
func (m *ModelProviderDeclaration) UnmarshalYAML(value *yaml.Node) error
type ModelProviderFormOption ¶
type ModelProviderFormOption struct { Label I18nObject `json:"label" yaml:"label" validate:"required"` Value string `json:"value" yaml:"value" validate:"required,lt=256"` ShowOn []ModelProviderFormShowOnObject `json:"show_on" yaml:"show_on" validate:"omitempty,lte=16,dive"` }
func (*ModelProviderFormOption) UnmarshalJSON ¶
func (m *ModelProviderFormOption) UnmarshalJSON(data []byte) error
func (*ModelProviderFormOption) UnmarshalYAML ¶
func (m *ModelProviderFormOption) UnmarshalYAML(value *yaml.Node) error
type ModelProviderFormType ¶
type ModelProviderFormType string
const ( FORM_TYPE_TEXT_INPUT ModelProviderFormType = "text-input" FORM_TYPE_SECRET_INPUT ModelProviderFormType = "secret-input" FORM_TYPE_SELECT ModelProviderFormType = "select" FORM_TYPE_RADIO ModelProviderFormType = "radio" FORM_TYPE_SWITCH ModelProviderFormType = "switch" )
type ModelProviderHelpEntity ¶
type ModelProviderHelpEntity struct { Title I18nObject `json:"title" yaml:"title" validate:"required"` URL I18nObject `json:"url" yaml:"url" validate:"required"` }
type ModelType ¶
type ModelType string
const ( MODEL_TYPE_LLM ModelType = "llm" MODEL_TYPE_TEXT_EMBEDDING ModelType = "text-embedding" MODEL_TYPE_RERANKING ModelType = "rerank" MODEL_TYPE_SPEECH2TEXT ModelType = "speech2text" MODEL_TYPE_MODERATION ModelType = "moderation" MODEL_TYPE_TTS ModelType = "tts" MODEL_TYPE_TEXT2IMG ModelType = "text2img" )
type OAuthSchema ¶
type OAuthSchema struct { // ClientSchema contains client_id, client_secret, redirect_uri, etc. which are required to be set by system admin ClientSchema []ProviderConfig `json:"client_schema" yaml:"client_schema" validate:"omitempty,dive"` // CredentialsSchema contains schema of access_token, refresh_token, etc. CredentialsSchema []ProviderConfig `json:"credentials_schema" yaml:"credentials_schema" validate:"omitempty,dive"` }
type ParameterAutoGenerate ¶
type ParameterAutoGenerate struct {
Type ParameterAutoGenerateType `json:"type" yaml:"type" validate:"required,parameter_auto_generate_type"`
}
type ParameterAutoGenerateType ¶
type ParameterAutoGenerateType string
const (
PARAMETER_AUTO_GENERATE_TYPE_PROMPT_INSTRUCTION ParameterAutoGenerateType = "prompt_instruction"
)
type ParameterTemplate ¶
type ParameterTemplate struct {
Enabled bool `json:"enabled" yaml:"enabled"`
}
type PluginBasicInfoInterface ¶
type PluginBasicInfoInterface interface { // returns the runtime type of the plugin Type() PluginRuntimeType // returns the plugin configuration Configuration() *PluginDeclaration // unique identity of the plugin Identity() (PluginUniqueIdentifier, error) // hashed identity of the plugin HashedIdentity() (string, error) // returns the checksum of the plugin Checksum() (string, error) }
type PluginCategory ¶
type PluginCategory string
const ( PLUGIN_CATEGORY_TOOL PluginCategory = "tool" PLUGIN_CATEGORY_MODEL PluginCategory = "model" PLUGIN_CATEGORY_EXTENSION PluginCategory = "extension" PLUGIN_CATEGORY_AGENT_STRATEGY PluginCategory = "agent-strategy" )
type PluginClusterLifetime ¶
type PluginClusterLifetime interface { // stop the plugin Stop() // add a function to be called when the plugin stops OnStop(func()) // trigger the stop event TriggerStop() // returns true if the plugin is stopped Stopped() bool // returns the runtime state of the plugin RuntimeState() PluginRuntimeState // Update the runtime state of the plugin UpdateScheduledAt(t time.Time) }
type PluginDeclaration ¶
type PluginDeclaration struct { PluginDeclarationWithoutAdvancedFields `yaml:",inline"` Verified bool `json:"verified" yaml:"verified"` Endpoint *EndpointProviderDeclaration `json:"endpoint,omitempty" yaml:"endpoint,omitempty" validate:"omitempty"` Model *ModelProviderDeclaration `json:"model,omitempty" yaml:"model,omitempty" validate:"omitempty"` Tool *ToolProviderDeclaration `json:"tool,omitempty" yaml:"tool,omitempty" validate:"omitempty"` AgentStrategy *AgentStrategyProviderDeclaration `json:"agent_strategy,omitempty" yaml:"agent_strategy,omitempty" validate:"omitempty"` }
func UnmarshalPluginDeclarationFromJSON ¶
func UnmarshalPluginDeclarationFromJSON(data []byte) (*PluginDeclaration, error)
func UnmarshalPluginDeclarationFromYaml ¶
func UnmarshalPluginDeclarationFromYaml(data []byte) (*PluginDeclaration, error)
func (*PluginDeclaration) Category ¶
func (p *PluginDeclaration) Category() PluginCategory
func (*PluginDeclaration) FillInDefaultValues ¶
func (p *PluginDeclaration) FillInDefaultValues()
func (*PluginDeclaration) Identity ¶
func (p *PluginDeclaration) Identity() string
func (*PluginDeclaration) ManifestValidate ¶
func (p *PluginDeclaration) ManifestValidate() error
func (*PluginDeclaration) MarshalJSON ¶
func (p *PluginDeclaration) MarshalJSON() ([]byte, error)
func (*PluginDeclaration) UnmarshalJSON ¶
func (p *PluginDeclaration) UnmarshalJSON(data []byte) error
type PluginDeclarationPlatformArch ¶
type PluginDeclarationPlatformArch string
type PluginDeclarationWithoutAdvancedFields ¶
type PluginDeclarationWithoutAdvancedFields struct { Version manifest_entities.Version `json:"version" yaml:"version,omitempty" validate:"required,version"` Type manifest_entities.DifyManifestType `json:"type" yaml:"type,omitempty" validate:"required,eq=plugin"` Author string `json:"author" yaml:"author,omitempty" validate:"omitempty,max=64"` Name string `json:"name" yaml:"name,omitempty" validate:"required,max=128"` Label I18nObject `json:"label" yaml:"label" validate:"required"` Description I18nObject `json:"description" yaml:"description" validate:"required"` Icon string `json:"icon" yaml:"icon,omitempty" validate:"required,max=128"` Resource PluginResourceRequirement `json:"resource" yaml:"resource,omitempty" validate:"required"` Plugins PluginExtensions `json:"plugins" yaml:"plugins,omitempty" validate:"required"` Meta PluginMeta `json:"meta" yaml:"meta,omitempty" validate:"required"` Tags []manifest_entities.PluginTag `json:"tags" yaml:"tags,omitempty" validate:"omitempty,dive,plugin_tag,max=128"` CreatedAt time.Time `json:"created_at" yaml:"created_at,omitempty" validate:"required"` Privacy *string `json:"privacy,omitempty" yaml:"privacy,omitempty" validate:"omitempty"` Repo *string `json:"repo,omitempty" yaml:"repo,omitempty" validate:"omitempty,url"` }
func (*PluginDeclarationWithoutAdvancedFields) UnmarshalJSON ¶
func (p *PluginDeclarationWithoutAdvancedFields) UnmarshalJSON(data []byte) error
type PluginEventType ¶
type PluginEventType string
const ( PLUGIN_EVENT_LOG PluginEventType = "log" PLUGIN_EVENT_SESSION PluginEventType = "session" PLUGIN_EVENT_ERROR PluginEventType = "error" PLUGIN_EVENT_HEARTBEAT PluginEventType = "heartbeat" )
type PluginExtensions ¶
type PluginExtensions struct { Tools []string `json:"tools" yaml:"tools,omitempty" validate:"omitempty,dive,max=128"` Models []string `json:"models" yaml:"models,omitempty" validate:"omitempty,dive,max=128"` Endpoints []string `json:"endpoints" yaml:"endpoints,omitempty" validate:"omitempty,dive,max=128"` AgentStrategies []string `json:"agent_strategies" yaml:"agent_strategies,omitempty" validate:"omitempty,dive,max=128"` }
type PluginFullDuplexLifetime ¶
type PluginFullDuplexLifetime interface { PluginLifetime // before the plugin starts, it will call this method to initialize the environment InitEnvironment() error // start the plugin, returns errors if the plugin fails to start and hangs until the plugin stops StartPlugin() error // wait for the plugin to stop Wait() (<-chan bool, error) // Cleanup the plugin runtime Cleanup() // set the plugin to active SetActive() // set the plugin to launching SetLaunching() // set the plugin to restarting SetRestarting() // set the plugin to pending SetPending() // set the active time of the plugin SetActiveAt(t time.Time) // set the scheduled time of the plugin SetScheduledAt(t time.Time) // add restarts to the plugin AddRestarts() // Started WaitStarted() <-chan bool // Stopped WaitStopped() <-chan bool }
type PluginLifetime ¶
type PluginLifetime interface { PluginBasicInfoInterface PluginRuntimeSessionIOInterface PluginClusterLifetime }
type PluginLogEvent ¶
type PluginMeta ¶
type PluginMeta struct { Version string `json:"version" yaml:"version" validate:"required,version"` Arch []constants.Arch `json:"arch" yaml:"arch" validate:"required,dive,is_available_arch"` Runner PluginRunner `json:"runner" yaml:"runner" validate:"required"` MinimumDifyVersion *string `json:"minimum_dify_version" yaml:"minimum_dify_version"` }
type PluginPermissionAppRequirement ¶
type PluginPermissionAppRequirement struct {
Enabled bool `json:"enabled" yaml:"enabled"`
}
type PluginPermissionEndpointRequirement ¶
type PluginPermissionEndpointRequirement struct {
Enabled bool `json:"enabled" yaml:"enabled"`
}
type PluginPermissionModelRequirement ¶
type PluginPermissionModelRequirement struct { Enabled bool `json:"enabled" yaml:"enabled"` LLM bool `json:"llm" yaml:"llm"` TextEmbedding bool `json:"text_embedding" yaml:"text_embedding"` Rerank bool `json:"rerank" yaml:"rerank"` TTS bool `json:"tts" yaml:"tts"` Speech2text bool `json:"speech2text" yaml:"speech2text"` Moderation bool `json:"moderation" yaml:"moderation"` }
type PluginPermissionNodeRequirement ¶
type PluginPermissionNodeRequirement struct {
Enabled bool `json:"enabled" yaml:"enabled"`
}
type PluginPermissionRequirement ¶
type PluginPermissionRequirement struct { Tool *PluginPermissionToolRequirement `json:"tool,omitempty" yaml:"tool,omitempty" validate:"omitempty"` Model *PluginPermissionModelRequirement `json:"model,omitempty" yaml:"model,omitempty" validate:"omitempty"` Node *PluginPermissionNodeRequirement `json:"node,omitempty" yaml:"node,omitempty" validate:"omitempty"` Endpoint *PluginPermissionEndpointRequirement `json:"endpoint,omitempty" yaml:"endpoint,omitempty" validate:"omitempty"` App *PluginPermissionAppRequirement `json:"app,omitempty" yaml:"app,omitempty" validate:"omitempty"` Storage *PluginPermissionStorageRequirement `json:"storage,omitempty" yaml:"storage,omitempty" validate:"omitempty"` }
func (*PluginPermissionRequirement) AllowInvokeApp ¶
func (p *PluginPermissionRequirement) AllowInvokeApp() bool
func (*PluginPermissionRequirement) AllowInvokeLLM ¶
func (p *PluginPermissionRequirement) AllowInvokeLLM() bool
func (*PluginPermissionRequirement) AllowInvokeModel ¶
func (p *PluginPermissionRequirement) AllowInvokeModel() bool
func (*PluginPermissionRequirement) AllowInvokeModeration ¶
func (p *PluginPermissionRequirement) AllowInvokeModeration() bool
func (*PluginPermissionRequirement) AllowInvokeNode ¶
func (p *PluginPermissionRequirement) AllowInvokeNode() bool
func (*PluginPermissionRequirement) AllowInvokeRerank ¶
func (p *PluginPermissionRequirement) AllowInvokeRerank() bool
func (*PluginPermissionRequirement) AllowInvokeSpeech2Text ¶
func (p *PluginPermissionRequirement) AllowInvokeSpeech2Text() bool
func (*PluginPermissionRequirement) AllowInvokeStorage ¶
func (p *PluginPermissionRequirement) AllowInvokeStorage() bool
func (*PluginPermissionRequirement) AllowInvokeTTS ¶
func (p *PluginPermissionRequirement) AllowInvokeTTS() bool
func (*PluginPermissionRequirement) AllowInvokeTextEmbedding ¶
func (p *PluginPermissionRequirement) AllowInvokeTextEmbedding() bool
func (*PluginPermissionRequirement) AllowInvokeTool ¶
func (p *PluginPermissionRequirement) AllowInvokeTool() bool
func (*PluginPermissionRequirement) AllowRegisterEndpoint ¶
func (p *PluginPermissionRequirement) AllowRegisterEndpoint() bool
type PluginPermissionToolRequirement ¶
type PluginPermissionToolRequirement struct {
Enabled bool `json:"enabled" yaml:"enabled"`
}
type PluginResourceRequirement ¶
type PluginResourceRequirement struct { // Memory in bytes Memory int64 `json:"memory" yaml:"memory" validate:"required"` // Permission requirements Permission *PluginPermissionRequirement `json:"permission,omitempty" yaml:"permission,omitempty" validate:"omitempty"` }
type PluginRunner ¶
type PluginRuntime ¶
type PluginRuntime struct { State PluginRuntimeState `json:"state"` Config PluginDeclaration `json:"config"` // contains filtered or unexported fields }
func (*PluginRuntime) AddRestarts ¶
func (r *PluginRuntime) AddRestarts()
func (*PluginRuntime) Configuration ¶
func (r *PluginRuntime) Configuration() *PluginDeclaration
func (*PluginRuntime) Error ¶
func (s *PluginRuntime) Error(log string)
func (*PluginRuntime) HashedIdentity ¶
func (r *PluginRuntime) HashedIdentity() (string, error)
func (*PluginRuntime) InitState ¶
func (r *PluginRuntime) InitState()
func (*PluginRuntime) Log ¶
func (s *PluginRuntime) Log(log string)
func (*PluginRuntime) OnStop ¶
func (r *PluginRuntime) OnStop(f func())
func (*PluginRuntime) RuntimeState ¶
func (r *PluginRuntime) RuntimeState() PluginRuntimeState
func (*PluginRuntime) SetActive ¶
func (r *PluginRuntime) SetActive()
func (*PluginRuntime) SetActiveAt ¶
func (r *PluginRuntime) SetActiveAt(t time.Time)
func (*PluginRuntime) SetLaunching ¶
func (r *PluginRuntime) SetLaunching()
func (*PluginRuntime) SetPending ¶
func (r *PluginRuntime) SetPending()
func (*PluginRuntime) SetRestarting ¶
func (r *PluginRuntime) SetRestarting()
func (*PluginRuntime) SetScheduledAt ¶
func (r *PluginRuntime) SetScheduledAt(t time.Time)
func (*PluginRuntime) Stop ¶
func (r *PluginRuntime) Stop()
func (*PluginRuntime) Stopped ¶
func (r *PluginRuntime) Stopped() bool
func (*PluginRuntime) TriggerStop ¶
func (r *PluginRuntime) TriggerStop()
func (*PluginRuntime) UpdateScheduledAt ¶
func (r *PluginRuntime) UpdateScheduledAt(t time.Time)
func (*PluginRuntime) Warn ¶
func (s *PluginRuntime) Warn(log string)
type PluginRuntimeSessionIOInterface ¶
type PluginRuntimeSessionIOInterface interface { PluginBasicInfoInterface // Listen listens for messages from the plugin Listen(session_id string) *entities.Broadcast[SessionMessage] // Write writes a message to the plugin Write(session_id string, action access_types.PluginAccessAction, data []byte) // Log adds a log to the plugin runtime state Log(string) // Warn adds a warning to the plugin runtime state Warn(string) // Error adds an error to the plugin runtime state Error(string) }
type PluginRuntimeState ¶
type PluginRuntimeState struct { Restarts int `json:"restarts"` Status string `json:"status"` WorkingPath string `json:"working_path"` ActiveAt *time.Time `json:"active_at"` StoppedAt *time.Time `json:"stopped_at"` Verified bool `json:"verified"` ScheduledAt *time.Time `json:"scheduled_at"` Logs []string `json:"logs"` }
func (*PluginRuntimeState) Hash ¶
func (s *PluginRuntimeState) Hash() (uint64, error)
type PluginRuntimeType ¶
type PluginRuntimeType string
const ( PLUGIN_RUNTIME_TYPE_LOCAL PluginRuntimeType = "local" PLUGIN_RUNTIME_TYPE_REMOTE PluginRuntimeType = "remote" PLUGIN_RUNTIME_TYPE_SERVERLESS PluginRuntimeType = "serverless" )
type PluginServerlessLifetime ¶
type PluginServerlessLifetime interface { PluginLifetime // before the plugin starts, it will call this method to initialize the environment InitEnvironment() error // UploadPlugin uploads the plugin to the AWS Lambda UploadPlugin() error }
type PluginUniqueIdentifier ¶
type PluginUniqueIdentifier string
func NewPluginUniqueIdentifier ¶
func NewPluginUniqueIdentifier(identifier string) (PluginUniqueIdentifier, error)
func (PluginUniqueIdentifier) Author ¶
func (p PluginUniqueIdentifier) Author() string
func (PluginUniqueIdentifier) Checksum ¶
func (p PluginUniqueIdentifier) Checksum() string
func (PluginUniqueIdentifier) PluginID ¶
func (p PluginUniqueIdentifier) PluginID() string
func (PluginUniqueIdentifier) RemoteLike ¶
func (p PluginUniqueIdentifier) RemoteLike() bool
func (PluginUniqueIdentifier) String ¶
func (p PluginUniqueIdentifier) String() string
func (PluginUniqueIdentifier) Validate ¶
func (p PluginUniqueIdentifier) Validate() error
func (PluginUniqueIdentifier) Version ¶
func (p PluginUniqueIdentifier) Version() manifest_entities.Version
type PluginUniversalEvent ¶
type PluginUniversalEvent struct { SessionId string `json:"session_id"` Event PluginEventType `json:"event"` Data json.RawMessage `json:"data"` }
type ProviderConfig ¶
type ProviderConfig struct { Name string `json:"name" validate:"omitempty,gt=0,lt=1024"` Type ConfigType `json:"type" validate:"required,credential_type"` Scope *string `json:"scope" validate:"omitempty,is_scope"` Required bool `json:"required"` Default any `json:"default" validate:"omitempty,is_basic_type"` Options []ConfigOption `json:"options" validate:"omitempty,lt=128,dive"` Label I18nObject `json:"label" validate:"required"` Help *I18nObject `json:"help" validate:"omitempty"` URL *string `json:"url" validate:"omitempty"` Placeholder *I18nObject `json:"placeholder" validate:"omitempty"` }
type RemoteAssetPayload ¶
type RemotePluginRegisterEventType ¶
type RemotePluginRegisterEventType string
const ( REGISTER_EVENT_TYPE_HAND_SHAKE RemotePluginRegisterEventType = "handshake" REGISTER_EVENT_TYPE_ASSET_CHUNK RemotePluginRegisterEventType = "asset_chunk" REGISTER_EVENT_TYPE_MANIFEST_DECLARATION RemotePluginRegisterEventType = "manifest_declaration" REGISTER_EVENT_TYPE_TOOL_DECLARATION RemotePluginRegisterEventType = "tool_declaration" REGISTER_EVENT_TYPE_MODEL_DECLARATION RemotePluginRegisterEventType = "model_declaration" REGISTER_EVENT_TYPE_ENDPOINT_DECLARATION RemotePluginRegisterEventType = "endpoint_declaration" REGISTER_EVENT_TYPE_AGENT_STRATEGY_DECLARATION RemotePluginRegisterEventType = "agent_strategy_declaration" REGISTER_EVENT_TYPE_END RemotePluginRegisterEventType = "end" )
type RemotePluginRegisterHandshake ¶
type RemotePluginRegisterHandshake struct {
Key string `json:"key" validate:"required"`
}
type RemotePluginRegisterPayload ¶
type RemotePluginRegisterPayload struct { Type RemotePluginRegisterEventType `json:"type" validate:"required"` Data json.RawMessage `json:"data" validate:"required"` }
type SESSION_MESSAGE_TYPE ¶
type SESSION_MESSAGE_TYPE string
const ( SESSION_MESSAGE_TYPE_STREAM SESSION_MESSAGE_TYPE = "stream" SESSION_MESSAGE_TYPE_END SESSION_MESSAGE_TYPE = "end" SESSION_MESSAGE_TYPE_ERROR SESSION_MESSAGE_TYPE = "error" SESSION_MESSAGE_TYPE_INVOKE SESSION_MESSAGE_TYPE = "invoke" )
type SessionMessage ¶
type SessionMessage struct { Type SESSION_MESSAGE_TYPE `json:"type" validate:"required"` Data json.RawMessage `json:"data" validate:"required"` }
type ToolDeclaration ¶
type ToolDeclaration struct { Identity ToolIdentity `json:"identity" yaml:"identity" validate:"required"` Description ToolDescription `json:"description" yaml:"description" validate:"required"` Parameters []ToolParameter `json:"parameters" yaml:"parameters" validate:"omitempty,dive"` OutputSchema ToolOutputSchema `json:"output_schema" yaml:"output_schema" validate:"omitempty,json_schema"` HasRuntimeParameters bool `json:"has_runtime_parameters" yaml:"has_runtime_parameters"` }
type ToolDescription ¶
type ToolDescription struct { Human I18nObject `json:"human" validate:"required"` LLM string `json:"llm" validate:"required"` }
type ToolIdentity ¶
type ToolIdentity struct { Author string `json:"author" yaml:"author" validate:"required"` Name string `json:"name" yaml:"name" validate:"required,tool_identity_name"` Label I18nObject `json:"label" yaml:"label" validate:"required"` }
type ToolOutputSchema ¶
type ToolParameter ¶
type ToolParameter struct { Name string `json:"name" yaml:"name" validate:"required,gt=0,lt=1024"` Label I18nObject `json:"label" yaml:"label" validate:"required"` HumanDescription I18nObject `json:"human_description" yaml:"human_description" validate:"required"` Type ToolParameterType `json:"type" yaml:"type" validate:"required,tool_parameter_type"` Scope *string `json:"scope" yaml:"scope" validate:"omitempty,max=1024,is_scope"` Form ToolParameterForm `json:"form" yaml:"form" validate:"required,tool_parameter_form"` LLMDescription string `json:"llm_description" yaml:"llm_description" validate:"omitempty"` Required bool `json:"required" yaml:"required"` AutoGenerate *ParameterAutoGenerate `json:"auto_generate" yaml:"auto_generate" validate:"omitempty"` Template *ParameterTemplate `json:"template" yaml:"template" validate:"omitempty"` Default any `json:"default" yaml:"default" validate:"omitempty,is_basic_type"` Min *float64 `json:"min" yaml:"min" validate:"omitempty"` Max *float64 `json:"max" yaml:"max" validate:"omitempty"` Precision *int `json:"precision" yaml:"precision" validate:"omitempty"` Options []ToolParameterOption `json:"options" yaml:"options" validate:"omitempty,dive"` }
type ToolParameterForm ¶
type ToolParameterForm string
const ( TOOL_PARAMETER_FORM_SCHEMA ToolParameterForm = "schema" TOOL_PARAMETER_FORM_FORM ToolParameterForm = "form" TOOL_PARAMETER_FORM_LLM ToolParameterForm = "llm" )
type ToolParameterOption ¶
type ToolParameterOption struct { Value string `json:"value" yaml:"value" validate:"required"` Label I18nObject `json:"label" yaml:"label" validate:"required"` }
type ToolParameterType ¶
type ToolParameterType string
const ( TOOL_PARAMETER_TYPE_STRING ToolParameterType = STRING TOOL_PARAMETER_TYPE_NUMBER ToolParameterType = NUMBER TOOL_PARAMETER_TYPE_BOOLEAN ToolParameterType = BOOLEAN TOOL_PARAMETER_TYPE_SELECT ToolParameterType = SELECT TOOL_PARAMETER_TYPE_SECRET_INPUT ToolParameterType = SECRET_INPUT TOOL_PARAMETER_TYPE_FILE ToolParameterType = FILE TOOL_PARAMETER_TYPE_FILES ToolParameterType = FILES TOOL_PARAMETER_TYPE_APP_SELECTOR ToolParameterType = APP_SELECTOR TOOL_PARAMETER_TYPE_MODEL_SELECTOR ToolParameterType = MODEL_SELECTOR // TOOL_PARAMETER_TYPE_TOOL_SELECTOR ToolParameterType = TOOL_SELECTOR TOOL_PARAMETER_TYPE_ANY ToolParameterType = ANY )
type ToolProviderDeclaration ¶
type ToolProviderDeclaration struct { Identity ToolProviderIdentity `json:"identity" yaml:"identity" validate:"required"` CredentialsSchema []ProviderConfig `json:"credentials_schema" yaml:"credentials_schema" validate:"omitempty,dive"` OAuthSchema *OAuthSchema `json:"oauth_schema" yaml:"oauth_schema" validate:"omitempty,dive"` Tools []ToolDeclaration `json:"tools" yaml:"tools" validate:"required,dive"` ToolFiles []string `json:"-" yaml:"-"` }
func UnmarshalToolProviderDeclaration ¶
func UnmarshalToolProviderDeclaration(data []byte) (*ToolProviderDeclaration, error)
func (*ToolProviderDeclaration) MarshalJSON ¶
func (t *ToolProviderDeclaration) MarshalJSON() ([]byte, error)
func (*ToolProviderDeclaration) UnmarshalJSON ¶
func (t *ToolProviderDeclaration) UnmarshalJSON(data []byte) error
func (*ToolProviderDeclaration) UnmarshalYAML ¶
func (t *ToolProviderDeclaration) UnmarshalYAML(value *yaml.Node) error
type ToolProviderIdentity ¶
type ToolProviderIdentity struct { Author string `json:"author" validate:"required"` Name string `json:"name" validate:"required,tool_provider_identity_name"` Description I18nObject `json:"description"` Icon string `json:"icon" validate:"required"` Label I18nObject `json:"label" validate:"required"` Tags []manifest_entities.PluginTag `json:"tags" validate:"omitempty,dive,plugin_tag"` }
type ToolSelectorScope ¶
type ToolSelectorScope string
const ( TOOL_SELECTOR_SCOPE_ALL ToolSelectorScope = "all" TOOL_SELECTOR_SCOPE_PLUGIN ToolSelectorScope = "plugin" TOOL_SELECTOR_SCOPE_API ToolSelectorScope = "api" TOOL_SELECTOR_SCOPE_WORKFLOW ToolSelectorScope = "workflow" )
Click to show internal directories.
Click to hide internal directories.