AS AgentScopeAPI 手册 / API Reference

ModelConfig

public record ModelConfig( int maxRetries, @JsonIgnore Model fallbackModel, @JsonIgnore FailoverListener failoverListener)
源码Source 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
maxRetriesint
执行最大重试相关操作。
Performs the max retries operation.
fallbackModelModel
执行回退模型相关操作。
Performs the fallback model operation.
failoverListenerFailoverListener
执行故障转移监听器相关操作。
Performs the failover listener operation.

字段摘要Field Summary

字段Field类型Type说明Description
DEFAULT_MAX_RETRIES
staticfinal
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.

源码Source io/agentscope/core/agent/config/ModelConfig.java:31–56

fallbackModel

Model fallbackModel

执行回退模型相关操作。

Performs the fallback model operation.

源码Source io/agentscope/core/agent/config/ModelConfig.java:31–56

failoverListener

FailoverListener failoverListener

执行故障转移监听器相关操作。

Performs the failover listener operation.

源码Source io/agentscope/core/agent/config/ModelConfig.java:31–56

字段详情Field Detail

DEFAULT_MAX_RETRIES

public static final int DEFAULT_MAX_RETRIES
staticfinal

默认最大重试字段。声明为 public static final int DEFAULT_MAX_RETRIES。

The DEFAULT MAX RETRIES field.

源码Source io/agentscope/core/agent/config/ModelConfig.java:36

构造器详情Constructor Detail

ModelConfig

public ModelConfig(int maxRetries, Model fallbackModel, FailoverListener failoverListener)

初始化 ModelConfig 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
maxRetriesint最大重试(类型 `int`)。The max retries.
fallbackModelModel回退模型(类型 `Model`)。The fallback model.
failoverListenerFailoverListener故障转移监听器(类型 `FailoverListener`)。The failover listener.
源码Source io/agentscope/core/agent/config/ModelConfig.java:38–42

ModelConfig

public ModelConfig(int maxRetries, Model fallbackModel)

初始化 ModelConfig 实例。

Convenience constructor without failover observation; equivalent to passing a null listener.

参数Parameters
名称Name类型Type说明Description
maxRetriesint最大重试(类型 `int`)。The max retries.
fallbackModelModel回退模型(类型 `Model`)。The fallback model.
源码Source io/agentscope/core/agent/config/ModelConfig.java:48–50

方法详情Method Detail

defaults

public static ModelConfig defaults()
static

返回 defaults 结果。

Returns a config initialised to all default values (no fallback model).

返回Returns ModelConfig
返回ModelConfig。Returns model config.
源码Source io/agentscope/core/agent/config/ModelConfig.java:53–55
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.