FallbackModel
public class FallbackModel implements Model
源码Source
io/agentscope/harness/coding/model/FallbackModel.java:37–80回退模型,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.harness.coding.model 包,实现 Model。核心成员包括 stream、getModelName、FallbackModel。
Model decorator that falls back to a secondary model on retryable errors.
The call is transparently retried using the secondary model.
Retryable error signals: RateLimitException, OverloadedException, or any
exception whose message contains "overloaded", "rate_limit", or "529".
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public FallbackModel(Model primary, Model secondary) | 初始化 `FallbackModel` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Flux<ChatResponse> stream(List<Msg> messages, List<ToolSchema> tools, GenerateOptions options) | 执行流相关操作。 Performs the stream operation. |
public String getModelName() | 获取模型名称。 Returns the model name. |
构造器详情Constructor Detail
FallbackModel
public FallbackModel(Model primary, Model secondary)
初始化 FallbackModel 实例。
Creates a new instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
primary | Model | primary(类型 `Model`)。The primary. |
secondary | Model | secondary(类型 `Model`)。The secondary. |
源码Source
io/agentscope/harness/coding/model/FallbackModel.java:44–47方法详情Method Detail
stream
public Flux<ChatResponse> stream(List<Msg> messages, List<ToolSchema> tools, GenerateOptions options)
执行流相关操作。
Performs the stream operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
messages | List<Msg> | 消息列表(类型 `List`)。The messages. |
tools | List<ToolSchema> | 工具列表(类型 `List`)。The tools. |
options | GenerateOptions | 选项(类型 `GenerateOptions`)。The options. |
Flux<ChatResponse>返回Flux。Returns flux.
源码Source
io/agentscope/harness/coding/model/FallbackModel.java:49–64getModelName
public String getModelName()
获取模型名称。
Returns the model name.
String返回字符串结果。Returns a string.
源码Source
io/agentscope/harness/coding/model/FallbackModel.java:66–69