AnthropicModelProvider
public final class AnthropicModelProvider implements ModelProvider
源码Source
io/agentscope/extensions/model/anthropic/AnthropicModelProvider.java:38–109Anthropic 模型提供者,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.extensions.model.anthropic 包,实现 ModelProvider。核心成员包括 providerId、supports、create。
Anthropic provider registered through java.util.ServiceLoader.
Credentials come from the context's standard apiKey field or the "authToken" context option (a bearer token for Anthropic-compatible gateways; the two are
mutually exclusive). When neither is set, the ANTHROPIC_API_KEY environment variable
is used, then ANTHROPIC_AUTH_TOKEN.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String providerId() | 返回提供者标识。 Returns the provider id. |
public boolean supports(String modelId) | 设置支持。 Performs the supports operation. |
public Model create(String modelId) | 创建并返回实例。 Creates and returns an instance. |
public Model create(String modelId, ModelCreationContext context) | 创建并返回实例。 Creates and returns an instance. |
方法详情Method Detail
providerId
public String providerId()
返回提供者标识。
Returns the provider id.
String返回字符串结果。Returns a string.
源码Source
io/agentscope/extensions/model/anthropic/AnthropicModelProvider.java:45–48supports
public boolean supports(String modelId)
设置支持。
Performs the supports operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
modelId | String | 模型标识(类型 `String`)。The model id. |
boolean返回布尔值,表示判断结果。Returns a boolean result.
源码Source
io/agentscope/extensions/model/anthropic/AnthropicModelProvider.java:50–53create
public Model create(String modelId)
创建并返回实例。
Creates and returns an instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
modelId | String | 模型标识(类型 `String`)。The model id. |
Model返回模型。Returns model.
源码Source
io/agentscope/extensions/model/anthropic/AnthropicModelProvider.java:55–58create
public Model create(String modelId, ModelCreationContext context)
创建并返回实例。
Creates and returns an instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
modelId | String | 模型标识(类型 `String`)。The model id. |
context | ModelCreationContext | 上下文(类型 `ModelCreationContext`)。The context. |
Model返回模型。Returns model.
源码Source
io/agentscope/extensions/model/anthropic/AnthropicModelProvider.java:60–88