(add-message! chat msg)Append a message to the conversation history.
Append a message to the conversation history.
(assistant-message-from-response response)Build an assistant history message from a normalized response. Preserves tool_calls in the message so the history is valid for re-submission.
Build an assistant history message from a normalized response. Preserves tool_calls in the message so the history is valid for re-submission.
(chat-config chat)Return the non-history config for use in a complete call.
Return the non-history config for use in a complete call.
(clear! chat)Clear the conversation history, keeping configuration.
Clear the conversation history, keeping configuration.
(handle-tool-calls provider tool-defs response)Given a response with tool calls and a tools collection, execute all tool calls and return the result messages to add to history. For Anthropic, packs results into a single user message.
Given a response with tool calls and a tools collection, execute all tool calls and return the result messages to add to history. For Anthropic, packs results into a single user message.
(make-chat &
[{:keys [provider model system tools max-tokens]
:or {provider :openai}}])Create a new chat conversation context. Options: :provider - :openai or :anthropic (default :openai) :model - model string override :system - system prompt string :tools - vector of tool definitions :max-tokens - max tokens per completion
Create a new chat conversation context. Options: :provider - :openai or :anthropic (default :openai) :model - model string override :system - system prompt string :tools - vector of tool definitions :max-tokens - max tokens per completion
(messages chat)Return the current message history.
Return the current message history.
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 |