AS AgentScopeAPI 手册 / API Reference

DashScopeModelConfig

public class DashScopeModelConfig implements ModelConfig
源码Source io/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:67–308

用于DashScope 模型设置的配置。位于 io.agentscope.extensions.scheduler.config 包,实现 ModelConfig。核心成员包括 getModelName、createModel、getApiKey、isStream、getEnableThinking、getBaseUrl。

Configuration for DashScope model settings.

This configuration class encapsulates all the settings for DashScope chat models. It mirrors the builder pattern of DashScopeChatModel.Builder to provide consistent configuration across the system.

Supported Features:

  • All DashScope model types (text and vision models)

  • Configurable streaming and thinking mode

  • Custom generation options and protocol settings

  • Custom base URL for API endpoints

Usage Example:

`// Basic configuration
DashScopeModelConfig config = DashScopeModelConfig.builder()
.apiKey(System.getenv("DASHSCOPE_API_KEY"))
.modelName("qwen-max")
.stream(true)
.build();

// With thinking mode
DashScopeModelConfig thinkingConfig = DashScopeModelConfig.builder()
.apiKey(apiKey)
.modelName("qwen-max")
.enableThinking(true)
.defaultOptions(GenerateOptions.builder()
.thinkingBudget(5000)
.build())
.build();

// Use in AgentConfig
AgentConfig agentConfig = AgentConfig.builder()
.name("MyAgent")
.modelConfig(config)
.build();
`

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
构建器,用于构建并配置目标实例。
Builder for creating DashScopeModelConfig instances.

方法摘要Method Summary

方法Method说明Description
public String getModelName()
获取模型名称。
Returns the model name.
public Model createModel()
创建模型实例来自此配置。
Create a Model instance from this configuration.
public String getApiKey()
获取API 密钥。
Get the API key.
public boolean isStream()
检查if 流式是已启用。
Check if streaming is enabled.
public boolean getEnableThinking()
获取 `getEnableThinking`。
Check if thinking mode is enabled.
public String getBaseUrl()
获取基类 URL。
Get the base URL.
public static Builder builder()
static
创建新的构建器实例。
Create a new builder instance.
public boolean equals(Object o)
设置该参数。
Performs the equals operation.
public int hashCode()
返回 `hashCode` 结果。
Returns the hash code.
public String toString()
返回 `toString` 结果。
Returns the to string.

方法详情Method Detail

getModelName

public String getModelName()

获取模型名称。

Returns the model name.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:97–100

createModel

public Model createModel()

创建模型实例来自此配置。

Create a Model instance from this configuration.

返回Returns Model
返回模型。A configured DashScopeChatModel instance
抛出Throws
  • IllegalStateException 可能抛出 `IllegalStateException`。if the model cannot be created
源码Source io/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:111–129

getApiKey

public String getApiKey()

获取API 密钥。

Get the API key.

返回Returns String
API 密钥。The API key
源码Source io/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:136–138

isStream

public boolean isStream()

检查if 流式是已启用。

Check if streaming is enabled.

返回Returns boolean
返回布尔值,表示判断结果。true if streaming is enabled
源码Source io/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:145–147

getEnableThinking

public boolean getEnableThinking()

获取 getEnableThinking。

Check if thinking mode is enabled.

返回Returns boolean
返回布尔值,表示判断结果。true if thinking mode is enabled, false if disabled
源码Source io/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:154–156

getBaseUrl

public String getBaseUrl()

获取基类 URL。

Get the base URL.

返回Returns String
返回字符串结果。The custom base URL, may be null for default
源码Source io/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:163–165

builder

public static Builder builder()
static

创建新的构建器实例。

Create a new builder instance.

返回Returns Builder
一种新的构建器。A new Builder
源码Source io/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:172–174

equals

public boolean equals(Object o)

设置该参数。

Performs the equals operation.

参数Parameters
名称Name类型Type说明Description
oObjecto(类型 `Object`)。The o.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:176–186

hashCode

public int hashCode()

返回 hashCode 结果。

Returns the hash code.

返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:188–191

toString

public String toString()

返回 toString 结果。

Returns the to string.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:193–207

嵌套类详情Nested Class Detail

Builder

public static class Builder

构建器,用于构建并配置目标实例。位于 io.agentscope.extensions.scheduler.config 包。核心成员包括 apiKey、modelName、stream、enableThinking、baseUrl、build。

Builder for creating DashScopeModelConfig instances.

基于官方固定版本源码静态生成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.