DashScopeModelConfig
public class DashScopeModelConfig implements ModelConfig
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.
Stringio/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:97–100createModel
public Model createModel()
创建模型实例来自此配置。
Create a Model instance from this configuration.
ModelIllegalStateException可能抛出 `IllegalStateException`。if the model cannot be created
io/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:111–129getApiKey
public String getApiKey()
获取API 密钥。
Get the API key.
Stringio/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:136–138isStream
public boolean isStream()
检查if 流式是已启用。
Check if streaming is enabled.
booleanio/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:145–147getEnableThinking
public boolean getEnableThinking()
获取 getEnableThinking。
Check if thinking mode is enabled.
booleanio/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:154–156getBaseUrl
public String getBaseUrl()
获取基类 URL。
Get the base URL.
Stringio/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:163–165builder
public static Builder builder()
创建新的构建器实例。
Create a new builder instance.
Builderio/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:172–174equals
public boolean equals(Object o)
设置该参数。
Performs the equals operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
o | Object | o(类型 `Object`)。The o. |
booleanio/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:176–186hashCode
public int hashCode()
返回 hashCode 结果。
Returns the hash code.
intio/agentscope/extensions/scheduler/config/DashScopeModelConfig.java:188–191toString
public String toString()
返回 toString 结果。
Returns the to string.
Stringio/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.