waldiez
Project description
Waldiez
Translate a Waldiez flow:
To a python script or a jupyter notebook with the corresponding autogen agents and chats.
Features
- Export .waldiez flows to .py or .ipynb
- Run a .waldiez flow
- Include a
logs
folder with the logs of the flow in csv format - Provide a custom IOSStream to handle input and output.
Installation
From this repository:
python -m pip install git+https://github.com/waldiez/py.git
Usage
CLI
# Export a Waldiez flow to a python script or a jupyter notebook
waldiez --export /path/to/a/flow.waldiez --output /path/to/an/output[.py|.ipynb]
# Export and run the script, optionally force generation if the output file already exists
waldiez /path/to/a/flow.waldiez --output /path/to/an/output[.py] [--force]
As a library
Export a flow
# Export a Waldiez flow to a python script or a jupyter notebook
from waldiez import WaldiezExporter
flow_path = "/path/to/a/flow.waldiez"
output_path = "/path/to/an/output.py" # or .ipynb
exporter = WaldiezExporter.load(flow_path)
exporter.export(output_path)
Run a flow
# Run a flow
from waldiez import WaldiezRunner
flow_path = "/path/to/a/flow.waldiez"
output_path = "/path/to/an/output.py"
runner = WaldiezRunner.load(flow_path)
runner.run(output_path=output_path)
Run a flow with a custom IOStream
# Run the flow with a custom IOStream
from waldiez import WaldiezIOStream, WaldiezRunner
flow_path = "/path/to/a/flow.waldiez"
output_path = "/path/to/an/output.py"
def print_function(*values, **args) -> None:
"""A custom print function."""
print(values)
def on_prompt_input(prompt: str) -> str:
"""A custom input function."""
return input(prompt)
io_stream = WaldiezIOStream(
print_function=print_function,
on_prompt_input=on_prompt_input,
input_timeout=30,
)
with WaldiezIOStream.set_default(io_stream):
runner = WaldiezRunner.load(flow_path)
runner.run(stream=io_stream, output_path=output_path)
io_stream.close()
Tools
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
waldiez-0.1.0.tar.gz
(63.1 kB
view details)
Built Distribution
waldiez-0.1.0-py3-none-any.whl
(100.9 kB
view details)
File details
Details for the file waldiez-0.1.0.tar.gz
.
File metadata
- Download URL: waldiez-0.1.0.tar.gz
- Upload date:
- Size: 63.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d70a9d266a30ac017865e558ec02c2a11111c75746579ceeac1c98b6ea9d3748 |
|
MD5 | ffd44e0e59ed3d36cceec4c7a49fd232 |
|
BLAKE2b-256 | 2a0e5a3e3b0ceb0d2bc9722c5f677fe073f6b59d2f2569ec5a00cb1bc4dc5e75 |
File details
Details for the file waldiez-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: waldiez-0.1.0-py3-none-any.whl
- Upload date:
- Size: 100.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82ea02addfb48daa5a627189535b5269f187f305957172056e54c5c13c84a5b1 |
|
MD5 | 8c75db44a1919c9899b4fde5d3f8014d |
|
BLAKE2b-256 | da32a95830d43fafe86d10f2a959ddd2474c0dd0715dfa645b2ee0c41ec8ee80 |