add tools api with a stub provider impl

This commit is contained in:
Dinesh Yeduguru 2024-12-16 12:42:37 -08:00
parent e65a6fac9d
commit e5ac10f803
14 changed files with 172 additions and 37 deletions

View file

@ -15,6 +15,7 @@ from llama_stack.apis.safety import * # noqa: F403
from llama_stack.apis.datasetio import * # noqa: F403
from llama_stack.apis.scoring import * # noqa: F403
from llama_stack.apis.eval import * # noqa: F403
from llama_stack.apis.tools import * # noqa: F403
class MemoryRouter(Memory):
@ -372,3 +373,23 @@ class EvalRouter(Eval):
task_id,
job_id,
)
class ToolRuntimeRouter(ToolRuntime):
def __init__(
self,
routing_table: RoutingTable,
) -> None:
self.routing_table = routing_table
async def initialize(self) -> None:
pass
async def shutdown(self) -> None:
pass
async def invoke_tool(self, tool_id: str, args: Dict[str, Any]) -> Any:
return await self.routing_table.get_provider_impl(tool_id).invoke_tool(
tool_id=tool_id,
args=args,
)