mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
feat: Add metadata field to ADK BaseTool
PiperOrigin-RevId: 791790030
This commit is contained in:
committed by
Copybara-Service
parent
e73d71d324
commit
54cc849de7
@@ -71,6 +71,7 @@ class Runner:
|
|||||||
plugin_manager: The plugin manager for the runner.
|
plugin_manager: The plugin manager for the runner.
|
||||||
session_service: The session service for the runner.
|
session_service: The session service for the runner.
|
||||||
memory_service: The memory service for the runner.
|
memory_service: The memory service for the runner.
|
||||||
|
credential_service: The credential service for the runner.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
app_name: str
|
app_name: str
|
||||||
@@ -104,9 +105,11 @@ class Runner:
|
|||||||
Args:
|
Args:
|
||||||
app_name: The application name of the runner.
|
app_name: The application name of the runner.
|
||||||
agent: The root agent to run.
|
agent: The root agent to run.
|
||||||
|
plugins: A list of plugins for the runner.
|
||||||
artifact_service: The artifact service for the runner.
|
artifact_service: The artifact service for the runner.
|
||||||
session_service: The session service for the runner.
|
session_service: The session service for the runner.
|
||||||
memory_service: The memory service for the runner.
|
memory_service: The memory service for the runner.
|
||||||
|
credential_service: The credential service for the runner.
|
||||||
"""
|
"""
|
||||||
self.app_name = app_name
|
self.app_name = app_name
|
||||||
self.agent = agent
|
self.agent = agent
|
||||||
|
|||||||
@@ -56,10 +56,27 @@ class BaseTool(ABC):
|
|||||||
"""Whether the tool is a long running operation, which typically returns a
|
"""Whether the tool is a long running operation, which typically returns a
|
||||||
resource id first and finishes the operation later."""
|
resource id first and finishes the operation later."""
|
||||||
|
|
||||||
def __init__(self, *, name, description, is_long_running: bool = False):
|
custom_metadata: Optional[dict[str, Any]] = None
|
||||||
|
"""The custom metadata of the BaseTool.
|
||||||
|
|
||||||
|
An optional key-value pair for storing and retrieving tool-specific metadata,
|
||||||
|
such as tool manifests, etc.
|
||||||
|
|
||||||
|
NOTE: the entire dict must be JSON serializable.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
is_long_running: bool = False,
|
||||||
|
custom_metadata: Optional[dict[str, Any]] = None,
|
||||||
|
):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.description = description
|
self.description = description
|
||||||
self.is_long_running = is_long_running
|
self.is_long_running = is_long_running
|
||||||
|
self.custom_metadata = custom_metadata
|
||||||
|
|
||||||
def _get_declaration(self) -> Optional[types.FunctionDeclaration]:
|
def _get_declaration(self) -> Optional[types.FunctionDeclaration]:
|
||||||
"""Gets the OpenAPI specification of this tool in the form of a FunctionDeclaration.
|
"""Gets the OpenAPI specification of this tool in the form of a FunctionDeclaration.
|
||||||
|
|||||||
Reference in New Issue
Block a user