Liking cljdoc? Tell your friends :D

im.ttalk.agent.provider.schema.anthropic

Anthropic Schema 转换

将工具定义转换为 Anthropic API 格式。

Anthropic 的工具格式与 OpenAI 不同:

  • 使用 input_schema 而非 parameters
  • 工具调用使用 content_block 机制

使用示例:

(require '[im.ttalk.agent.provider.schema.anthropic :as schema])

;; 转换单个工具 (schema/tool->schema {:name :calculator :description "计算器" :parameters {...}})

;; 批量转换 (schema/tools->schemas tools)

Anthropic Schema 转换

将工具定义转换为 Anthropic API 格式。

Anthropic 的工具格式与 OpenAI 不同:
- 使用 input_schema 而非 parameters
- 工具调用使用 content_block 机制

使用示例:

(require '[im.ttalk.agent.provider.schema.anthropic :as schema])

;; 转换单个工具
(schema/tool->schema {:name :calculator
                      :description "计算器"
                      :parameters {...}})

;; 批量转换
(schema/tools->schemas tools)
raw docstring

im.ttalk.agent.provider.schema.openai

OpenAI Schema 转换

将工具定义转换为 OpenAI Function Call 格式。

使用示例:

(require '[im.ttalk.agent.provider.schema.openai :as schema])

;; 转换单个工具 (schema/tool->schema {:name :calculator :description "计算器" :parameters {...}})

;; 批量转换 (schema/tools->schemas tools)

OpenAI Schema 转换

将工具定义转换为 OpenAI Function Call 格式。

使用示例:

(require '[im.ttalk.agent.provider.schema.openai :as schema])

;; 转换单个工具
(schema/tool->schema {:name :calculator
                      :description "计算器"
                      :parameters {...}})

;; 批量转换
(schema/tools->schemas tools)
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close