init. project
This commit is contained in:
19
rag-web-ui/backend/app/tools/registry.py
Normal file
19
rag-web-ui/backend/app/tools/registry.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from typing import Dict, List
|
||||
|
||||
from app.tools.base import ToolDefinition
|
||||
|
||||
|
||||
class ToolRegistry:
|
||||
_tools: Dict[str, ToolDefinition] = {}
|
||||
|
||||
@classmethod
|
||||
def register(cls, definition: ToolDefinition) -> None:
|
||||
cls._tools[definition.name] = definition
|
||||
|
||||
@classmethod
|
||||
def get(cls, name: str) -> ToolDefinition:
|
||||
return cls._tools[name]
|
||||
|
||||
@classmethod
|
||||
def list(cls) -> List[ToolDefinition]:
|
||||
return list(cls._tools.values())
|
||||
Reference in New Issue
Block a user