SimpleAgent 公共构建逻辑
提供 chat-client 构建与结果处理等共享功能。 对话历史由 ChatClient 的 ChatMemory store 自管(Memory Filter 模式), Agent 自身只持 conversation-id + 轻量 state。
SimpleAgent 公共构建逻辑 提供 chat-client 构建与结果处理等共享功能。 对话历史由 ChatClient 的 ChatMemory store 自管(Memory Filter 模式), Agent 自身只持 conversation-id + 轻量 state。
(build-chat-client opts)根据配置 map 构建 ChatClient 实例
参数 opts:
Agent 层不暴露 chat-client filter:此处只挂 memory-filter。 需要自定义 filter 时,请直接用 chat-client/build-chat-client 自建后传 :chat-client。
根据配置 map 构建 ChatClient 实例 参数 opts: - :provider LLM Provider 实例 - :model 模型名称(默认 "glm-4") - :max-tokens 最大生成 token 数(默认 4096) - :temperature 温度参数(可选) - :tools tool var 列表 - :memory ChatMemory store(已解析;以 memory-filter 形态挂进 chat-client) - :max-iterations 最大工具调用循环次数(默认 10) - **其余键一律透传给 provider 调用 config**(见 chat-model-config): 如 Anthropic/MiniMax 的 :thinking、:cache-strategy、:service-tier、:top-k、 :beta、:retry、:timeout 等。编排层自己的键见 orchestration-keys。 Agent 层不暴露 chat-client filter:此处只挂 memory-filter。 需要自定义 filter 时,请直接用 chat-client/build-chat-client 自建后传 :chat-client。
(chat-model-config opts)opts → provider 调用 config(基础值,每次调用可再覆盖)。
排除法而非白名单:早先这里只放行 {:model :max-tokens :temperature}, 于是 provider 专属能力(Anthropic/MiniMax 的 :thinking、:cache-strategy、 :service-tier、:top-k、:beta …)明明在 provider 侧实现了,走 create-agent 却 递不到底——只能自建 ChatClient / ChatModel 绕开 agent 门面。那是「说了能用却用不了」, 不是设计取舍。放行未知键的代价可控:各 provider 的 build-params 只解构自己认识的 键,多余的原样忽略。
opts → provider 调用 config(基础值,每次调用可再覆盖)。
**排除法而非白名单**:早先这里只放行 {:model :max-tokens :temperature},
于是 provider 专属能力(Anthropic/MiniMax 的 :thinking、:cache-strategy、
:service-tier、:top-k、:beta …)明明在 provider 侧实现了,走 create-agent 却
**递不到底**——只能自建 ChatClient / ChatModel 绕开 agent 门面。那是「说了能用却用不了」,
不是设计取舍。放行未知键的代价可控:各 provider 的 build-params 只解构自己认识的
键,多余的原样忽略。cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |