Liking cljdoc? Tell your friends :D

hyperphor.ellum.core


-completecljmultimethod

source

-complete-streamcljmultimethod

source

-key-statuscljmultimethod

source

-list-modelscljmultimethod

source

array-schemaclj

source

chatclj

(chat & [opts])

Create a stateful chat session. Returns a map with :send! and :history functions.

Options: :provider :model :system :tools :max-tokens

Create a stateful chat session. Returns a map with :send! and :history functions.

Options: :provider :model :system :tools :max-tokens
sourceraw docstring

completeclj

(complete req)

Call the LLM and return a normalized response map.

Request keys: :provider - :openai or :anthropic (required) :model - model string (optional, defaults to provider's default) :messages - vector of {:role :user/:assistant, :content "..."} (required) :system - system prompt string (optional) :tools - vector of tool defs {:name :description :parameters :fn} (optional) :max-tokens - max tokens in response (default 4096)

Response keys: :content - string text of response (nil if only tool calls) :tool-calls - vector of {:id :name :arguments} (nil if no tool calls) :stop-reason - :stop :tool-calls :length :content-filter :usage - {:input-tokens N :output-tokens N} :raw - original provider response

Call the LLM and return a normalized response map.

Request keys:
  :provider   - :openai or :anthropic (required)
  :model      - model string (optional, defaults to provider's default)
  :messages   - vector of {:role :user/:assistant, :content "..."} (required)
  :system     - system prompt string (optional)
  :tools      - vector of tool defs {:name :description :parameters :fn} (optional)
  :max-tokens - max tokens in response (default 4096)

Response keys:
  :content    - string text of response (nil if only tool calls)
  :tool-calls - vector of {:id :name :arguments} (nil if no tool calls)
  :stop-reason - :stop :tool-calls :length :content-filter
  :usage      - {:input-tokens N :output-tokens N}
  :raw        - original provider response
sourceraw docstring

complete-streamclj

(complete-stream req)

Like complete but streams SSE events as a lazy seq.

Like complete but streams SSE events as a lazy seq.
sourceraw docstring

extract-codeclj

source

extract-jsonclj

source

key-statusclj

(key-status req)

Get the current rate-limit standing for a provider's API key. req: {:provider :anthropic :model "..."} (:model optional). Currently implemented for :anthropic only — makes a minimal request and returns the provider's rate-limit response headers as {:requests {:limit :remaining :reset} :tokens {...} :input-tokens {...} :output-tokens {...}}.

Full billing/cost data requires an Anthropic Admin API key (ANTHROPIC_ADMIN_API_KEY, distinct from a standard API key) — see hyperphor.ellum.providers.anthropic/usage-report and /cost-report.

Get the current rate-limit standing for a provider's API key.
req: {:provider :anthropic :model "..."} (:model optional).
Currently implemented for :anthropic only — makes a minimal request and
returns the provider's rate-limit response headers as
{:requests {:limit :remaining :reset} :tokens {...} :input-tokens {...} :output-tokens {...}}.

Full billing/cost data requires an Anthropic Admin API key
(ANTHROPIC_ADMIN_API_KEY, distinct from a standard API key) — see
hyperphor.ellum.providers.anthropic/usage-report and /cost-report.
sourceraw docstring

list-modelsclj

(list-models provider)

List available models for a provider (:openai or :anthropic). Returns a vector of {:id :created :raw} (:name also present for :anthropic).

List available models for a provider (:openai or :anthropic).
Returns a vector of {:id :created :raw} (:name also present for :anthropic).
sourceraw docstring

make-toolclj

source

number-schemaclj

source

object-schemaclj

source

queryclj

(query provider text & {:keys [model system max-tokens tools]})

Convenience: single-turn user query, returns text content string. provider can be :openai or :anthropic. Throws if the provider returns no content (e.g. a refusal or content filter).

Convenience: single-turn user query, returns text content string.
provider can be :openai or :anthropic.
Throws if the provider returns no content (e.g. a refusal or content filter).
sourceraw docstring

query-jsonclj

(query-json provider text & {:as opts})

Run a query and attempt to parse the response as JSON. Returns [parsed-json remaining-text] or nil.

Run a query and attempt to parse the response as JSON.
Returns [parsed-json remaining-text] or nil.
sourceraw docstring

query-structuredclj

(query-structured provider
                  text
                  schema-name
                  json-schema
                  &
                  {:keys [model system max-tokens]})

Run a query with a JSON schema and return the parsed, coerced result. For OpenAI, uses native structured output (response_format). For Anthropic, instructs via system prompt and parses JSON from response.

Run a query with a JSON schema and return the parsed, coerced result.
For OpenAI, uses native structured output (response_format).
For Anthropic, instructs via system prompt and parses JSON from response.
sourceraw docstring

read-json-safeclj

source

run-agentclj

(run-agent req & {:keys [max-iterations on-tool-call] :or {max-iterations 10}})

Run a provider call with tools, automatically executing tool calls in a loop until the model reaches a :stop reason.

req should include :provider :messages :tools (and optionally :system :model :max-tokens). max-iterations defaults to 10 to prevent infinite loops.

Returns the final normalized response.

Run a provider call with tools, automatically executing tool calls in a loop
until the model reaches a :stop reason.

req should include :provider :messages :tools (and optionally :system :model :max-tokens).
max-iterations defaults to 10 to prevent infinite loops.

Returns the final normalized response.
sourceraw docstring

string-schemaclj

source

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