You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Copy file name to clipboardExpand all lines: docs/source/workflows/run-workflows.md
+14-1Lines changed: 14 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -73,4 +73,17 @@ Refer to `aiq serve --help` for more information on how to customize the server.
73
73
74
74
## Using the Python API
75
75
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
+
asyncwith load_workflow(config_file) as workflow:
80
+
asyncwith 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