Documentation
¶
Index ¶
- Variables
- func FeatureSorter[A FeatureAttributes, F Feature[A]](a F, b F) int
- type Ai
- type BasicFeatureAttributes
- type BasicInferenceAttributes
- type BasicInferenceProvider
- func (p *BasicInferenceProvider) Attributes() InferenceAttributes
- func (p *BasicInferenceProvider) Clear(ctx context.Context) (done bool, err error)
- func (p *BasicInferenceProvider) GetModel(ctx context.Context) (string, error)
- func (a *BasicInferenceProvider) InstallHelp() error
- func (p *BasicInferenceProvider) IsAvailable() bool
- func (p *BasicInferenceProvider) Models() []string
- func (p *BasicInferenceProvider) Reason() string
- func (p *BasicInferenceProvider) SystemPrompt() string
- type BasicToolsAttributes
- type BasicToolsProvider
- func (p *BasicToolsProvider) Attributes() ToolsAttributes
- func (p *BasicToolsProvider) Clear(ctx context.Context) (done bool, err error)
- func (p *BasicToolsProvider) GetMcpSettings() *McpSettings
- func (p *BasicToolsProvider) GetTools(_ context.Context) []*Tool
- func (p *BasicToolsProvider) InstallHelp() error
- func (p *BasicToolsProvider) IsAvailable() bool
- func (p *BasicToolsProvider) Reason() string
- 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 Session
- 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 Ai ¶ added in v0.0.17
type Ai interface {
InferenceAttributes() InferenceAttributes
ToolEnabledCount() int
ToolCount() int
Reset()
Session() Session
Input() chan Message
}
type BasicFeatureAttributes ¶ added in v0.0.9
type BasicFeatureAttributes struct {
FeatureAttributes `json:"-"`
FeatureName string `json:"name"`
FeatureDescription string `json:"description"`
SupportsSetupAttr bool `json:"-"`
}
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
func (*BasicFeatureAttributes) SupportsSetup ¶ added in v0.0.17
func (a *BasicFeatureAttributes) SupportsSetup() bool
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) Clear ¶ added in v0.0.17
func (p *BasicInferenceProvider) Clear(ctx context.Context) (done bool, err error)
func (*BasicInferenceProvider) GetModel ¶ added in v0.0.17
func (p *BasicInferenceProvider) GetModel(ctx context.Context) (string, error)
func (*BasicInferenceProvider) InstallHelp ¶ added in v0.0.17
func (a *BasicInferenceProvider) InstallHelp() error
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.10
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) Clear ¶ added in v0.0.17
func (p *BasicToolsProvider) Clear(ctx context.Context) (done bool, err error)
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) InstallHelp ¶ added in v0.0.17
func (p *BasicToolsProvider) InstallHelp() error
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.11
type InferencePolicies ¶ added in v0.0.10
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.10
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)
GetModel(ctx context.Context) (string, error)
// Models returns the list of supported models by the inference provider
Models() []string
SystemPrompt() string
InstallHelp() error
Clear(ctx context.Context) (bool, error)
}
type InferenceProviderPolicies ¶ added in v0.0.10
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.11
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.10
type Policies struct {
Inferences InferencePolicies `toml:"inferences,omitempty"`
Tools ToolsPolicies `toml:"tools,omitempty"`
}
type PoliciesProvider ¶ added in v0.0.10
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.10
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.10
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
InstallHelp() error
Clear(ctx context.Context) (bool, error)
}
type ToolsProviderPolicies ¶ added in v0.0.10
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