重试策略
重试策略 #
基类: Protocol
Source code in llama-index-core/llama_index/core/workflow/retry_policy.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
下一步 #
next(elapsed_time: float, attempts: int, error: Exception) -> Optional[float]
决定是否应再次重试,返回下次运行前需要等待的秒数。
参数:
名称 | 类型 | 描述 | 默认值 |
---|---|---|---|
elapsed_time
|
float
|
自上次尝试以来经过的时间(秒)。 |
required |
attempts
|
int
|
到目前为止已尝试的次数。 |
required |
error
|
Exception
|
最后一次错误发生了。 |
required |
返回:
类型 | 描述 |
---|---|
Optional[float]
|
在下次尝试前等待的秒数,如果停止重试则为None。 |
Source code in llama-index-core/llama_index/core/workflow/retry_policy.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
ConstantDelayRetryPolicy #
一种简单的策略,在固定间隔内多次重试某个步骤。
Source code in llama-index-core/llama_index/core/workflow/retry_policy.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|