Initial commit: add .gitignore and README
This commit is contained in:
5
fusionagi/tools/connectors/__init__.py
Normal file
5
fusionagi/tools/connectors/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from fusionagi.tools.connectors.base import BaseConnector
|
||||
from fusionagi.tools.connectors.docs import DocsConnector
|
||||
from fusionagi.tools.connectors.db import DBConnector
|
||||
from fusionagi.tools.connectors.code_runner import CodeRunnerConnector
|
||||
__all__ = ["BaseConnector", "DocsConnector", "DBConnector", "CodeRunnerConnector"]
|
||||
9
fusionagi/tools/connectors/base.py
Normal file
9
fusionagi/tools/connectors/base.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Any
|
||||
|
||||
class BaseConnector(ABC):
|
||||
name = "base"
|
||||
@abstractmethod
|
||||
def invoke(self, action: str, params: dict) -> Any: ...
|
||||
def schema(self) -> dict:
|
||||
return {"name": self.name, "actions": [], "parameters": {}}
|
||||
20
fusionagi/tools/connectors/code_runner.py
Normal file
20
fusionagi/tools/connectors/code_runner.py
Normal file
@@ -0,0 +1,20 @@
|
||||
"""Code runner connector: run code in sandbox (stub; extend with safe executor)."""
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fusionagi.tools.connectors.base import BaseConnector
|
||||
|
||||
|
||||
class CodeRunnerConnector(BaseConnector):
|
||||
name = "code_runner"
|
||||
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
def invoke(self, action: str, params: dict[str, Any]) -> Any:
|
||||
if action == "run":
|
||||
return {"stdout": "", "stderr": "", "error": "CodeRunnerConnector stub: implement run"}
|
||||
return {"error": f"Unknown action: {action}"}
|
||||
|
||||
def schema(self) -> dict[str, Any]:
|
||||
return {"name": self.name, "actions": ["run"], "parameters": {"code": "string", "language": "string"}}
|
||||
20
fusionagi/tools/connectors/db.py
Normal file
20
fusionagi/tools/connectors/db.py
Normal file
@@ -0,0 +1,20 @@
|
||||
"""DB connector: query database (stub; extend with SQL driver)."""
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fusionagi.tools.connectors.base import BaseConnector
|
||||
|
||||
|
||||
class DBConnector(BaseConnector):
|
||||
name = "db"
|
||||
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
def invoke(self, action: str, params: dict[str, Any]) -> Any:
|
||||
if action == "query":
|
||||
return {"rows": [], "error": "DBConnector stub: implement query"}
|
||||
return {"error": f"Unknown action: {action}"}
|
||||
|
||||
def schema(self) -> dict[str, Any]:
|
||||
return {"name": self.name, "actions": ["query"], "parameters": {"query": "string"}}
|
||||
21
fusionagi/tools/connectors/docs.py
Normal file
21
fusionagi/tools/connectors/docs.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""Docs connector: read documents (stub; extend with PDF/Office)."""
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fusionagi.tools.connectors.base import BaseConnector
|
||||
|
||||
|
||||
class DocsConnector(BaseConnector):
|
||||
name = "docs"
|
||||
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
def invoke(self, action: str, params: dict[str, Any]) -> Any:
|
||||
if action == "read":
|
||||
path = params.get("path", "")
|
||||
return {"content": "", "path": path, "error": "DocsConnector stub: implement read"}
|
||||
return {"error": f"Unknown action: {action}"}
|
||||
|
||||
def schema(self) -> dict[str, Any]:
|
||||
return {"name": self.name, "actions": ["read"], "parameters": {"path": "string"}}
|
||||
Reference in New Issue
Block a user