add tools api with a stub provider impl

This commit is contained in:
Dinesh Yeduguru 2024-12-13 12:09:12 -08:00
parent 3b4b2ea30c
commit 72dab3e4bf
14 changed files with 310 additions and 1 deletions

View file

@ -0,0 +1,14 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
from .config import MetaReferenceToolRuntimeConfig
from .meta_reference import MetaReferenceToolRuntimeImpl
async def get_provider_impl(config: MetaReferenceToolRuntimeConfig, _deps):
impl = MetaReferenceToolRuntimeImpl(config)
await impl.initialize()
return impl

View file

@ -0,0 +1,11 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
from pydantic import BaseModel
class MetaReferenceToolRuntimeConfig(BaseModel):
pass

View file

@ -0,0 +1,30 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
from typing import Any, Dict
from llama_stack.apis.tools import InvokeToolResult, Tool, ToolRuntime
from llama_stack.providers.datatypes import ToolsProtocolPrivate
from .config import MetaReferenceToolRuntimeConfig
class MetaReferenceToolRuntimeImpl(ToolsProtocolPrivate, ToolRuntime):
def __init__(self, config: MetaReferenceToolRuntimeConfig):
self.config = config
async def initialize(self):
pass
async def register_tool(self, tool: Tool):
print(f"registering tool {tool.identifier}")
pass
async def unregister_tool(self, tool_id: str) -> None:
pass
async def invoke_tool(self, tool_id: str, args: Dict[str, Any]) -> InvokeToolResult:
pass