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
Copy file name to clipboardExpand all lines: docs/sphinx_doc/source/tutorial/trinity_programming_guide.md
+20-1Lines changed: 20 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -120,7 +120,7 @@ During initialization, `Workflow` receives the following parameters:
120
120
You can switch to using the OpenAI API by setting `explorer.rollout_model.enable_openai_api` to `true` in your config file and calling `model.get_openai_client()` to get an `openai.OpenAI` instance in your workflow.
121
121
```
122
122
123
-
Here’s an example of initializing a simple workflow using only `raw_task` and `rollout_args`. In more complex cases, you can use the `format_args` for further customization.
123
+
Here's an example of initializing a simple workflow using only `raw_task` and `rollout_args`. In more complex cases, you can use the `format_args` for further customization.
124
124
125
125
```python
126
126
classExampleWorkflow(Workflow):
@@ -197,6 +197,25 @@ class ExampleWorkflow(Workflow):
197
197
pass
198
198
```
199
199
200
+
For workflows that are prepared to be contributed to Trinity-RFT project, you need to place the above code in `trinity/common/workflows` folder, e.g., `trinity/common/workflows/example_workflow.py`. And add the following line to `trinity/common/workflows/__init__.py`:
201
+
202
+
```python
203
+
# existing import lines
204
+
from .example_workflow import ExampleWorkflow
205
+
206
+
__all__= [
207
+
# existing __all__ lines
208
+
"ExampleWorkflow",
209
+
]
210
+
```
211
+
212
+
For workflows that are not intended to be contributed to Trinity-RFT project, you can just place the above code in `trinity/plugins`. Trinity-RFT will automatically detect and load all custom modules in this folder.
213
+
214
+
```{tip}
215
+
You can specify the directory where your custom modules are located by setting `--plugin-dir` when starting Trinity-RFT. If you don't specify `--plugin-dir`, Trinity-RFT will use `<Trinity_RFT_ROOT_DIR>/trinity/plugins` as the default directory.
216
+
```
217
+
218
+
200
219
#### Avoid Re-initialization
201
220
202
221
For heavy workflows, re-initializing every time can incurs extra computational costs.
0 commit comments