feat(plugin): add plugin interface system and iot-mock implementation
- 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
This commit is contained in:
1 parent
7943e290ec
commit
750d594055
8 files changed
+1109
No files matched your search
@@ -0,0 +1,27 @@
|
||||
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)
|
||||
}
|
||||
Reference in new issue
Block a user