ModelConfig
public record ModelConfig( int maxRetries, @JsonIgnore Model fallbackModel, @JsonIgnore FailoverListener failoverListener)
io/agentscope/core/agent/config/ModelConfig.java:31–56承载模型配置数据的记录类型。位于 io.agentscope.core.agent.config 包。核心成员包括 maxRetries、fallbackModel、failoverListener、defaults、ModelConfig、DEFAULT_MAX_RETRIES。
Model invocation configuration. #maxRetries() bounds the retry count on a single
model call; #fallbackModel() (nullable) is invoked if the primary model still fails
after exhausting retries — the fallback shares the same maxRetries budget. #failoverListener() (nullable) is notified when such a switch happens.
The fallbackModel and failoverListener fields are intentionally excluded
from JSON serialisation (@JsonIgnore): they hold live instances (credentials,
connections, callbacks) that don't round-trip cleanly through a state snapshot.
记录组件摘要Record Component Summary
| 组件Component | 类型Type | 说明Description |
|---|---|---|
maxRetries | int | 执行最大重试相关操作。 Performs the max retries operation. |
fallbackModel | Model | 执行回退模型相关操作。 Performs the fallback model operation. |
failoverListener | FailoverListener | 执行故障转移监听器相关操作。 Performs the failover listener operation. |
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
DEFAULT_MAX_RETRIESstaticfinal | int | 默认最大重试字段。 The DEFAULT MAX RETRIES field. |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public ModelConfig(int maxRetries, Model fallbackModel, FailoverListener failoverListener) | 初始化 `ModelConfig` 实例。 Creates a new instance. |
public ModelConfig(int maxRetries, Model fallbackModel) | 初始化 `ModelConfig` 实例。 Convenience constructor without failover observation; equivalent to passing a `null`
listener. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static ModelConfig defaults()static | 返回 `defaults` 结果。 Returns a config initialised to all default values (no fallback model). |
记录组件详情Record Component Detail
maxRetries
int maxRetries执行最大重试相关操作。
Performs the max retries operation.
io/agentscope/core/agent/config/ModelConfig.java:31–56fallbackModel
Model fallbackModel执行回退模型相关操作。
Performs the fallback model operation.
io/agentscope/core/agent/config/ModelConfig.java:31–56failoverListener
FailoverListener failoverListener执行故障转移监听器相关操作。
Performs the failover listener operation.
io/agentscope/core/agent/config/ModelConfig.java:31–56字段详情Field Detail
DEFAULT_MAX_RETRIES
public static final int DEFAULT_MAX_RETRIES
默认最大重试字段。声明为 public static final int DEFAULT_MAX_RETRIES。
The DEFAULT MAX RETRIES field.
io/agentscope/core/agent/config/ModelConfig.java:36构造器详情Constructor Detail
ModelConfig
public ModelConfig(int maxRetries, Model fallbackModel, FailoverListener failoverListener)
初始化 ModelConfig 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
maxRetries | int | 最大重试(类型 `int`)。The max retries. |
fallbackModel | Model | 回退模型(类型 `Model`)。The fallback model. |
failoverListener | FailoverListener | 故障转移监听器(类型 `FailoverListener`)。The failover listener. |
io/agentscope/core/agent/config/ModelConfig.java:38–42ModelConfig
public ModelConfig(int maxRetries, Model fallbackModel)
初始化 ModelConfig 实例。
Convenience constructor without failover observation; equivalent to passing a null listener.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
maxRetries | int | 最大重试(类型 `int`)。The max retries. |
fallbackModel | Model | 回退模型(类型 `Model`)。The fallback model. |
io/agentscope/core/agent/config/ModelConfig.java:48–50方法详情Method Detail
defaults
public static ModelConfig defaults()
返回 defaults 结果。
Returns a config initialised to all default values (no fallback model).
ModelConfigio/agentscope/core/agent/config/ModelConfig.java:53–55