Builder
public static class Builder
io/agentscope/extensions/model/dashscope/DashScopeChatModel.java:440–840构建器,用于构建并配置目标实例。位于 io.agentscope.extensions.model.dashscope 包。核心成员包括 apiKey、modelName、stream、enableThinking、enableSearch、endpointType。
A class in io.agentscope.extensions.model.dashscope that talks to model services and returns generated or embedded output. Declared in io.agentscope.extensions.model.dashscope.
方法摘要Method Summary
方法详情Method Detail
apiKey
public Builder apiKey(String apiKey)
设置API 键。
Sets the API key for DashScope authentication.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
apiKey | String | API 密钥。the API key |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:464–467modelName
public Builder modelName(String modelName)
设置模型名称到使用。
Sets the model name to use.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
modelName | String | 模型名称(类型 `String`)。the model name (e.g., "qwen-max", "qwen-vl-plus") |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:478–481stream
public Builder stream(boolean stream)
设置流。
Sets whether streaming should be enabled.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
stream | boolean | 流(类型 `boolean`)。true to enable streaming, false for non-streaming |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:489–492enableThinking
public Builder enableThinking(Boolean enableThinking)
启用该配置。
Sets whether thinking mode should be enabled.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
enableThinking | Boolean | 启用 Thinking(类型 `Boolean`)。true to enable thinking mode, false to disable, null for default |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:500–503enableSearch
public Builder enableSearch(Boolean enableSearch)
启用搜索。
Sets whether search enhancement should be enabled.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
enableSearch | Boolean | 启用搜索(类型 `Boolean`)。true to enable search mode, false to disable, null for default (disabled) |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:514–517endpointType
public Builder endpointType(EndpointType endpointType)
设置端点类型到使用用于端点路由。
Sets the endpoint type to use for endpoint routing.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
endpointType | EndpointType | 端点类型(类型 `EndpointType`)。the endpoint type to use (null for AUTO) |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:527–530defaultOptions
public Builder defaultOptions(GenerateOptions options)
设置默认选项。
Sets the default generation options.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
options | GenerateOptions | 选项(类型 `GenerateOptions`)。the default options to use (null for defaults) |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:538–541baseUrl
public Builder baseUrl(String baseUrl)
设置自定义基类 URL 用于 DashScope API。
Sets a custom base URL for DashScope API.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
baseUrl | String | 基类 URL(类型 `String`)。the base URL (null for default) |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:549–552formatter
public Builder formatter(Formatter<DashScopeMessage, DashScopeResponse, DashScopeRequest> formatter)
设置消息格式化器到使用。
Sets the message formatter to use.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
formatter | Formatter<DashScopeMessage, DashScopeResponse, DashScopeRequest> | 格式化器(类型 `Formatter`)。the formatter (null for default DashScope formatter) |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:560–564httpTransport
public Builder httpTransport(HttpTransport httpTransport)
设置HTTP 传输层到使用。
Sets the HTTP transport to use.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
httpTransport | HttpTransport | HTTP 传输层(类型 `HttpTransport`)。the HTTP transport (null for default from factory) |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:606–609proxy
public Builder proxy(ProxyConfig proxyConfig)
设置代理。
Sets the proxy configuration for HTTP traffic.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
proxyConfig | ProxyConfig | 代理配置(类型 `ProxyConfig`)。the proxy configuration (see `ProxyConfig`) |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:636–639enableEncrypt
public Builder enableEncrypt(boolean enableEncrypt)
启用该配置。
Sets whether encryption should be enabled.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
enableEncrypt | boolean | 启用 Encrypt(类型 `boolean`)。true to enable encryption (will fetch public key automatically), false to disable encryption |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:666–669contextWindowSize
public Builder contextWindowSize(int contextWindowSize)
设置该配置项。
Overrides the inferred context window size (in tokens).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
contextWindowSize | int | 上下文 Window 大小(类型 `int`)。The context window size. |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:675–678nativeStructuredOutput
public Builder nativeStructuredOutput(boolean nativeStructuredOutput)
设置原生结构化输出。
Sets whether this model supports native structured output via response_format with json_schema type.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
nativeStructuredOutput | boolean | 原生结构化输出(类型 `boolean`)。true to enable native json_schema path |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:695–698nativeStructuredOutputWithTools
public Builder nativeStructuredOutputWithTools(boolean nativeStructuredOutputWithTools)
设置原生结构化输出使用工具。
Sets whether this model correctly handles native structured output (response_format) alongside tool calling.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
nativeStructuredOutputWithTools | boolean | 原生结构化输出使用工具(类型 `boolean`)。false to use fallback when tools are present |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:711–714multimodalModelPatterns
public Builder multimodalModelPatterns(Collection<String> multimodalModelPatterns)
设置该配置项。
Sets additional case-insensitive substring patterns for multimodal model detection.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
multimodalModelPatterns | Collection<String> | 多模态模型 Patterns(类型 `Collection`)。case-insensitive substring patterns (may be null) |
Builderio/agentscope/extensions/model/dashscope/DashScopeChatModel.java:739–742build
public DashScopeChatModel build()
构建DashScopeChatModel 实例。
Builds the DashScopeChatModel instance.
DashScopeChatModelDashScopeHttpClient.DashScopeHttpException可能抛出 `DashScopeHttpClient.DashScopeHttpException`。if encryption is enabled and public key fetching fails
io/agentscope/extensions/model/dashscope/DashScopeChatModel.java:762–804