Builder
public static class Builder
源码Source
io/agentscope/core/model/ExecutionConfig.java:294–387ExecutionConfig的构建器。位于 io.agentscope.core.model 包。核心成员包括 timeout、maxAttempts、initialBackoff、maxBackoff、backoffMultiplier、retryOn。
Builder for ExecutionConfig.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Builder timeout(Duration timeout) | 设置超时。 Sets the timeout duration for a single execution. |
public Builder maxAttempts(Integer maxAttempts) | 设置最大尝试次数。 Sets the maximum number of attempts (including the initial attempt). |
public Builder initialBackoff(Duration initialBackoff) | 设置该配置项。 Sets the initial backoff duration for the first retry. |
public Builder maxBackoff(Duration maxBackoff) | 设置最大退避。 Sets the maximum backoff duration between retries. |
public Builder backoffMultiplier(Double backoffMultiplier) | 设置该配置项。 Sets the backoff multiplier applied after each retry. |
public Builder retryOn(Predicate<Throwable> retryOn) | 设置重试 On。 Sets the predicate to determine if an error should trigger a retry. |
public ExecutionConfig build() | 构建新的ExecutionConfig 实例。 Builds a new ExecutionConfig instance. |
方法详情Method Detail
timeout
public Builder timeout(Duration timeout)
设置超时。
Sets the timeout duration for a single execution.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
timeout | Duration | 超时时间(类型 `Duration`)。the timeout duration, or null for no timeout |
Builder返回当前实例,以支持链式调用。this builder instance
源码Source
io/agentscope/core/model/ExecutionConfig.java:308–311maxAttempts
public Builder maxAttempts(Integer maxAttempts)
设置最大尝试次数。
Sets the maximum number of attempts (including the initial attempt).
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
maxAttempts | Integer | 最大尝试次数(类型 `Integer`)。the max attempts (must be >= 1), or null |
Builder返回当前实例,以支持链式调用。this builder instance
源码Source
io/agentscope/core/model/ExecutionConfig.java:321–327initialBackoff
public Builder initialBackoff(Duration initialBackoff)
设置该配置项。
Sets the initial backoff duration for the first retry.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
initialBackoff | Duration | initial 退避(类型 `Duration`)。the initial backoff duration, or null |
Builder返回当前实例,以支持链式调用。this builder instance
源码Source
io/agentscope/core/model/ExecutionConfig.java:335–338maxBackoff
public Builder maxBackoff(Duration maxBackoff)
设置最大退避。
Sets the maximum backoff duration between retries.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
maxBackoff | Duration | 最大退避(类型 `Duration`)。the max backoff duration, or null |
Builder返回当前实例,以支持链式调用。this builder instance
源码Source
io/agentscope/core/model/ExecutionConfig.java:346–349backoffMultiplier
public Builder backoffMultiplier(Double backoffMultiplier)
设置该配置项。
Sets the backoff multiplier applied after each retry.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
backoffMultiplier | Double | 退避 Multiplier(类型 `Double`)。the backoff multiplier (must be >= 1.0), or null |
Builder返回当前实例,以支持链式调用。this builder instance
源码Source
io/agentscope/core/model/ExecutionConfig.java:360–366retryOn
public Builder retryOn(Predicate<Throwable> retryOn)
设置重试 On。
Sets the predicate to determine if an error should trigger a retry.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
retryOn | Predicate<Throwable> | 重试 On(类型 `Predicate`)。the retry predicate (returns true to retry), or null |
Builder返回当前实例,以支持链式调用。this builder instance
源码Source
io/agentscope/core/model/ExecutionConfig.java:374–377build
public ExecutionConfig build()
构建新的ExecutionConfig 实例。
Builds a new ExecutionConfig instance.
ExecutionConfig一种新的ExecutionConfig 实例。a new ExecutionConfig instance
源码Source
io/agentscope/core/model/ExecutionConfig.java:384–386