Tool
Waldiez Tool model.
WaldiezTool ¶
Bases: WaldiezBase
Waldiez Tool.
Attributes:
Name | Type | Description |
---|---|---|
id | str | The ID of the tool. |
type | Literal['tool'] | The type of the "node" in a graph: "tool". |
name | str | The name of the tool. |
description | str | The description of the tool. |
tags | list[str] | The tags of the tool. |
requirements | list[str] | The requirements of the tool. |
created_at | str | The date and time when the tool was created. |
updated_at | str | The date and time when the tool was last updated. |
data | WaldiezToolData | The data of the tool. See |
get_content ¶
get_content() -> str
Get the content of the tool.
Returns:
Type | Description |
---|---|
str | The content of the tool. |
Source code in waldiez/models/tool/tool.py
get_imports ¶
is_interop property
¶
is_interop: bool
Check if the tool is interoperability.
Returns:
Type | Description |
---|---|
bool | True if the tool is interoperability, False otherwise. |
load staticmethod
¶
Load a tool from a read-only file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_or_path | Union[str, Path, dict[str, Any]] | The path to the read-only file or the loaded data. | required |
Returns:
Type | Description |
---|---|
WaldiezTool | The tool. |
Raises:
Type | Description |
---|---|
FileNotFoundError | If the file is not found. |
ValueError | If the JSON is invalid or the data is invalid. |
Source code in waldiez/models/tool/tool.py
tool_type property
¶
tool_type: WaldiezToolType
Get the tool type.
Returns:
Type | Description |
---|---|
WaldiezToolType | The type of the tool: [shared, custom, langchain, crewai]. |
validate_data ¶
validate_data() -> Self
Validate the data.
Returns:
Type | Description |
---|---|
WaldiezTool | The tool. |
Raises:
Type | Description |
---|---|
ValueError | If the tool name is not in the content. If the tool content is invalid. |
Source code in waldiez/models/tool/tool.py
Waldiez Tool model.
WaldiezToolData ¶
Bases: WaldiezBase
Waldiez Tool Data.
Attributes:
Name | Type | Description |
---|---|---|
tool_type | WaldiezToolType | The type of the tool: shared, custom, langchain, crewai. |
content | str | The content (source code) of the tool. |
secrets | dict[str, str] | The secrets (environment variables) of the tool. |