Documentation
¶
Index ¶
- Variables
- func FeatureSorter[A FeatureAttributes, F Feature[A]](a F, b F) int
- type BasicFeatureAttributes
- type BasicInferenceAttributes
- type BasicInferenceProvider
- type BasicToolsAttributes
- type BasicToolsProvider
- type Feature
- type FeatureAttributes
- type InferenceAttributes
- type InferenceParameters
- type InferencePolicies
- type InferencePropertyPolicies
- type InferenceProvider
- type InferenceProviderPolicies
- type IsFeatureEnabled
- type MCPConfig
- type McpSettings
- type McpType
- type Message
- type MessageType
- type Policies
- type PoliciesProvider
- type Tool
- type ToolParameter
- type ToolParameterType
- type ToolsAttributes
- type ToolsParameters
- type ToolsPolicies
- type ToolsProvider
- type ToolsProviderPolicies
Constants ¶
This section is empty.
Variables ¶
var McpTypes = [...]string{
"stdio",
"sse",
"http",
}
Functions ¶
func FeatureSorter ¶ added in v0.0.9
func FeatureSorter[A FeatureAttributes, F Feature[A]](a F, b F) int
Types ¶
type BasicFeatureAttributes ¶ added in v0.0.9
type BasicFeatureAttributes struct { FeatureAttributes `json:"-"` FeatureName string `json:"name"` FeatureDescription string `json:"description"` }
func (*BasicFeatureAttributes) Description ¶ added in v0.0.9
func (a *BasicFeatureAttributes) Description() string
func (*BasicFeatureAttributes) Name ¶ added in v0.0.9
func (a *BasicFeatureAttributes) Name() string
type BasicInferenceAttributes ¶ added in v0.0.9
type BasicInferenceAttributes struct { BasicFeatureAttributes LocalAttr bool `json:"local"` PublicAttr bool `json:"public"` }
func (*BasicInferenceAttributes) Local ¶ added in v0.0.9
func (a *BasicInferenceAttributes) Local() bool
func (*BasicInferenceAttributes) Public ¶ added in v0.0.9
func (a *BasicInferenceAttributes) Public() bool
type BasicInferenceProvider ¶ added in v0.0.9
type BasicInferenceProvider struct { InferenceProvider `json:"-"` BasicInferenceAttributes Available bool `json:"-"` IsAvailableReason string `json:"reason"` ProviderModels []string `json:"models"` InferenceParameters }
func (*BasicInferenceProvider) Attributes ¶ added in v0.0.9
func (p *BasicInferenceProvider) Attributes() InferenceAttributes
func (*BasicInferenceProvider) IsAvailable ¶ added in v0.0.9
func (p *BasicInferenceProvider) IsAvailable() bool
func (*BasicInferenceProvider) Models ¶ added in v0.0.9
func (p *BasicInferenceProvider) Models() []string
func (*BasicInferenceProvider) Reason ¶ added in v0.0.9
func (p *BasicInferenceProvider) Reason() string
func (*BasicInferenceProvider) SystemPrompt ¶ added in v0.0.12
func (p *BasicInferenceProvider) SystemPrompt() string
type BasicToolsAttributes ¶ added in v0.0.9
type BasicToolsAttributes struct {
BasicFeatureAttributes
}
type BasicToolsProvider ¶ added in v0.0.9
type BasicToolsProvider struct { ToolsProvider `json:"-"` BasicToolsAttributes Available bool `json:"-"` IsAvailableReason string `json:"reason"` McpSettings *McpSettings `json:"mcp_settings,omitempty"` ToolsParameters }
func (*BasicToolsProvider) Attributes ¶ added in v0.0.9
func (p *BasicToolsProvider) Attributes() ToolsAttributes
func (*BasicToolsProvider) GetMcpSettings ¶ added in v0.0.9
func (p *BasicToolsProvider) GetMcpSettings() *McpSettings
func (*BasicToolsProvider) GetTools ¶ added in v0.0.15
func (p *BasicToolsProvider) GetTools(_ context.Context) []*Tool
func (*BasicToolsProvider) IsAvailable ¶ added in v0.0.9
func (p *BasicToolsProvider) IsAvailable() bool
func (*BasicToolsProvider) Reason ¶ added in v0.0.9
func (p *BasicToolsProvider) Reason() string
type Feature ¶ added in v0.0.9
type Feature[a FeatureAttributes] interface { Attributes() a // Initialize Performs the discovery and initialization of the feature based on the user configuration and policies // Populates the internal state of the feature and its availability Initialize(ctx context.Context) // IsAvailable Returns true if the feature is available IsAvailable() bool // Reason provides the reason why the feature is or is not available Reason() string }
type FeatureAttributes ¶ added in v0.0.9
type InferenceAttributes ¶ added in v0.0.9
type InferenceAttributes interface { FeatureAttributes // Local indicates if the inference provider is a local service Local() bool // Public indicates if the inference provider is public (e.g. OpenAI, Gemini) or private (e.g. Enterprise internal) Public() bool }
type InferenceParameters ¶ added in v0.0.12
type InferencePolicies ¶ added in v0.0.12
type InferencePolicies struct { // inference providers by property Property InferencePropertyPolicies `toml:"property,omitempty"` // inference providers by name Provider map[string]InferenceProviderPolicies `toml:"provider,omitempty"` // policies for all inference providers InferenceProviderPolicies }
type InferencePropertyPolicies ¶ added in v0.0.12
type InferencePropertyPolicies struct { Remote InferenceProviderPolicies `toml:"remote,omitempty"` Public InferenceProviderPolicies `toml:"public,omitempty"` }
type InferenceProvider ¶ added in v0.0.9
type InferenceProvider interface { Feature[InferenceAttributes] GetInference(ctx context.Context) (model.ToolCallingChatModel, error) // Models returns the list of supported models by the inference provider Models() []string SystemPrompt() string }
type InferenceProviderPolicies ¶ added in v0.0.12
type InferenceProviderPolicies struct {
Enabled *bool `toml:"enabled,omitempty"`
}
InferenceProviderPolicies struct to define policies for inference providers
Inference policies can be defined at different levels (highest priority first): by a provider name, by a provider property, or globally Policies are pointers, this means that if a policy is not set at a specific level, the value at a lower level is used If the policy is not set in any of these levels, a default value, defined in the policy package, is used
type IsFeatureEnabled ¶ added in v0.0.12
type IsFeatureEnabled[a FeatureAttributes] func(feature Feature[a]) bool
type MCPConfig ¶ added in v0.0.9
type MCPConfig interface { // GetFile returns the path to the MCP config file GetFile() string // GetConfig returns the MCP config for the given tools in format expected by the editor GetConfig(tools []ToolsProvider) ([]byte, error) }
MCPConfig is the interface for MCP config providers (editors supporintg MCP servers configured in a file)
type McpSettings ¶ added in v0.0.9
type McpSettings struct { Type McpType `json:"type"` // Type of MCP (STDIO, SSE, or HTTP) Command string `json:"command,omitempty"` // Command to run for STDIO type Args []string `json:"args,omitempty"` // Arguments for the command (STDIO) Env []string `json:"env,omitempty"` // Environment variables for the command (STDIO) Url string `json:"url,omitempty"` // URL for SSE or HTTP type Headers map[string]string `json:"headers,omitempty"` // Headers for HTTP requests (SSE or HTTP) }
type McpType ¶ added in v0.0.9
type McpType int
func (*McpType) MarshalJSON ¶ added in v0.0.9
func (*McpType) UnmarshalJSON ¶ added in v0.0.9
type Message ¶
type Message struct { Type MessageType Text string // ToolMessage specific fields ToolName string }
func NewAssistantMessage ¶
func NewErrorMessage ¶
func NewSystemMessage ¶
func NewToolMessage ¶
func NewUserMessage ¶
type MessageType ¶
type MessageType string
const ( MessageTypeSystem MessageType = "system" MessageTypeUser MessageType = "user" MessageTypeAssistant MessageType = "assistant" MessageTypeTool MessageType = "tool" MessageTypeError MessageType = "error" )
type Policies ¶ added in v0.0.12
type Policies struct { Inferences InferencePolicies `toml:"inferences,omitempty"` Tools ToolsPolicies `toml:"tools,omitempty"` }
type PoliciesProvider ¶ added in v0.0.12
type ToolParameter ¶ added in v0.0.9
type ToolParameter struct { Type ToolParameterType Description string Required bool }
type ToolParameterType ¶ added in v0.0.9
type ToolParameterType string
const (
String ToolParameterType = "string"
)
type ToolsAttributes ¶ added in v0.0.9
type ToolsAttributes interface { FeatureAttributes }
type ToolsParameters ¶ added in v0.0.12
type ToolsParameters struct { Enabled *bool `json:"-" toml:"enabled"` ReadOnly *bool `json:"-" toml:"read-only"` DisableDestructive *bool `json:"-" toml:"disable-destructive"` }
ToolsParameters parameters for a tool TODO: maybe shareable by policies
type ToolsPolicies ¶ added in v0.0.12
type ToolsPolicies struct { // tools providers by name Provider map[string]ToolsProviderPolicies `toml:"provider,omitempty"` // policies for all tools providers ToolsProviderPolicies }
type ToolsProvider ¶ added in v0.0.9
type ToolsProvider interface { Feature[ToolsAttributes] // GetMcpSettings returns the MCP settings if the provider uses an MCP server, or nil otherwise GetMcpSettings() *McpSettings // GetTools returns the list of built-in, native, available tools GetTools(ctx context.Context) []*Tool }
type ToolsProviderPolicies ¶ added in v0.0.12
type ToolsProviderPolicies struct { Enabled *bool `toml:"enabled,omitempty"` ReadOnly *bool `toml:"read-only,omitempty"` NonDestructive *bool `toml:"non-destructive,omitempty"` // Local indicates if the tool cannot connect to a remote MCP server Local *bool `toml:"local,omitempty"` }
ToolsProviderPolicies struct to define policies for tools providers
Tools policies can be defined at different levels (highest priority first): by a provider name, or globally Policies are pointers, this means that if a policy is not set at a specific level, the value at a lower level is used If the policy is not set in any of these levels, a default value, defined in the policy package, is used