Skip to content

Commit b32cad3

Browse files
authored
Add documentation for load_workflow() (#306)
Add documentation for `load_workflow()` to demonstrate the process of creating and using workflows directly from code. Closes [AIQ-1207](https://jirasw.nvidia.com/browse/AIQ-1207) ## By Submitting this PR I confirm: - I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/AIQToolkit/blob/develop/docs/source/resources/contributing.md). - We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license. - Any contribution which contains commits that are not Signed-Off will not be accepted. - When the PR is ready for review, new or existing tests cover these changes. - When the PR is ready for review, the documentation is up to date with these changes. Authors: - Yuchen Zhang (https://github.com/yczhang-nv) Approvers: - David Gardner (https://github.com/dagardner-nv) URL: #306
1 parent d8ed65b commit b32cad3

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

docs/source/workflows/run-workflows.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,17 @@ Refer to `aiq serve --help` for more information on how to customize the server.
7373

7474
## Using the Python API
7575

76-
Using the Python API for running workflows is outside the scope of this document. Refer to the Python API documentation for the {py:class}`~aiq.runtime.runner.AIQRunner` class for more information.
76+
The toolkit offers a programmatic way to execute workflows through its Python API, allowing you to integrate workflow execution directly into your Python code. Here's how to use it:
77+
78+
```python
79+
async with load_workflow(config_file) as workflow:
80+
async with workflow.run(input_str) as runner:
81+
result = await runner.result(to_type=str)
82+
```
83+
84+
In this example:
85+
- `config_file`: A string path pointing to your workflow YAML file
86+
- `input_str`: A string containing the input for your workflow
87+
- The `workflow.run(input_str)` method returns an instance of {py:class}`~aiq.runtime.runner.AIQRunner`
88+
89+
For detailed information about the `AIQRunner` class and its capabilities, please refer to the Python API documentation for the {py:class}`~aiq.runtime.runner.AIQRunner` class.

0 commit comments

Comments
 (0)