Exporter
Waldiez exporter class.
The role of the exporter is to export the model's data to an autogen's flow with one or more chats.
The resulting file(s): a flow.py file with one main() function to trigger the chat(s).
WaldiezExporter ¶
WaldiezExporter(waldiez: Waldiez)
Waldiez exporter.
Attributes:
| Name | Type | Description |
|---|---|---|
waldiez (Waldiez) | The Waldiez instance. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
waldiez | Waldiez | The Waldiez instance. | required |
Source code in waldiez/exporter.py
export ¶
export(
path: str | Path,
structured_io: bool = False,
uploads_root: Path | None = None,
force: bool = False,
debug: bool = False,
) -> None
Export the Waldiez instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path | The path to export to. | required |
structured_io | (bool, optional) | Whether to use structured IO instead of the default 'input/print', by default False. | False |
uploads_root | (str | Path | None, optional) | The uploads root, to get user-uploaded files, by default None. | None |
force | (bool, optional) | Override the output file if it already exists, by default False. | False |
debug | (bool, optional) | Whether to enable debug mode, by default False. | False |
Raises:
| Type | Description |
|---|---|
FileExistsError | If the file already exists, and force is False. |
IsADirectoryError | If the output is a directory. |
ValueError | If the file extension is invalid. |
Source code in waldiez/exporter.py
load classmethod ¶
load(file_path: Path) -> WaldiezExporter
Load the Waldiez instance from a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path | Path | The file path. | required |
Returns:
| Type | Description |
|---|---|
WaldiezExporter | The Waldiez exporter. |
Source code in waldiez/exporter.py
to_ipynb ¶
to_ipynb(
path: str | Path,
structured_io: bool = False,
uploads_root: Path | None = None,
debug: bool = False,
) -> None
Export flow to jupyter notebook.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path | The path to export to. | required |
structured_io | bool | Whether to use structured IO instead of the default 'input/print', by default False. | False |
uploads_root | Path | None | The uploads root, to get user-uploaded files, by default None. | None |
debug | bool | Whether to enable debug mode, by default False. | False |
Raises:
| Type | Description |
|---|---|
RuntimeError | If the notebook could not be generated. |
Source code in waldiez/exporter.py
to_py ¶
to_py(
path: str | Path,
structured_io: bool = False,
uploads_root: Path | None = None,
debug: bool = False,
) -> None
Export waldiez flow to a python script.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path | The path to export to. | required |
structured_io | bool | Whether to use structured IO instead of the default 'input/print', by default False. | False |
uploads_root | Path | None | The uploads root, to get user-uploaded files, by default None. | None |
debug | bool | Whether to enable debug mode, by default False. | False |
Raises:
| Type | Description |
|---|---|
RuntimeError | If the python script could not be generated. |
Source code in waldiez/exporter.py
to_waldiez ¶
Export the Waldiez instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path | Path | The file path. | required |
debug | bool | Whether to enable debug mode, by default False. | False |