- internal/plugin: Plugin/IoTProvider/ToolProvider/RAGProvider interfaces - internal/plugin: Registry with type-safe auto-detection, 11 tests - plugins/iot-mock: 8 simulated smart home devices, 11 tests - 63 total tests, build + vet clean
28 lines
874 B
Go
28 lines
874 B
Go
package plugin
|
|
|
|
import "context"
|
|
|
|
// ToolProvider is implemented by plugins that provide LLM-callable tools.
|
|
// Multiple ToolProviders can be active simultaneously.
|
|
type ToolProvider interface {
|
|
Plugin
|
|
|
|
// Tools returns the list of tool definitions this plugin provides.
|
|
Tools() []ToolDefinition
|
|
|
|
// Execute invokes a tool by name with the given parameters.
|
|
// Returns the result string or an error.
|
|
Execute(ctx context.Context, toolName string, params map[string]any) (string, error)
|
|
}
|
|
|
|
// RAGProvider is implemented by plugins that provide RAG (Retrieval-Augmented Generation).
|
|
type RAGProvider interface {
|
|
Plugin
|
|
|
|
// Ingest adds documents to the knowledge base.
|
|
Ingest(ctx context.Context, docs []RAGDocument) error
|
|
|
|
// Search performs a semantic search over the knowledge base.
|
|
Search(ctx context.Context, query string, topK int) ([]RAGSearchResult, error)
|
|
}
|