You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
1.1 KiB
24 lines
1.1 KiB
**Module/Function Name: RecursiveWorkflow**
|
|
|
|
`class` RecursiveWorkflow(BaseStructure):
|
|
|
|
Creates a recursive workflow structure for executing a task until a stated stopping condition is reached.
|
|
|
|
#### Parameters
|
|
* *task* (`Task`): The task to execute.
|
|
* *stop_token* (`Any`): The token that signals the termination of the workflow.
|
|
|
|
#### Examples:
|
|
```python
|
|
from swarms.models import OpenAIChat
|
|
from swarms.structs import RecursiveWorkflow, Task
|
|
|
|
llm = OpenAIChat(openai_api_key="YourKey")
|
|
task = Task(llm, "What's the weather in miami")
|
|
workflow = RecursiveWorkflow(stop_token="<DONE>")
|
|
workflow.add(task)
|
|
workflow.run()
|
|
```
|
|
|
|
In summary, the `RecursiveWorkflow` class is designed to automate tasks by adding and executing these tasks recursively until a stopping condition is reached. This can be achieved by utilizing the `add` and `run` methods provided. A general format for adding and utilizing the `RecursiveWorkflow` class has been provided under the "Examples" section. If you require any further information, view other sections, like Args and Source Code for specifics on using the class effectively.
|