Maps provider-defined tools' custom names to their provider names and back; other names map to themselves.
Attributes#
| Attribute | Type | Description |
|---|---|---|
custom_names | tuple[str, ...] | |
provider_names | tuple[str, ...] |
Functions#
__init__#
__init__(tools) -> None| Parameter | Type | Description |
|---|---|---|
tools | Sequence[AnyTool] |
def __init__(self, tools: Sequence[AnyTool]) -> None:
self._to_provider: dict[str, str] = {}
self._to_custom: dict[str, str] = {}
for tool in tools:
if isinstance(tool, ProviderDefined):
self._to_provider[tool.name] = tool.provider_name
self._to_custom[tool.provider_name] = tool.nameget_custom_name#
get_custom_name(provider_name) -> str| Parameter | Type | Description |
|---|---|---|
provider_name | str |
Returns str
def get_custom_name(self, provider_name: str) -> str:
return self._to_custom.get(provider_name, provider_name)get_provider_name#
get_provider_name(custom_name) -> str| Parameter | Type | Description |
|---|---|---|
custom_name | str |
Returns str
def get_provider_name(self, custom_name: str) -> str:
return self._to_provider.get(custom_name, custom_name)