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 InferenceProvider
- type MCPConfig
- type McpSettings
- type McpType
- type Message
- type MessageType
- type Tool
- type ToolParameter
- type ToolParameterType
- type ToolsAttributes
- type ToolsProvider
Constants ¶
This section is empty.
Variables ¶
View Source
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"`
}
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
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"`
}
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) 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 // TODO: Policies should not be treated in a per-feature way but rather in a global way // TODO: for each feature proider (inferences, tools, etc.) this should be handled in the Initialize function Initialize(ctx context.Context, policies any) // IsAvailable Returns true if the feature is available IsAvailable() bool // Reason provides the reason why the feature is or is not available Reason() string GetDefaultPolicies() map[string]any }
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 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
}
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 Tool ¶ added in v0.0.9
type Tool struct {
Name string
Description string
// Parameters in JSONSchema format
JSONSchema *jsonschema.Schema
// Parameters in map format (if ParametersSchema is not set)
Parameters map[string]ToolParameter
Function func(args map[string]interface{}) (string, error)
}
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 ToolsProvider ¶ added in v0.0.9
type ToolsProvider interface {
Feature[ToolsAttributes]
GetTools(ctx context.Context) ([]*Tool, error)
GetMcpSettings() *McpSettings
}
Click to show internal directories.
Click to hide internal directories.