AS AgentScopeAPI 手册 / API Reference

ModelContextWindows

public final class ModelContextWindows
源码Source io/agentscope/core/model/ModelContextWindows.java:29–167

模型上下文 Windows,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.core.model 包。核心成员包括 lookup、DASHSCOPE、OPENAI、DEEPSEEK、GLM、MINIMAX。

Known context window sizes for popular models. Used by ChatModelBase subclasses to infer Model#getContextWindowSize() from the model name when no explicit value is provided via the builder.

Values are total context window (input + output) in tokens. Entries are matched via prefix: a model name "qwen-max-latest" matches the "qwen-max" entry. Longer prefixes are checked first so "gpt-4.1-mini" matches before "gpt-4.1".

字段摘要Field Summary

字段Field类型Type说明Description
DASHSCOPE
staticfinal
Map<String, Integer>
DashScope字段。
The DASHSCOPE field.
OPENAI
staticfinal
Map<String, Integer>
OpenAI字段。
The OPENAI field.
DEEPSEEK
staticfinal
Map<String, Integer>
DeepSeek字段。
The DEEPSEEK field.
GLM
staticfinal
Map<String, Integer>
GLM字段。
The GLM field.
MINIMAX
staticfinal
Map<String, Integer>
MiniMax字段。
The MINIMAX field.
KIMI
staticfinal
Map<String, Integer>
KIMI字段。
The KIMI field.
ANTHROPIC
staticfinal
Map<String, Integer>
`ANTHROPIC` 字段。
The ANTHROPIC field.
GEMINI
staticfinal
Map<String, Integer>
`GEMINI` 字段。
The GEMINI field.

方法摘要Method Summary

方法Method说明Description
public static int lookup(String modelName, Map<String, Integer> knownModels)
static
执行 `lookup` 方法。
Finds the context window size for the given model name from the provided map.

字段详情Field Detail

DASHSCOPE

public static final Map<String, Integer> DASHSCOPE
staticfinal

DashScope字段。声明为 public static final Map DASHSCOPE。

The DASHSCOPE field.

源码Source io/agentscope/core/model/ModelContextWindows.java:35–57

OPENAI

public static final Map<String, Integer> OPENAI
staticfinal

OpenAI字段。声明为 public static final Map OPENAI。

The OPENAI field.

源码Source io/agentscope/core/model/ModelContextWindows.java:59–78

DEEPSEEK

public static final Map<String, Integer> DEEPSEEK
staticfinal

DeepSeek字段。声明为 public static final Map DEEPSEEK。

The DEEPSEEK field.

源码Source io/agentscope/core/model/ModelContextWindows.java:80–83

GLM

public static final Map<String, Integer> GLM
staticfinal

GLM字段。声明为 public static final Map GLM。

The GLM field.

源码Source io/agentscope/core/model/ModelContextWindows.java:85–100

MINIMAX

public static final Map<String, Integer> MINIMAX
staticfinal

MiniMax字段。声明为 public static final Map MINIMAX。

The MINIMAX field.

源码Source io/agentscope/core/model/ModelContextWindows.java:102–112

KIMI

public static final Map<String, Integer> KIMI
staticfinal

KIMI字段。声明为 public static final Map KIMI。

The KIMI field.

源码Source io/agentscope/core/model/ModelContextWindows.java:114–126

ANTHROPIC

public static final Map<String, Integer> ANTHROPIC
staticfinal

ANTHROPIC 字段。声明为 public static final Map ANTHROPIC。

The ANTHROPIC field.

源码Source io/agentscope/core/model/ModelContextWindows.java:128–135

GEMINI

public static final Map<String, Integer> GEMINI
staticfinal

GEMINI 字段。声明为 public static final Map GEMINI。

The GEMINI field.

源码Source io/agentscope/core/model/ModelContextWindows.java:137–141

方法详情Method Detail

lookup

public static int lookup(String modelName, Map<String, Integer> knownModels)
static

执行 lookup 方法。

Finds the context window size for the given model name from the provided map.

参数Parameters
名称Name类型Type说明Description
modelNameString模型名称(类型 `String`)。The model name.
knownModelsMap<String, Integer>known 模型(类型 `Map`)。The known models.
返回Returns int
返回数值结果。context window size, or 0 if no match
源码Source io/agentscope/core/model/ModelContextWindows.java:151–166
基于官方固定版本源码静态生成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.