Tools
Export tool.
ToolsExporter ¶
ToolsExporter(
flow_name: str,
agents: list[WaldiezAgent],
agent_names: dict[str, str],
tools: list[WaldiezTool],
tool_names: dict[str, str],
output_dir: Optional[Union[str, Path]] = None,
context: Optional[ExporterContext] = None,
**kwargs: Any
)
Bases: Exporter[ToolExtras]
Rools exporter with structured extras.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flow_name | str | The name of the flow. | required |
agents | list[WaldiezAgent] | The agents that use tools. | required |
agent_names | dict[str, str] | Mapping of agent IDs to names. | required |
tools | list[WaldiezTool] | The tools to export. | required |
tool_names | dict[str, str] | Mapping of tool IDs to names. | required |
output_dir | Optional[Union[str, Path]] | Output directory for generated files, by default None | None |
context | Optional[ExporterContext] | Exporter context with dependencies, by default None | None |
**kwargs | Any | Additional keyword arguments. | {} |
Source code in waldiez/exporting/tools/exporter.py
generate_main_content ¶
get_tool_secrets_loader_script ¶
Get the tool secrets loader script.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tool_name | str | The name of the tool for which to generate the loader script. | required |
Returns:
Type | Description |
---|---|
str | The tool secrets loader script. |
Source code in waldiez/exporting/tools/exporter.py
create_tools_exporter ¶
create_tools_exporter(
flow_name: str,
agents: list[WaldiezAgent],
agent_names: dict[str, str],
tools: list[WaldiezTool],
tool_names: dict[str, str],
output_dir: Optional[Union[str, Path]] = None,
context: Optional[ExporterContext] = None,
) -> ToolsExporter
Create a tools exporter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flow_name | str | The name of the flow. | required |
agents | list[WaldiezAgent] | The agents that use tools. | required |
agent_names | dict[str, str] | Mapping of agent IDs to names. | required |
tools | list[WaldiezTool] | The tools to export. | required |
tool_names | dict[str, str] | Mapping of tool IDs to names. | required |
output_dir | Optional[Union[str, Path]] | Output directory for generated files, by default None | None |
context | Optional[ExporterContext] | Exporter context with dependencies, by default None | None |
Returns:
Type | Description |
---|---|
ToolsExporter | The created tools exporter. |
Source code in waldiez/exporting/tools/factory.py
exporter ¶
Tools exporter.
ToolsExporter ¶
ToolsExporter(
flow_name: str,
agents: list[WaldiezAgent],
agent_names: dict[str, str],
tools: list[WaldiezTool],
tool_names: dict[str, str],
output_dir: Optional[Union[str, Path]] = None,
context: Optional[ExporterContext] = None,
**kwargs: Any
)
Bases: Exporter[ToolExtras]
Rools exporter with structured extras.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flow_name | str | The name of the flow. | required |
agents | list[WaldiezAgent] | The agents that use tools. | required |
agent_names | dict[str, str] | Mapping of agent IDs to names. | required |
tools | list[WaldiezTool] | The tools to export. | required |
tool_names | dict[str, str] | Mapping of tool IDs to names. | required |
output_dir | Optional[Union[str, Path]] | Output directory for generated files, by default None | None |
context | Optional[ExporterContext] | Exporter context with dependencies, by default None | None |
**kwargs | Any | Additional keyword arguments. | {} |
Source code in waldiez/exporting/tools/exporter.py
generate_main_content ¶
get_tool_secrets_loader_script ¶
Get the tool secrets loader script.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tool_name | str | The name of the tool for which to generate the loader script. | required |
Returns:
Type | Description |
---|---|
str | The tool secrets loader script. |
Source code in waldiez/exporting/tools/exporter.py
factory ¶
Factory function for creating a ToolsExporter instance.
create_tools_exporter ¶
create_tools_exporter(
flow_name: str,
agents: list[WaldiezAgent],
agent_names: dict[str, str],
tools: list[WaldiezTool],
tool_names: dict[str, str],
output_dir: Optional[Union[str, Path]] = None,
context: Optional[ExporterContext] = None,
) -> ToolsExporter
Create a tools exporter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flow_name | str | The name of the flow. | required |
agents | list[WaldiezAgent] | The agents that use tools. | required |
agent_names | dict[str, str] | Mapping of agent IDs to names. | required |
tools | list[WaldiezTool] | The tools to export. | required |
tool_names | dict[str, str] | Mapping of tool IDs to names. | required |
output_dir | Optional[Union[str, Path]] | Output directory for generated files, by default None | None |
context | Optional[ExporterContext] | Exporter context with dependencies, by default None | None |
Returns:
Type | Description |
---|---|
ToolsExporter | The created tools exporter. |
Source code in waldiez/exporting/tools/factory.py
processor ¶
Tool related utilities and processors.
ToolProcessingResult dataclass
¶
ToolProcessingResult(
content: str = "",
builtin_imports: list[str] = list[str](),
third_party_imports: list[str] = list[str](),
environment_variables: list[EnvironmentVariable] = list[
EnvironmentVariable
](),
)
Result from processing tools.
ToolProcessor ¶
ToolProcessor(
flow_name: str,
tools: list[WaldiezTool],
tool_names: dict[str, str],
output_dir: Optional[Path] = None,
)
Processor for tool content generation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flow_name | str | The name of the flow. | required |
tools | list[WaldiezTool] | The tools to process. | required |
tool_names | dict[str, str] | Mapping of tool IDs to names. | required |
output_dir | Optional[Path] | Output directory for generated files, by default None | None |
Source code in waldiez/exporting/tools/processor.py
process ¶
process() -> ToolProcessingResult
Process all tools and return consolidated result.
Returns:
Type | Description |
---|---|
ToolProcessingResult | The processed result containing tool content, imports, and environment variables. |
Source code in waldiez/exporting/tools/processor.py
registration ¶
Tool registration processor.
ToolRegistrationProcessor ¶
ToolRegistrationProcessor(
agents: list[WaldiezAgent],
agent_names: dict[str, str],
tools: list[WaldiezTool],
tool_names: dict[str, str],
)
Processor for tool registration code.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agents | list[WaldiezAgent] | The agents that use tools. | required |
agent_names | dict[str, str] | Mapping of agent IDs to names. | required |
tools | list[WaldiezTool] | The available tools. | required |
tool_names | dict[str, str] | Mapping of tool IDs to names. | required |
Source code in waldiez/exporting/tools/registration.py
process ¶
process() -> str
Process tool registrations for all agents.
Returns:
Type | Description |
---|---|
str | The generated tool registration code for all agents. |