Class DashScopeModelConfig
java.lang.Object
io.agentscope.extensions.scheduler.config.DashScopeModelConfig
- All Implemented Interfaces:
ModelConfig
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();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for creating DashScopeModelConfig instances. -
Method Summary
Modifier and TypeMethodDescriptionstatic DashScopeModelConfig.Builderbuilder()Create a new builder instance.io.agentscope.core.model.ModelCreate a Model instance from this configuration.booleanGet the API key.Get the base URL.booleanCheck if thinking mode is enabled.Get the model name or identifier.inthashCode()booleanisStream()Check if streaming is enabled.toString()
-
Method Details
-
getModelName
Description copied from interface:ModelConfigGet the model name or identifier.This is used for logging, identification, and routing purposes.
- Specified by:
getModelNamein interfaceModelConfig- Returns:
- The model name/identifier
-
createModel
public io.agentscope.core.model.Model createModel()Create a Model instance from this configuration.This method creates a
DashScopeChatModelinstance with all the configured settings. The created model is ready to use for agent execution.- Specified by:
createModelin interfaceModelConfig- Returns:
- A configured DashScopeChatModel instance
- Throws:
IllegalStateException- if the model cannot be created
-
getApiKey
Get the API key.- Returns:
- The API key
-
isStream
public boolean isStream()Check if streaming is enabled.- Returns:
- true if streaming is enabled
-
getEnableThinking
public boolean getEnableThinking()Check if thinking mode is enabled.- Returns:
- true if thinking mode is enabled, false if disabled
-
getBaseUrl
Get the base URL.- Returns:
- The custom base URL, may be null for default
-
builder
Create a new builder instance.- Returns:
- A new Builder
-
equals
-
hashCode
public int hashCode() -
toString
-