AS AgentScopeAPI 手册 / API Reference

ModelProvider

public interface ModelProvider
源码Source io/agentscope/core/model/spi/ModelProvider.java:22–45

定义模型提供者契约的接口。位于 io.agentscope.core.model.spi 包。核心成员包括 providerId、supports、create。

Service Provider Interface for model adapters discovered from extension modules.

方法摘要Method Summary

方法Method说明Description
public String providerId()
返回提供者标识。
Provider identifier, for example `openai`.
public boolean supports(String modelId)
设置支持。
Returns whether this provider can create a model for the full model id, for example `openai:gpt-4o`.
default public boolean supports(String modelId, ModelCreationContext context)
default
执行支持相关操作。
Returns whether this provider can create a model for the full model id and context.
public Model create(String modelId)
创建并返回实例。
Creates a model for the full model id.
default public Model create(String modelId, ModelCreationContext context)
default
创建并返回实例。
Creates a model for the full model id using a provider-neutral context.

方法详情Method Detail

providerId

public String providerId()

返回提供者标识。

Provider identifier, for example openai.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/model/spi/ModelProvider.java:25

supports

public boolean supports(String modelId)

设置支持。

Returns whether this provider can create a model for the full model id, for example openai:gpt-4o.

参数Parameters
名称Name类型Type说明Description
modelIdString模型标识(类型 `String`)。The model id.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/core/model/spi/ModelProvider.java:31

supports

default public boolean supports(String modelId, ModelCreationContext context)
default

执行支持相关操作。

Returns whether this provider can create a model for the full model id and context.

参数Parameters
名称Name类型Type说明Description
modelIdString模型标识(类型 `String`)。The model id.
contextModelCreationContext上下文(类型 `ModelCreationContext`)。The context.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/core/model/spi/ModelProvider.java:34–36

create

public Model create(String modelId)

创建并返回实例。

Creates a model for the full model id.

参数Parameters
名称Name类型Type说明Description
modelIdString模型标识(类型 `String`)。The model id.
返回Returns Model
返回模型。Returns model.
源码Source io/agentscope/core/model/spi/ModelProvider.java:39

create

default public Model create(String modelId, ModelCreationContext context)
default

创建并返回实例。

Creates a model for the full model id using a provider-neutral context.

参数Parameters
名称Name类型Type说明Description
modelIdString模型标识(类型 `String`)。The model id.
contextModelCreationContext上下文(类型 `ModelCreationContext`)。The context.
返回Returns Model
返回模型。Returns model.
源码Source io/agentscope/core/model/spi/ModelProvider.java:42–44
基于官方固定版本源码静态生成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.