Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dineshyv committed Dec 16, 2024
1 parent 095ae36 commit 72c2ade
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions llama_stack/apis/tools/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ async def register_tool(
parameters: List[ToolParameter],
returns: ToolReturn,
provider_id: Optional[str] = None,
provider_resource_id: Optional[str] = None,
provider_metadata: Optional[Dict[str, Any]] = None,
tool_prompt_format: Optional[ToolPromptFormat] = None,
) -> Tool:
Expand Down
4 changes: 4 additions & 0 deletions llama_stack/distribution/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from llama_stack.apis.memory import Memory
from llama_stack.apis.safety import Safety
from llama_stack.apis.scoring import Scoring
from llama_stack.apis.tools import Tool, ToolRuntime
from llama_stack.providers.utils.kvstore.config import KVStoreConfig

LLAMA_STACK_BUILD_CONFIG_VERSION = "2"
Expand All @@ -37,6 +38,7 @@
Dataset,
ScoringFn,
EvalTask,
Tool,
]


Expand All @@ -48,6 +50,7 @@
Dataset,
ScoringFn,
EvalTask,
Tool,
],
Field(discriminator="type"),
]
Expand All @@ -59,6 +62,7 @@
DatasetIO,
Scoring,
Eval,
ToolRuntime,
]


Expand Down
5 changes: 5 additions & 0 deletions llama_stack/distribution/routers/routing_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ async def register_tool(
parameters: List[ToolParameter],
returns: ToolReturn,
provider_id: Optional[str] = None,
provider_resource_id: Optional[str] = None,
provider_metadata: Optional[Dict[str, Any]] = None,
tool_prompt_format: Optional[ToolPromptFormat] = None,
) -> None:
Expand All @@ -499,13 +500,17 @@ async def register_tool(
raise ValueError(
"No provider specified and multiple providers available. Please specify a provider_id."
)
if provider_resource_id is None:
provider_resource_id = tool_id

tool = Tool(
identifier=tool_id,
name=name,
description=description,
parameters=parameters,
returns=returns,
provider_id=provider_id,
provider_resource_id=provider_resource_id,
provider_metadata=provider_metadata,
tool_prompt_format=tool_prompt_format,
)
Expand Down

0 comments on commit 72c2ade

Please sign in to comment.