Class DashScopeModelConfig

java.lang.Object
io.agentscope.extensions.scheduler.config.DashScopeModelConfig
All Implemented Interfaces:
ModelConfig

public class DashScopeModelConfig extends Object implements 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:
  • Method Details

    • getModelName

      public String getModelName()
      Description copied from interface: ModelConfig
      Get the model name or identifier.

      This is used for logging, identification, and routing purposes.

      Specified by:
      getModelName in interface ModelConfig
      Returns:
      The model name/identifier
    • createModel

      public io.agentscope.core.model.Model createModel()
      Create a Model instance from this configuration.

      This method creates a DashScopeChatModel instance with all the configured settings. The created model is ready to use for agent execution.

      Specified by:
      createModel in interface ModelConfig
      Returns:
      A configured DashScopeChatModel instance
      Throws:
      IllegalStateException - if the model cannot be created
    • getApiKey

      public String 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

      public String getBaseUrl()
      Get the base URL.
      Returns:
      The custom base URL, may be null for default
    • builder

      public static DashScopeModelConfig.Builder builder()
      Create a new builder instance.
      Returns:
      A new Builder
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object