AS AgentScopeAPI 手册 / API Reference

ModelConfig

public interface ModelConfig
源码Source io/agentscope/extensions/scheduler/config/ModelConfig.java:54–87

定义模型配置契约的接口。位于 io.agentscope.extensions.scheduler.config 包。核心成员包括 getModelName、createModel。

Configuration interface for model settings in scheduled tasks.

This interface defines a contract for model configuration objects that encapsulate model-related settings. It provides a unified way to handle model configurations across different model providers.

Key Benefits:

  • Serializable Configuration - Easier to persist and transmit model settings

  • Decoupling - Configuration is separate from model implementation

  • Type Safety - Strongly typed configuration objects

  • Flexibility - Support for different model providers

Usage Example:

`// Create model configuration
ModelConfig modelConfig = DashScopeModelConfig.builder()
.apiKey(apiKey)
.modelName("qwen-max")
.stream(true)
.build();

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

方法摘要Method Summary

方法Method说明Description
public String getModelName()
获取模型名称。
Get the model name or identifier.
public Model createModel()
创建模型实例来自此配置。
Create a Model instance from this configuration.

方法详情Method Detail

getModelName

public String getModelName()

获取模型名称。

Get the model name or identifier.

返回Returns String
返回字符串结果。The model name/identifier
源码Source io/agentscope/extensions/scheduler/config/ModelConfig.java:63

createModel

public Model createModel()

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

Create a Model instance from this configuration.

返回Returns Model
返回模型。A Model instance configured according to this configuration
抛出Throws
  • IllegalStateException 可能抛出 `IllegalStateException`。if the model cannot be created
源码Source io/agentscope/extensions/scheduler/config/ModelConfig.java:86
基于官方固定版本源码静态生成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.