Decorators
step #
step(*args: Any, workflow: Optional[Type[Workflow]] = None, pass_context: bool = False, num_workers: int = 4, retry_policy: Optional[RetryPolicy] = None) -> Callable
Decorator used to mark methods and functions as workflow steps.
Decorators are evaluated at import time, but we need to wait for starting the communication channels until runtime. For this reason, we temporarily store the list of events that will be consumed by this step in the function object itself.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workflow
|
Optional[Type[Workflow]]
|
Workflow class to which the decorated step will be added. Only needed when using the decorator on free functions instead of class methods. |
None
|
num_workers
|
int
|
The number of workers that will process events for the decorated step. The default value works most of the times. |
4
|
retry_policy
|
Optional[RetryPolicy]
|
The policy used to retry a step that encountered an error while running. |
None
|
Source code in llama-index-core/llama_index/core/workflow/decorators.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
|