AnthropicToolsHelper
public class AnthropicToolsHelper
源码Source
io/agentscope/extensions/model/anthropic/formatter/AnthropicToolsHelper.java:43–278Anthropic 工具 Helper,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.extensions.model.anthropic.formatter 包。核心成员包括 applyTools、applyOptions。
Helper class for tool registration and option application for Anthropic API.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static void applyTools(MessageCreateParams.Builder builder, List<ToolSchema> tools, GenerateOptions options)static | 应用工具。 Apply tools to the message create params builder. |
public static void applyTools(MessageCreateParams.Builder builder, List<ToolSchema> tools, GenerateOptions options, String cacheTtl)static | 应用工具。 Apply tools to the message create params builder with an optional cache TTL. |
public static void applyOptions(MessageCreateParams.Builder builder, GenerateOptions options, GenerateOptions defaultOptions)static | 应用选项。 Apply generation options to the builder. |
方法详情Method Detail
applyTools
public static void applyTools(MessageCreateParams.Builder builder, List<ToolSchema> tools, GenerateOptions options)
static
应用工具。
Apply tools to the message create params builder.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
builder | MessageCreateParams.Builder | 消息创建参数构建器。The message create params builder |
tools | List<ToolSchema> | 工具模式的列出。List of tool schemas |
options | GenerateOptions | 选项(类型 `GenerateOptions`)。Generate options containing tool choice |
源码Source
io/agentscope/extensions/model/anthropic/formatter/AnthropicToolsHelper.java:54–57applyTools
public static void applyTools(MessageCreateParams.Builder builder, List<ToolSchema> tools, GenerateOptions options, String cacheTtl)
static
应用工具。
Apply tools to the message create params builder with an optional cache TTL.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
builder | MessageCreateParams.Builder | 消息创建参数构建器。The message create params builder |
tools | List<ToolSchema> | 工具模式的列出。List of tool schemas |
options | GenerateOptions | 选项(类型 `GenerateOptions`)。Generate options containing tool choice |
cacheTtl | String | 缓存存活时间(类型 `String`)。TTL for ephemeral cache control (null/empty for default 5m) |
源码Source
io/agentscope/extensions/model/anthropic/formatter/AnthropicToolsHelper.java:67–110applyOptions
public static void applyOptions(MessageCreateParams.Builder builder, GenerateOptions options, GenerateOptions defaultOptions)
static
应用选项。
Apply generation options to the builder.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
builder | MessageCreateParams.Builder | 消息创建参数构建器。The message create params builder |
options | GenerateOptions | 选项(类型 `GenerateOptions`)。Generate options |
defaultOptions | GenerateOptions | 默认选项(类型 `GenerateOptions`)。Default generate options |
源码Source
io/agentscope/extensions/model/anthropic/formatter/AnthropicToolsHelper.java:182–222