# ol.llx next Unified LLM API and agent runtime for Clojure, ClojureScript, and Clojure Dart ## ol.llx.agent.driver # ol.llx.agent.driver _platforms: clj, cljs_ Driver loop for the agent runtime. The driver is the sole owner of state transitions. It steps inputs through `ol.llx.agent.loop/step`, interprets resulting effects via `ol.llx.agent.fx/execute-fx`, and feeds resulting signals back into `loop/step`. Multiplexing: - Tracks all active signal channels returned by signal-producing effects. - Includes `command>` in the `alts` set for external commands. - Removes channels when they close. Signal flow: input (command/signal) -> loop/step -> [state', effects] -> execute-fx -> channels + fire-and-forget side effects -> alts over active channels + command> -> loop/step for each received signal -> repeat until active channel set is empty. ## run ### clj _platforms: clj_ ```clojure (run env input) ``` Driver loop. Processes a single input through the state machine, interprets resulting effects, and multiplexes signals from all active channels back through `loop/step` until the system settles. The driver is the sole owner of state transitions — it is the only code that calls `loop/step` and mutates the state atom. Effect interpreters perform side effects but never step the state machine. Multiplexing: The driver maintains a set of active signal channels (from `:call-llm`, `:execute-tool`, etc.) plus the external `command>` channel. It uses `alts` to read from all of them concurrently. Multiple signal-producing effects can be active at once, enabling concurrent tool execution. Signal processing: When a signal arrives from any channel, it is stepped through `loop/step`. The resulting effects are processed: fire-and-forget effects execute inline, signal-producing effects add their channel to the active set. When a channel closes (effect complete), it is removed from the active set. Termination: The driver resolves when the active channel set is empty and all effects from the final step have been processed. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/driver.cljc#L50-L100) ### cljs _platforms: cljs_ ```clojure (run env input) ``` Driver loop. Processes a single input through the state machine, interprets resulting effects, and multiplexes signals from all active channels back through `loop/step` until the system settles. The driver is the sole owner of state transitions — it is the only code that calls `loop/step` and mutates the state atom. Effect interpreters perform side effects but never step the state machine. Multiplexing: The driver maintains a set of active signal channels (from `:call-llm`, `:execute-tool`, etc.) plus the external `command>` channel. It uses `alts` to read from all of them concurrently. Multiple signal-producing effects can be active at once, enabling concurrent tool execution. Signal processing: When a signal arrives from any channel, it is stepped through `loop/step`. The resulting effects are processed: fire-and-forget effects execute inline, signal-producing effects add their channel to the active set. When a channel closes (effect complete), it is removed from the active set. Termination: The driver resolves when the active channel set is empty and all effects from the final step have been processed. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/driver.cljc#L50-L100) ## ol.llx.agent.fx.inference # ol.llx.agent.fx.inference _platforms: clj, cljs_ ## LlmEventStepSignal ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/fx/inference.cljc#L15-L21) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/fx/inference.cljc#L15-L21) --- ## LlmEventStep ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/fx/inference.cljc#L23-L27) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/fx/inference.cljc#L23-L27) --- ## llm-event->step ### clj _platforms: clj_ ```clojure (llm-event->step model partial event) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/fx/inference.cljc#L73-L157) ### cljs _platforms: cljs_ ```clojure (llm-event->step model partial event) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/fx/inference.cljc#L73-L157) --- ## fx-call-llm ### clj _platforms: clj_ ```clojure (fx-call-llm {:keys [state_ convert-to-llm transform-context stream-fn get-api-key abort-signal] :as env} effect) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/fx/inference.cljc#L178-L217) ### cljs _platforms: cljs_ ```clojure (fx-call-llm {:keys [state_ convert-to-llm transform-context stream-fn get-api-key abort-signal] :as env} effect) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/fx/inference.cljc#L178-L217) ## ol.llx.agent.fx.tools # ol.llx.agent.fx.tools _platforms: clj, cljs_ ## fx-execute-tool ### clj _platforms: clj_ ```clojure (fx-execute-tool {:keys [state_ abort-signal schema-registry]} effect) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/fx/tools.cljc#L55-L91) ### cljs _platforms: cljs_ ```clojure (fx-execute-tool {:keys [state_ abort-signal schema-registry]} effect) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/fx/tools.cljc#L55-L91) ## ol.llx.agent.fx # ol.llx.agent.fx _platforms: clj, cljs_ Effect interpreter for the agent runtime. The pure state machine in `ol.llx.agent.loop` emits inert effect maps. This namespace interprets those maps into concrete side effects. Effect categories: Fire-and-forget — synchronous, produce no signals. - `:emit-event` — publish an event to subscribers - `:reject` — report invalid operation state Signal-producing — async, return a channel of signals. - `:call-llm` — perform inference and stream `llm-*` signals - `:execute-tool` — execute a tool and emit `tool-*` signals Signal-producing effects return promesa CSP channels consumed by `ol.llx.agent.driver/run`. ## execute-fx ### clj _platforms: clj_ ```clojure (execute-fx env effect) ``` Interpret a single effect description. Dispatches on `::type`. Fire-and-forget effects (`:emit-event`, `:reject`): Execute the side effect synchronously. Return `nil`. Signal-producing effects (`:call-llm`, `:execute-tool`): Start the async work and return a promesa CSP channel that will emit signal maps. The channel closes when the effect is complete. The driver consumes the channel and steps each signal through `loop/step`. The interpreter must not call `step` or mutate the state atom. `env` carries runtime dependencies: - `:state_` — atom holding current agent state (read-only for fx) - `:events-mx>` — event multiplexer write endpoint - `:convert-to-llm` — `(fn [messages])` transform to LLM messages - `:transform-context` — `(fn [messages abort-signal])` optional context pruning - `:stream-fn` — `(fn [model context opts])` LLM streaming fn - `:abort-signal` — abort token for cancellation [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/fx.cljc#L36-L66) ### cljs _platforms: cljs_ ```clojure (execute-fx env effect) ``` Interpret a single effect description. Dispatches on `::type`. Fire-and-forget effects (`:emit-event`, `:reject`): Execute the side effect synchronously. Return `nil`. Signal-producing effects (`:call-llm`, `:execute-tool`): Start the async work and return a promesa CSP channel that will emit signal maps. The channel closes when the effect is complete. The driver consumes the channel and steps each signal through `loop/step`. The interpreter must not call `step` or mutate the state atom. `env` carries runtime dependencies: - `:state_` — atom holding current agent state (read-only for fx) - `:events-mx>` — event multiplexer write endpoint - `:convert-to-llm` — `(fn [messages])` transform to LLM messages - `:transform-context` — `(fn [messages abort-signal])` optional context pruning - `:stream-fn` — `(fn [model context opts])` LLM streaming fn - `:abort-signal` — abort token for cancellation [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/fx.cljc#L36-L66) ## ol.llx.agent.loop # ol.llx.agent.loop _platforms: clj, cljs_ ## empty-queue ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L5-L7) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L5-L7) --- ## handle-command ### clj _platforms: clj_ ```clojure (handle-command state cmd) ``` Pure command handler. Takes state + command, returns `[state' signals]`. Handles global state mutations directly and translates FSM-driving commands into signals for the graph. Commands that only mutate state (e.g. `:ol.llx.agent.command/steer`) return an empty signals vector. Commands that drive the FSM (e.g. `:ol.llx.agent.command/prompt`) return one or more signals to be fed into the transition functions. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L137-L217) ### cljs _platforms: cljs_ ```clojure (handle-command state cmd) ``` Pure command handler. Takes state + command, returns `[state' signals]`. Handles global state mutations directly and translates FSM-driving commands into signals for the graph. Commands that only mutate state (e.g. `:ol.llx.agent.command/steer`) return an empty signals vector. Commands that drive the FSM (e.g. `:ol.llx.agent.command/prompt`) return one or more signals to be fed into the transition functions. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L137-L217) --- ## idle-transition ### clj _platforms: clj_ ```clojure (idle-transition state msg) ``` Pure transition from ::idle state. Returns [state' effects]. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L219-L248) ### cljs _platforms: cljs_ ```clojure (idle-transition state msg) ``` Pure transition from ::idle state. Returns [state' effects]. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L219-L248) --- ## streaming-transition ### clj _platforms: clj_ ```clojure (streaming-transition state msg) ``` Pure transition from ::streaming state. Returns [state' effects]. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L250-L304) ### cljs _platforms: cljs_ ```clojure (streaming-transition state msg) ``` Pure transition from ::streaming state. Returns [state' effects]. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L250-L304) --- ## tool-executing-transition ### clj _platforms: clj_ ```clojure (tool-executing-transition state msg) ``` Pure transition from ::tool-executing state. Returns [state' effects]. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L306-L331) ### cljs _platforms: cljs_ ```clojure (tool-executing-transition state msg) ``` Pure transition from ::tool-executing state. Returns [state' effects]. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L306-L331) --- ## closed-transition ### clj _platforms: clj_ ```clojure (closed-transition state _msg) ``` Terminal state. No transitions possible. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L333-L336) ### cljs _platforms: cljs_ ```clojure (closed-transition state _msg) ``` Terminal state. No transitions possible. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L333-L336) --- ## route-from-idle ### clj _platforms: clj_ ```clojure (route-from-idle state) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L338-L339) ### cljs _platforms: cljs_ ```clojure (route-from-idle state) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L338-L339) --- ## route-from-streaming ### clj _platforms: clj_ ```clojure (route-from-streaming state) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L341-L342) ### cljs _platforms: cljs_ ```clojure (route-from-streaming state) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L341-L342) --- ## route-from-tool-executing ### clj _platforms: clj_ ```clojure (route-from-tool-executing state) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L344-L349) ### cljs _platforms: cljs_ ```clojure (route-from-tool-executing state) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L344-L349) --- ## command? ### clj _platforms: clj_ ```clojure (command? input) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L351-L353) ### cljs _platforms: cljs_ ```clojure (command? input) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L351-L353) --- ## graph ### clj _platforms: clj_ Agent state machine as data. Transitions: `(state, msg) -> [state', effects]` Pure transition fns. Take current state and a signal, return new state and a vector of effect descriptions to execute. Routes: `(state') -> phase-key` Pure routing fns. Take the post-transition state and return the keyword of the next phase to enter. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L375-L393) ### cljs _platforms: cljs_ Agent state machine as data. Transitions: `(state, msg) -> [state', effects]` Pure transition fns. Take current state and a signal, return new state and a vector of effect descriptions to execute. Routes: `(state') -> phase-key` Pure routing fns. Take the post-transition state and return the keyword of the next phase to enter. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L375-L393) --- ## step ### clj _platforms: clj_ ```clojure (step state input) (step g state input) ``` Pure step function. Takes state + input (command or signal), returns `[state' effects]`. Commands are processed by `handle-command` which may produce signals. Signals are processed by the graph transition + routing fns. Emits `:ol.llx.agent.event/agent-end` automatically when the agent transitions from a non-idle phase back to `::idle`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L395-L413) ### cljs _platforms: cljs_ ```clojure (step state input) (step g state input) ``` Pure step function. Takes state + input (command or signal), returns `[state' effects]`. Commands are processed by `handle-command` which may produce signals. Signals are processed by the graph transition + routing fns. Emits `:ol.llx.agent.event/agent-end` automatically when the agent transitions from a non-idle phase back to `::idle`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/loop.cljc#L395-L413) ## ol.llx.agent.schema # ol.llx.agent.schema _platforms: clj, cljs_ ## state-atom? ### clj _platforms: clj_ ```clojure (state-atom? x) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L13-L16) ### cljs _platforms: cljs_ ```clojure (state-atom? x) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L13-L16) --- ## queue? ### clj _platforms: clj_ ```clojure (queue? coll) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L18-L21) ### cljs _platforms: cljs_ ```clojure (queue? coll) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L18-L21) --- ## multiplexer? ### clj _platforms: clj_ ```clojure (multiplexer? x) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L23-L25) ### cljs _platforms: cljs_ ```clojure (multiplexer? x) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L23-L25) --- ## schema-registry? ### clj _platforms: clj_ ```clojure (schema-registry? x) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L27-L29) ### cljs _platforms: cljs_ ```clojure (schema-registry? x) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L27-L29) --- ## canonical-message-roles ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L31-L31) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L31-L31) --- ## custom-message-role? ### clj _platforms: clj_ ```clojure (custom-message-role? role) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L33-L36) ### cljs _platforms: cljs_ ```clojure (custom-message-role? role) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L33-L36) --- ## message-dispatch ### clj _platforms: clj_ ```clojure (message-dispatch message) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L38-L40) ### cljs _platforms: cljs_ ```clojure (message-dispatch message) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L38-L40) --- ## schemas ### clj _platforms: clj_ ```clojure (schemas {:keys [custom-message-schemas]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L47-L513) ### cljs _platforms: cljs_ ```clojure (schemas {:keys [custom-message-schemas]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L47-L513) --- ## custom-schemas ### clj _platforms: clj_ ```clojure (custom-schemas opts) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L515-L518) ### cljs _platforms: cljs_ ```clojure (custom-schemas opts) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L515-L518) --- ## registry ### clj _platforms: clj_ ```clojure (registry opts) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L520-L524) ### cljs _platforms: cljs_ ```clojure (registry opts) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L520-L524) --- ## validate! ### clj _platforms: clj_ ```clojure (validate! schema-registry schema-id data) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L529-L538) ### cljs _platforms: cljs_ ```clojure (validate! schema-registry schema-id data) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent/schema.cljc#L529-L538) ## ol.llx.agent # ol.llx.agent _platforms: clj, cljs_ Public runtime wrapper for the agent loop. This namespace wires runtime state, effect environment dependencies, and subscription management around `ol.llx.agent.loop` + `ol.llx.agent.fx`. ## create-initial-state ### clj _platforms: clj_ ```clojure (create-initial-state schema-registry opts) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L24-L35) ### cljs _platforms: cljs_ ```clojure (create-initial-state schema-registry opts) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L24-L35) --- ## default-convert-to-llm ### clj _platforms: clj_ ```clojure (default-convert-to-llm messages) ``` Converts agent messages to LLM-compatible messages by keeping only maps whose `:role` is one of `:user`, `:assistant`, or `:tool-result`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L37-L45) ### cljs _platforms: cljs_ ```clojure (default-convert-to-llm messages) ``` Converts agent messages to LLM-compatible messages by keeping only maps whose `:role` is one of `:user`, `:assistant`, or `:tool-result`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L37-L45) --- ## create-agent ### clj _platforms: clj_ ```clojure (create-agent) (create-agent opts) ``` Creates an agent runtime handle. Required options: - `:tools` vector of tools `opts` may include: - `:convert-to-llm` `(fn [messages])`; defaults to filtering messages to roles `:user`, `:assistant`, `:tool-result` - `:transform-context` optional context transform hook - `:stream-fn` optional stream hook; resolved at callsite - `:schema-registry` extra Malli registry to be composed with the built-in schemas - `:custom-message-schemas` map of message dispatch keyword to schema keyword in the active registry - `:session-id`, `:get-api-key`, `:thinking-budgets`, `:max-retry-delay-ms` - `:system-prompt`, `:model`, `:thinking-level` - `:steering-mode`, `:follow-up-mode` - `:abort-signal` For state rehydration, use [`rehydrate-agent`](#rehydrate-agent). [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L75-L105) ### cljs _platforms: cljs_ ```clojure (create-agent) (create-agent opts) ``` Creates an agent runtime handle. Required options: - `:tools` vector of tools `opts` may include: - `:convert-to-llm` `(fn [messages])`; defaults to filtering messages to roles `:user`, `:assistant`, `:tool-result` - `:transform-context` optional context transform hook - `:stream-fn` optional stream hook; resolved at callsite - `:schema-registry` extra Malli registry to be composed with the built-in schemas - `:custom-message-schemas` map of message dispatch keyword to schema keyword in the active registry - `:session-id`, `:get-api-key`, `:thinking-budgets`, `:max-retry-delay-ms` - `:system-prompt`, `:model`, `:thinking-level` - `:steering-mode`, `:follow-up-mode` - `:abort-signal` For state rehydration, use [`rehydrate-agent`](#rehydrate-agent). [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L75-L105) --- ## rehydrate-agent ### clj _platforms: clj_ ```clojure (rehydrate-agent state opts) ``` Creates an agent runtime from a previously persisted state snapshot. `state` must satisfy `:ol.llx.agent.loop/state`. `opts` carries runtime dependencies and may include: - `:convert-to-llm` (optional; see <>) - `:transform-context` (optional; see <>) - `:stream-fn` (optional; see <>) - `:schema-registry` (optional; see <>) - `:custom-message-schemas` (optional; see <>) - `:session-id`, `:get-api-key`, `:thinking-budgets`, `:max-retry-delay-ms` * `:tools` * `:abort-signal`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L107-L125) ### cljs _platforms: cljs_ ```clojure (rehydrate-agent state opts) ``` Creates an agent runtime from a previously persisted state snapshot. `state` must satisfy `:ol.llx.agent.loop/state`. `opts` carries runtime dependencies and may include: - `:convert-to-llm` (optional; see <>) - `:transform-context` (optional; see <>) - `:stream-fn` (optional; see <>) - `:schema-registry` (optional; see <>) - `:custom-message-schemas` (optional; see <>) - `:session-id`, `:get-api-key`, `:thinking-budgets`, `:max-retry-delay-ms` * `:tools` * `:abort-signal`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L107-L125) --- ## state ### clj _platforms: clj_ ```clojure (state agent) ``` Returns the current agent state snapshot. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L127-L130) ### cljs _platforms: cljs_ ```clojure (state agent) ``` Returns the current agent state snapshot. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L127-L130) --- ## subscribe ### clj _platforms: clj_ ```clojure (subscribe agent) (subscribe agent ch) ``` Subscribes a channel to the agent event stream. * `(subscribe agent)` creates and returns a buffered channel. * `(subscribe agent ch)` taps the provided channel and returns it. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L136-L146) ### cljs _platforms: cljs_ ```clojure (subscribe agent) (subscribe agent ch) ``` Subscribes a channel to the agent event stream. * `(subscribe agent)` creates and returns a buffered channel. * `(subscribe agent ch)` taps the provided channel and returns it. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L136-L146) --- ## unsubscribe ### clj _platforms: clj_ ```clojure (unsubscribe agent ch) ``` Unsubscribes a channel from the agent event stream and closes it. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L148-L153) ### cljs _platforms: cljs_ ```clojure (unsubscribe agent ch) ``` Unsubscribes a channel from the agent event stream and closes it. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L148-L153) --- ## dispatch! ### clj _platforms: clj_ ```clojure (dispatch! agent command) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L155-L158) ### cljs _platforms: cljs_ ```clojure (dispatch! agent command) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L155-L158) --- ## prompt ### clj _platforms: clj_ ```clojure (prompt agent messages) ``` Submits a prompt command to the agent runtime. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L169-L173) ### cljs _platforms: cljs_ ```clojure (prompt agent messages) ``` Submits a prompt command to the agent runtime. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L169-L173) --- ## continue ### clj _platforms: clj_ ```clojure (continue agent) ``` Submits a continue command to the agent runtime. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L175-L178) ### cljs _platforms: cljs_ ```clojure (continue agent) ``` Submits a continue command to the agent runtime. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L175-L178) --- ## abort ### clj _platforms: clj_ ```clojure (abort agent) ``` Submits an abort command to the agent runtime. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L180-L183) ### cljs _platforms: cljs_ ```clojure (abort agent) ``` Submits an abort command to the agent runtime. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L180-L183) --- ## steer ### clj _platforms: clj_ ```clojure (steer agent messages) ``` Queues steering messages. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L185-L188) ### cljs _platforms: cljs_ ```clojure (steer agent messages) ``` Queues steering messages. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L185-L188) --- ## follow-up ### clj _platforms: clj_ ```clojure (follow-up agent messages) ``` Queues follow-up messages. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L190-L193) ### cljs _platforms: cljs_ ```clojure (follow-up agent messages) ``` Queues follow-up messages. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L190-L193) --- ## wait-for-idle ### clj _platforms: clj_ ```clojure (wait-for-idle agent) (wait-for-idle agent max-polls) ``` Waits until the agent reaches `:ol.llx.agent.loop/idle` or `:ol.llx.agent.loop/closed`. Resolves `true` when idle/closed, or `false` after the polling budget is exhausted. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L195-L214) ### cljs _platforms: cljs_ ```clojure (wait-for-idle agent) (wait-for-idle agent max-polls) ``` Waits until the agent reaches `:ol.llx.agent.loop/idle` or `:ol.llx.agent.loop/closed`. Resolves `true` when idle/closed, or `false` after the polling budget is exhausted. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L195-L214) --- ## set-system-prompt ### clj _platforms: clj_ ```clojure (set-system-prompt agent system-prompt) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L216-L219) ### cljs _platforms: cljs_ ```clojure (set-system-prompt agent system-prompt) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L216-L219) --- ## set-model ### clj _platforms: clj_ ```clojure (set-model agent model) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L221-L223) ### cljs _platforms: cljs_ ```clojure (set-model agent model) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L221-L223) --- ## set-thinking-level ### clj _platforms: clj_ ```clojure (set-thinking-level agent thinking-level) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L225-L228) ### cljs _platforms: cljs_ ```clojure (set-thinking-level agent thinking-level) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L225-L228) --- ## set-tools ### clj _platforms: clj_ ```clojure (set-tools agent tools) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L230-L232) ### cljs _platforms: cljs_ ```clojure (set-tools agent tools) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L230-L232) --- ## set-steering-mode ### clj _platforms: clj_ ```clojure (set-steering-mode agent mode) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L234-L236) ### cljs _platforms: cljs_ ```clojure (set-steering-mode agent mode) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L234-L236) --- ## set-follow-up-mode ### clj _platforms: clj_ ```clojure (set-follow-up-mode agent mode) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L238-L240) ### cljs _platforms: cljs_ ```clojure (set-follow-up-mode agent mode) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L238-L240) --- ## replace-messages ### clj _platforms: clj_ ```clojure (replace-messages agent messages) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L242-L245) ### cljs _platforms: cljs_ ```clojure (replace-messages agent messages) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L242-L245) --- ## append-message ### clj _platforms: clj_ ```clojure (append-message agent message) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L247-L250) ### cljs _platforms: cljs_ ```clojure (append-message agent message) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L247-L250) --- ## clear-messages ### clj _platforms: clj_ ```clojure (clear-messages agent) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L252-L254) ### cljs _platforms: cljs_ ```clojure (clear-messages agent) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L252-L254) --- ## clear-steering-queue ### clj _platforms: clj_ ```clojure (clear-steering-queue agent) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L256-L258) ### cljs _platforms: cljs_ ```clojure (clear-steering-queue agent) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L256-L258) --- ## clear-follow-up-queue ### clj _platforms: clj_ ```clojure (clear-follow-up-queue agent) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L260-L262) ### cljs _platforms: cljs_ ```clojure (clear-follow-up-queue agent) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L260-L262) --- ## clear-all-queues ### clj _platforms: clj_ ```clojure (clear-all-queues agent) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L264-L266) ### cljs _platforms: cljs_ ```clojure (clear-all-queues agent) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L264-L266) --- ## reset ### clj _platforms: clj_ ```clojure (reset agent) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L268-L270) ### cljs _platforms: cljs_ ```clojure (reset agent) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L268-L270) --- ## close ### clj _platforms: clj_ ```clojure (close agent) ``` Closes the command channel and marks state as closed. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L272-L278) ### cljs _platforms: cljs_ ```clojure (close agent) ``` Closes the command channel and marks state as closed. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/agent.cljc#L272-L278) ## ol.llx.ai.errors # ol.llx.ai.errors _platforms: clj, cljs_ ## llx-error? ### clj _platforms: clj_ ```clojure (llx-error? ex) ``` Returns true when `ex` is a structured LLX error exception. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L5-L8) ### cljs _platforms: cljs_ ```clojure (llx-error? ex) ``` Returns true when `ex` is a structured LLX error exception. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L5-L8) --- ## recoverable? ### clj _platforms: clj_ ```clojure (recoverable? ex) ``` Returns true when `ex` is classified as recoverable. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L10-L13) ### cljs _platforms: cljs_ ```clojure (recoverable? ex) ``` Returns true when `ex` is classified as recoverable. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L10-L13) --- ## rate-limit-error? ### clj _platforms: clj_ ```clojure (rate-limit-error? ex) ``` Returns true when `ex` is a rate-limit error. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L15-L18) ### cljs _platforms: cljs_ ```clojure (rate-limit-error? ex) ``` Returns true when `ex` is a rate-limit error. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L15-L18) --- ## quota-exceeded-error? ### clj _platforms: clj_ ```clojure (quota-exceeded-error? ex) ``` Returns true when `ex` is a quota-exceeded error. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L20-L23) ### cljs _platforms: cljs_ ```clojure (quota-exceeded-error? ex) ``` Returns true when `ex` is a quota-exceeded error. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L20-L23) --- ## rate-limited-error? ### clj _platforms: clj_ ```clojure (rate-limited-error? ex) ``` Returns true when `ex` is either a rate-limit or quota-exceeded error. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L25-L28) ### cljs _platforms: cljs_ ```clojure (rate-limited-error? ex) ``` Returns true when `ex` is either a rate-limit or quota-exceeded error. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L25-L28) --- ## timeout-error? ### clj _platforms: clj_ ```clojure (timeout-error? ex) ``` Returns true when `ex` is a timeout error. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L30-L33) ### cljs _platforms: cljs_ ```clojure (timeout-error? ex) ``` Returns true when `ex` is a timeout error. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L30-L33) --- ## client-error? ### clj _platforms: clj_ ```clojure (client-error? ex) ``` Returns true when `ex` is a non-recoverable client-classified error. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L35-L38) ### cljs _platforms: cljs_ ```clojure (client-error? ex) ``` Returns true when `ex` is a non-recoverable client-classified error. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L35-L38) --- ## transient-error? ### clj _platforms: clj_ ```clojure (transient-error? ex) ``` Returns true when `ex` is a transient error eligible for retry handling. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L40-L43) ### cljs _platforms: cljs_ ```clojure (transient-error? ex) ``` Returns true when `ex` is a transient error eligible for retry handling. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L40-L43) --- ## should-retry? ### clj _platforms: clj_ ```clojure (should-retry? ex) (should-retry? ex & opts) ``` Returns true when retry policy allows another attempt for `ex`. Optional keyword arguments include `:max-retries` and `:current-retry`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L45-L52) ### cljs _platforms: cljs_ ```clojure (should-retry? ex) (should-retry? ex & opts) ``` Returns true when retry policy allows another attempt for `ex`. Optional keyword arguments include `:max-retries` and `:current-retry`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L45-L52) --- ## retry-delay-ms ### clj _platforms: clj_ ```clojure (retry-delay-ms ex retry-count) ``` Returns the retry delay in milliseconds for `ex` at `retry-count`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L54-L57) ### cljs _platforms: cljs_ ```clojure (retry-delay-ms ex retry-count) ``` Returns the retry delay in milliseconds for `ex` at `retry-count`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/errors.cljc#L54-L57) ## ol.llx.ai.impl.adapters.anthropic-messages # ol.llx.ai.impl.adapters.anthropic-messages _platforms: clj, cljs_ ## normalize-tool-call-id ### clj _platforms: clj_ ```clojure (normalize-tool-call-id tool-call-id _target-model _source-assistant-message) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L43-L49) ### cljs _platforms: cljs_ ```clojure (normalize-tool-call-id tool-call-id _target-model _source-assistant-message) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L43-L49) --- ## build-request ### clj _platforms: clj_ ```clojure (build-request env model context opts) (build-request env model context opts stream?) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L202-L277) ### cljs _platforms: cljs_ ```clojure (build-request env model context opts) (build-request env model context opts stream?) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L202-L277) --- ## finalize ### clj _platforms: clj_ ```clojure (finalize env state-or-response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L309-L331) ### cljs _platforms: cljs_ ```clojure (finalize env state-or-response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L309-L331) --- ## decode-event ### clj _platforms: clj_ ```clojure (decode-event env state raw-chunk) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L358-L475) ### cljs _platforms: cljs_ ```clojure (decode-event env state raw-chunk) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L358-L475) --- ## normalize-error ### clj _platforms: clj_ ```clojure (normalize-error env ex partial-state) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L477-L502) ### cljs _platforms: cljs_ ```clojure (normalize-error env ex partial-state) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L477-L502) --- ## handle-open-stream-response ### clj _platforms: clj_ ```clojure (handle-open-stream-response env model response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L504-L529) ### cljs _platforms: cljs_ ```clojure (handle-open-stream-response env model response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L504-L529) --- ## open-stream ### clj _platforms: clj_ ```clojure (open-stream env _model request-map) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L531-L536) ### cljs _platforms: cljs_ ```clojure (open-stream env _model request-map) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L531-L536) --- ## adapter ### clj _platforms: clj_ ```clojure (adapter) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L538-L549) ### cljs _platforms: cljs_ ```clojure (adapter) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/anthropic_messages.cljc#L538-L549) ## ol.llx.ai.impl.adapters.common # ol.llx.ai.impl.adapters.common _platforms: clj, cljs_ ## trim-trailing-slash ### clj _platforms: clj_ ```clojure (trim-trailing-slash s) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/common.cljc#L3-L9) ### cljs _platforms: cljs_ ```clojure (trim-trailing-slash s) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/common.cljc#L3-L9) --- ## parse-json-safe ### clj _platforms: clj_ ```clojure (parse-json-safe env s) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/common.cljc#L11-L15) ### cljs _platforms: cljs_ ```clojure (parse-json-safe env s) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/common.cljc#L11-L15) --- ## parse-json-lenient ### clj _platforms: clj_ ```clojure (parse-json-lenient env s) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/common.cljc#L17-L23) ### cljs _platforms: cljs_ ```clojure (parse-json-lenient env s) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/common.cljc#L17-L23) --- ## empty-usage ### clj _platforms: clj_ ```clojure (empty-usage) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/common.cljc#L25-L36) ### cljs _platforms: cljs_ ```clojure (empty-usage) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/common.cljc#L25-L36) ## ol.llx.ai.impl.adapters.google-generative-ai # ol.llx.ai.impl.adapters.google-generative-ai _platforms: clj, cljs_ ## normalize-tool-call-id ### clj _platforms: clj_ ```clojure (normalize-tool-call-id tool-call-id target-model _source-assistant-message) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L73-L80) ### cljs _platforms: cljs_ ```clojure (normalize-tool-call-id tool-call-id target-model _source-assistant-message) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L73-L80) --- ## build-request ### clj _platforms: clj_ ```clojure (build-request env model context opts) (build-request env model context opts stream?) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L295-L354) ### cljs _platforms: cljs_ ```clojure (build-request env model context opts) (build-request env model context opts stream?) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L295-L354) --- ## decode-event ### clj _platforms: clj_ ```clojure (decode-event env state raw-chunk) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L472-L497) ### cljs _platforms: cljs_ ```clojure (decode-event env state raw-chunk) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L472-L497) --- ## finalize ### clj _platforms: clj_ ```clojure (finalize env state-or-response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L551-L562) ### cljs _platforms: cljs_ ```clojure (finalize env state-or-response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L551-L562) --- ## normalize-error ### clj _platforms: clj_ ```clojure (normalize-error env ex partial-state) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L564-L589) ### cljs _platforms: cljs_ ```clojure (normalize-error env ex partial-state) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L564-L589) --- ## handle-open-stream-response ### clj _platforms: clj_ ```clojure (handle-open-stream-response env model response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L591-L616) ### cljs _platforms: cljs_ ```clojure (handle-open-stream-response env model response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L591-L616) --- ## open-stream ### clj _platforms: clj_ ```clojure (open-stream env _model request-map) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L618-L623) ### cljs _platforms: cljs_ ```clojure (open-stream env _model request-map) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L618-L623) --- ## adapter ### clj _platforms: clj_ ```clojure (adapter) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L625-L635) ### cljs _platforms: cljs_ ```clojure (adapter) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/google_generative_ai.cljc#L625-L635) ## ol.llx.ai.impl.adapters.openai-codex-responses # ol.llx.ai.impl.adapters.openai-codex-responses _platforms: clj, cljs_ ## build-request ### clj _platforms: clj_ ```clojure (build-request env model context opts) (build-request env model context opts stream?) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_codex_responses.cljc#L59-L85) ### cljs _platforms: cljs_ ```clojure (build-request env model context opts) (build-request env model context opts stream?) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_codex_responses.cljc#L59-L85) --- ## decode-event ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_codex_responses.cljc#L87-L88) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_codex_responses.cljc#L87-L88) --- ## finalize ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_codex_responses.cljc#L90-L91) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_codex_responses.cljc#L90-L91) --- ## normalize-error ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_codex_responses.cljc#L93-L94) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_codex_responses.cljc#L93-L94) --- ## open-stream ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_codex_responses.cljc#L96-L97) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_codex_responses.cljc#L96-L97) --- ## normalize-tool-call-id ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_codex_responses.cljc#L99-L100) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_codex_responses.cljc#L99-L100) --- ## adapter ### clj _platforms: clj_ ```clojure (adapter) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_codex_responses.cljc#L102-L113) ### cljs _platforms: cljs_ ```clojure (adapter) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_codex_responses.cljc#L102-L113) ## ol.llx.ai.impl.adapters.openai-completions # ol.llx.ai.impl.adapters.openai-completions _platforms: clj, cljs_ ## build-request ### clj _platforms: clj_ ```clojure (build-request env model context opts) (build-request env model context opts stream?) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L246-L317) ### cljs _platforms: cljs_ ```clojure (build-request env model context opts) (build-request env model context opts stream?) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L246-L317) --- ## response->assistant-message ### clj _platforms: clj_ ```clojure (response->assistant-message env model response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L357-L380) ### cljs _platforms: cljs_ ```clojure (response->assistant-message env model response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L357-L380) --- ## init-stream-state ### clj _platforms: clj_ ```clojure (init-stream-state env model) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L382-L394) ### cljs _platforms: cljs_ ```clojure (init-stream-state env model) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L382-L394) --- ## decode-event ### clj _platforms: clj_ ```clojure (decode-event env state raw-chunk) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L596-L606) ### cljs _platforms: cljs_ ```clojure (decode-event env state raw-chunk) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L596-L606) --- ## finalize ### clj _platforms: clj_ ```clojure (finalize env state-or-response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L608-L619) ### cljs _platforms: cljs_ ```clojure (finalize env state-or-response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L608-L619) --- ## normalize-error ### clj _platforms: clj_ ```clojure (normalize-error env ex partial-state) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L621-L646) ### cljs _platforms: cljs_ ```clojure (normalize-error env ex partial-state) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L621-L646) --- ## handle-open-stream-response ### clj _platforms: clj_ ```clojure (handle-open-stream-response env model response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L648-L673) ### cljs _platforms: cljs_ ```clojure (handle-open-stream-response env model response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L648-L673) --- ## open-stream ### clj _platforms: clj_ ```clojure (open-stream env _model request-map) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L675-L680) ### cljs _platforms: cljs_ ```clojure (open-stream env _model request-map) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L675-L680) --- ## normalize-tool-call-id ### clj _platforms: clj_ ```clojure (normalize-tool-call-id tool-call-id target-model source-assistant-message) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L742-L761) ### cljs _platforms: cljs_ ```clojure (normalize-tool-call-id tool-call-id target-model source-assistant-message) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L742-L761) --- ## adapter ### clj _platforms: clj_ ```clojure (adapter) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L763-L774) ### cljs _platforms: cljs_ ```clojure (adapter) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_completions.cljc#L763-L774) ## ol.llx.ai.impl.adapters.openai-responses # ol.llx.ai.impl.adapters.openai-responses _platforms: clj, cljs_ ## normalize-tool-call-id ### clj _platforms: clj_ ```clojure (normalize-tool-call-id tool-call-id target-model _source-assistant-message) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L69-L81) ### cljs _platforms: cljs_ ```clojure (normalize-tool-call-id tool-call-id target-model _source-assistant-message) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L69-L81) --- ## build-request ### clj _platforms: clj_ ```clojure (build-request env model context opts) (build-request env model context opts stream?) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L275-L331) ### cljs _platforms: cljs_ ```clojure (build-request env model context opts) (build-request env model context opts stream?) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L275-L331) --- ## decode-event ### clj _platforms: clj_ ```clojure (decode-event env state raw-chunk) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L357-L569) ### cljs _platforms: cljs_ ```clojure (decode-event env state raw-chunk) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L357-L569) --- ## finalize ### clj _platforms: clj_ ```clojure (finalize env state-or-response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L633-L641) ### cljs _platforms: cljs_ ```clojure (finalize env state-or-response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L633-L641) --- ## normalize-error ### clj _platforms: clj_ ```clojure (normalize-error env ex partial-state) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L643-L668) ### cljs _platforms: cljs_ ```clojure (normalize-error env ex partial-state) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L643-L668) --- ## handle-open-stream-response ### clj _platforms: clj_ ```clojure (handle-open-stream-response env model response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L670-L695) ### cljs _platforms: cljs_ ```clojure (handle-open-stream-response env model response) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L670-L695) --- ## open-stream ### clj _platforms: clj_ ```clojure (open-stream env _model request-map) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L697-L702) ### cljs _platforms: cljs_ ```clojure (open-stream env _model request-map) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L697-L702) --- ## adapter ### clj _platforms: clj_ ```clojure (adapter) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L704-L715) ### cljs _platforms: cljs_ ```clojure (adapter) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/adapters/openai_responses.cljc#L704-L715) ## ol.llx.ai.impl.client.event-stream # ol.llx.ai.impl.client.event-stream _platforms: clj, cljs_ Shared stream runtime orchestration for all hosts. ## Why Host runtimes should differ only in transport concerns (how bytes arrive, how cancellation reaches the underlying request). Event decoding, lifecycle emission, finalize behavior, and terminal error handling must stay identical. ## What This namespace owns the shared stream loop: - opens a provider stream with retry policy - emits canonical `:start` / delta / `:done` events - converts runtime failures into canonical terminal error events - coordinates cancellation across producer/source and consumer/output channel ## How Hosts inject two hooks: - `:open-stream!` to acquire the transport stream response - `:start-source!` to push provider payloads onto `payload-ch` The shared loop consumes payload/control channels with Promesa CSP, applies adapter decode/finalize functions, and emits canonical events to `out`. ## Related Namespaces * [`ol.llx.ai.impl.client.jvm`](api/ol-llx-ai-impl-client-jvm.adoc) * [`ol.llx.ai.impl.client.node`](api/ol-llx-ai-impl-client-node.adoc) * [`ol.llx.ai.impl.client`](api/ol-llx-ai-impl-client.adoc) ## await! ### clj _platforms: clj_ ```clojure (await! x) (await! x duration default-on-timeout) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L48-L62) ### cljs _platforms: cljs_ ```clojure (await! x) (await! x _duration default-on-timeout) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L65-L71) --- ## open-stream-with-retries* ### clj _platforms: clj_ ```clojure (open-stream-with-retries* {:keys [adapter env model request request-opts]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L73-L92) ### cljs _platforms: cljs_ ```clojure (open-stream-with-retries* {:keys [adapter env model request request-opts]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L73-L92) --- ## emit-events* ### clj _platforms: clj_ ```clojure (emit-events* {:keys [emit! cancel-fn events]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L94-L108) ### cljs _platforms: cljs_ ```clojure (emit-events* {:keys [emit! cancel-fn events]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L94-L108) --- ## emit-start* ### clj _platforms: clj_ ```clojure (emit-start* {:keys [emit! cancel-fn env model]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L110-L124) ### cljs _platforms: cljs_ ```clojure (emit-start* {:keys [emit! cancel-fn env model]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L110-L124) --- ## decode-payload-step ### clj _platforms: clj_ ```clojure (decode-payload-step {:keys [adapter env model state item-index payload]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L126-L145) ### cljs _platforms: cljs_ ```clojure (decode-payload-step {:keys [adapter env model state item-index payload]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L126-L145) --- ## process-payload-step* ### clj _platforms: clj_ ```clojure (process-payload-step* {:keys [adapter env model state* emit! cancel-fn]} item-index payload) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L147-L163) ### cljs _platforms: cljs_ ```clojure (process-payload-step* {:keys [adapter env model state* emit! cancel-fn]} item-index payload) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L147-L163) --- ## finalize-step ### clj _platforms: clj_ ```clojure (finalize-step {:keys [adapter env state]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L165-L172) ### cljs _platforms: cljs_ ```clojure (finalize-step {:keys [adapter env state]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L165-L172) --- ## finalize-stream* ### clj _platforms: clj_ ```clojure (finalize-stream* {:keys [adapter env model state* emit! cancel-fn]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L174-L194) ### cljs _platforms: cljs_ ```clojure (finalize-stream* {:keys [adapter env model state* emit! cancel-fn]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L174-L194) --- ## emit-terminal-error* ### clj _platforms: clj_ ```clojure (emit-terminal-error* {:keys [adapter env model state* emit!]} stream-ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L196-L199) ### cljs _platforms: cljs_ ```clojure (emit-terminal-error* {:keys [adapter env model state* emit!]} stream-ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L196-L199) --- ## payload-msg ### clj _platforms: clj_ ```clojure (payload-msg payload) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L201-L203) ### cljs _platforms: cljs_ ```clojure (payload-msg payload) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L201-L203) --- ## error-msg ### clj _platforms: clj_ ```clojure (error-msg ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L205-L207) ### cljs _platforms: cljs_ ```clojure (error-msg ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L205-L207) --- ## run-stream! ### clj _platforms: clj_ ```clojure (run-stream! {:keys [adapter env model request out state* cancel! start-source! open-stream!] :as args}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L220-L330) ### cljs _platforms: cljs_ ```clojure (run-stream! {:keys [adapter env model request out state* cancel! start-source! open-stream!] :as args}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/event_stream.cljc#L220-L330) ## ol.llx.ai.impl.client.jvm # ol.llx.ai.impl.client.jvm ## start-jvm-source! ```clojure (start-jvm-source! {:keys [response payload-ch cancelled?] :as input}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/jvm.clj#L62-L88) --- ## open-stream-jvm! ```clojure (open-stream-jvm! {:keys [adapter env model request request-opts]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/jvm.clj#L90-L106) --- ## run-stream! ```clojure (run-stream! {:keys [adapter env model request request-opts] :as input}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/jvm.clj#L108-L126) --- ## default-env ```clojure (default-env) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/jvm.clj#L128-L144) ## ol.llx.ai.impl.client.node # ol.llx.ai.impl.client.node ## start-node-source! ```clojure (start-node-source! {:keys [response payload-ch cancelled?] :as input}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/node.cljs#L107-L164) --- ## run-stream! ```clojure (run-stream! {:keys [adapter env model request request-opts] :as input}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/node.cljs#L166-L216) --- ## default-env ```clojure (default-env) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client/node.cljs#L218-L240) ## ol.llx.ai.impl.client # ol.llx.ai.impl.client _platforms: clj, cljs_ ## default-registry ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L23-L39) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L23-L39) --- ## unified-opts->request-opts ### clj _platforms: clj_ ```clojure (unified-opts->request-opts model unified-opts) ``` Converts unified options to provider-path request options. See [`ol.llx.ai/complete`](api/ol-llx-ai.adoc#complete) and [`ol.llx.ai/stream`](api/ol-llx-ai.adoc#stream) for unified option semantics. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L88-L106) ### cljs _platforms: cljs_ ```clojure (unified-opts->request-opts model unified-opts) ``` Converts unified options to provider-path request options. See [`ol.llx.ai/complete`](api/ol-llx-ai.adoc#complete) and [`ol.llx.ai/stream`](api/ol-llx-ai.adoc#stream) for unified option semantics. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L88-L106) --- ## provider-from-host ### clj _platforms: clj_ ```clojure (provider-from-host host) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L146-L156) ### cljs _platforms: cljs_ ```clojure (provider-from-host host) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L146-L156) --- ## runtime-data-line->payload ### clj _platforms: clj_ ```clojure (runtime-data-line->payload line) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L210-L215) ### cljs _platforms: cljs_ ```clojure (runtime-data-line->payload line) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L210-L215) --- ## runtime-fallback-error-message ### clj _platforms: clj_ ```clojure (runtime-fallback-error-message stream-ex normalize-ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L217-L222) ### cljs _platforms: cljs_ ```clojure (runtime-fallback-error-message stream-ex normalize-ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L217-L222) --- ## runtime-fallback-assistant-message ### clj _platforms: clj_ ```clojure (runtime-fallback-assistant-message env model stream-ex normalize-ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L224-L239) ### cljs _platforms: cljs_ ```clojure (runtime-fallback-assistant-message env model stream-ex normalize-ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L224-L239) --- ## runtime-payload->provider-item-type ### clj _platforms: clj_ ```clojure (runtime-payload->provider-item-type env payload) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L241-L248) ### cljs _platforms: cljs_ ```clojure (runtime-payload->provider-item-type env payload) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L241-L248) --- ## runtime-split-lines ### clj _platforms: clj_ ```clojure (runtime-split-lines buffer) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L250-L254) ### cljs _platforms: cljs_ ```clojure (runtime-split-lines buffer) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L250-L254) --- ## runtime-terminal-error-event ### clj _platforms: clj_ ```clojure (runtime-terminal-error-event adapter env model state* stream-ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L269-L290) ### cljs _platforms: cljs_ ```clojure (runtime-terminal-error-event adapter env model state* stream-ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L269-L290) --- ## complete* ### clj _platforms: clj_ ```clojure (complete* env model context opts) ``` See [`ol.llx.ai/complete*`](api/ol-llx-ai.adoc#complete-STAR-) [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L292-L366) ### cljs _platforms: cljs_ ```clojure (complete* env model context opts) ``` See [`ol.llx.ai/complete*`](api/ol-llx-ai.adoc#complete-STAR-) [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L292-L366) --- ## stream* ### clj _platforms: clj_ ```clojure (stream* env model context opts) ``` See [`ol.llx.ai/stream*`](api/ol-llx-ai.adoc#stream-STAR-) [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L368-L438) ### cljs _platforms: cljs_ ```clojure (stream* env model context opts) ``` See [`ol.llx.ai/stream*`](api/ol-llx-ai.adoc#stream-STAR-) [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L368-L438) --- ## stream ### clj _platforms: clj_ ```clojure (stream env model context unified-opts) ``` See [`ol.llx.ai/stream`](api/ol-llx-ai.adoc#stream) [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L440-L445) ### cljs _platforms: cljs_ ```clojure (stream env model context unified-opts) ``` See [`ol.llx.ai/stream`](api/ol-llx-ai.adoc#stream) [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L440-L445) --- ## complete ### clj _platforms: clj_ ```clojure (complete env model context unified-opts) ``` See [`ol.llx.ai/complete`](api/ol-llx-ai.adoc#complete) [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L447-L452) ### cljs _platforms: cljs_ ```clojure (complete env model context unified-opts) ``` See [`ol.llx.ai/complete`](api/ol-llx-ai.adoc#complete) [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/client.cljc#L447-L452) ## ol.llx.ai.impl.errors # ol.llx.ai.impl.errors _platforms: clj, cljs_ ## client-errors ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L7-L17) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L7-L17) --- ## transient-errors ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L19-L23) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L19-L23) --- ## response-errors ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L25-L27) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L25-L27) --- ## all-error-types ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L29-L30) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L29-L30) --- ## rate-limit ### clj _platforms: clj_ ```clojure (rate-limit provider message & {:keys [http-status retry-after request-id provider-code]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L46-L55) ### cljs _platforms: cljs_ ```clojure (rate-limit provider message & {:keys [http-status retry-after request-id provider-code]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L46-L55) --- ## server-error ### clj _platforms: clj_ ```clojure (server-error provider message & {:keys [http-status provider-code request-id]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L57-L65) ### cljs _platforms: cljs_ ```clojure (server-error provider message & {:keys [http-status provider-code request-id]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L57-L65) --- ## timeout-error ### clj _platforms: clj_ ```clojure (timeout-error provider message & {:keys [timeout-ms request-id]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L67-L74) ### cljs _platforms: cljs_ ```clojure (timeout-error provider message & {:keys [timeout-ms request-id]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L67-L74) --- ## connection-error ### clj _platforms: clj_ ```clojure (connection-error provider message & {:keys [request-id]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L76-L82) ### cljs _platforms: cljs_ ```clojure (connection-error provider message & {:keys [request-id]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L76-L82) --- ## authentication-error ### clj _platforms: clj_ ```clojure (authentication-error provider message & {:keys [http-status]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L84-L90) ### cljs _platforms: cljs_ ```clojure (authentication-error provider message & {:keys [http-status]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L84-L90) --- ## authorization-error ### clj _platforms: clj_ ```clojure (authorization-error provider message & {:keys [http-status]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L92-L98) ### cljs _platforms: cljs_ ```clojure (authorization-error provider message & {:keys [http-status]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L92-L98) --- ## invalid-request ### clj _platforms: clj_ ```clojure (invalid-request message & {:keys [provider http-status context]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L100-L107) ### cljs _platforms: cljs_ ```clojure (invalid-request message & {:keys [provider http-status context]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L100-L107) --- ## model-not-found ### clj _platforms: clj_ ```clojure (model-not-found provider message & {:keys [http-status]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L109-L115) ### cljs _platforms: cljs_ ```clojure (model-not-found provider message & {:keys [http-status]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L109-L115) --- ## quota-exceeded ### clj _platforms: clj_ ```clojure (quota-exceeded provider message & {:keys [http-status]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L117-L123) ### cljs _platforms: cljs_ ```clojure (quota-exceeded provider message & {:keys [http-status]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L117-L123) --- ## retry-delay-exceeded ### clj _platforms: clj_ ```clojure (retry-delay-exceeded provider requested-delay-ms max-delay-ms & {:keys [request-id]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L125-L141) ### cljs _platforms: cljs_ ```clojure (retry-delay-exceeded provider requested-delay-ms max-delay-ms & {:keys [request-id]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L125-L141) --- ## content-filter ### clj _platforms: clj_ ```clojure (content-filter provider message & {:keys [provider-code]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L143-L149) ### cljs _platforms: cljs_ ```clojure (content-filter provider message & {:keys [provider-code]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L143-L149) --- ## invalid-response ### clj _platforms: clj_ ```clojure (invalid-response provider message & {:keys [context]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L151-L157) ### cljs _platforms: cljs_ ```clojure (invalid-response provider message & {:keys [context]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L151-L157) --- ## streaming-error ### clj _platforms: clj_ ```clojure (streaming-error provider message & {:keys [recoverable?]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L159-L164) ### cljs _platforms: cljs_ ```clojure (streaming-error provider message & {:keys [recoverable?]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L159-L164) --- ## provider-error ### clj _platforms: clj_ ```clojure (provider-error provider message & {:keys [http-status provider-code request-id recoverable?]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L166-L174) ### cljs _platforms: cljs_ ```clojure (provider-error provider message & {:keys [http-status provider-code request-id recoverable?]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L166-L174) --- ## unsupported-reasoning-level ### clj _platforms: clj_ ```clojure (unsupported-reasoning-level model-id requested-level) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L176-L184) ### cljs _platforms: cljs_ ```clojure (unsupported-reasoning-level model-id requested-level) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L176-L184) --- ## tool-not-found ### clj _platforms: clj_ ```clojure (tool-not-found tool-name available-tools) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L186-L195) ### cljs _platforms: cljs_ ```clojure (tool-not-found tool-name available-tools) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L186-L195) --- ## validation-error ### clj _platforms: clj_ ```clojure (validation-error tool-name args errors) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L197-L208) ### cljs _platforms: cljs_ ```clojure (validation-error tool-name args errors) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L197-L208) --- ## http-status->error ### clj _platforms: clj_ ```clojure (http-status->error status provider message & {:keys [provider-code retry-after request-id body]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L210-L230) ### cljs _platforms: cljs_ ```clojure (http-status->error status provider message & {:keys [provider-code retry-after request-id body]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L210-L230) --- ## extract-retry-after ### clj _platforms: clj_ ```clojure (extract-retry-after headers & {:keys [max-seconds] :or {max-seconds 60}}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L243-L254) ### cljs _platforms: cljs_ ```clojure (extract-retry-after headers & {:keys [max-seconds] :or {max-seconds 60}}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L243-L254) --- ## extract-retry-after-from-message ### clj _platforms: clj_ ```clojure (extract-retry-after-from-message message & {:keys [max-seconds] :or {max-seconds 60}}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L256-L264) ### cljs _platforms: cljs_ ```clojure (extract-retry-after-from-message message & {:keys [max-seconds] :or {max-seconds 60}}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L256-L264) --- ## extract-retry-after-hint ### clj _platforms: clj_ ```clojure (extract-retry-after-hint headers message & {:keys [max-seconds] :or {max-seconds 60}}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L266-L269) ### cljs _platforms: cljs_ ```clojure (extract-retry-after-hint headers message & {:keys [max-seconds] :or {max-seconds 60}}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L266-L269) --- ## llx-error? ### clj _platforms: clj_ ```clojure (llx-error? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L271-L274) ### cljs _platforms: cljs_ ```clojure (llx-error? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L271-L274) --- ## recoverable? ### clj _platforms: clj_ ```clojure (recoverable? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L276-L279) ### cljs _platforms: cljs_ ```clojure (recoverable? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L276-L279) --- ## rate-limit-error? ### clj _platforms: clj_ ```clojure (rate-limit-error? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L281-L284) ### cljs _platforms: cljs_ ```clojure (rate-limit-error? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L281-L284) --- ## quota-exceeded-error? ### clj _platforms: clj_ ```clojure (quota-exceeded-error? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L286-L289) ### cljs _platforms: cljs_ ```clojure (quota-exceeded-error? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L286-L289) --- ## rate-limited-error? ### clj _platforms: clj_ ```clojure (rate-limited-error? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L291-L294) ### cljs _platforms: cljs_ ```clojure (rate-limited-error? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L291-L294) --- ## timeout-error? ### clj _platforms: clj_ ```clojure (timeout-error? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L296-L299) ### cljs _platforms: cljs_ ```clojure (timeout-error? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L296-L299) --- ## client-error? ### clj _platforms: clj_ ```clojure (client-error? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L301-L304) ### cljs _platforms: cljs_ ```clojure (client-error? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L301-L304) --- ## transient-error? ### clj _platforms: clj_ ```clojure (transient-error? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L306-L309) ### cljs _platforms: cljs_ ```clojure (transient-error? ex) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L306-L309) --- ## should-retry? ### clj _platforms: clj_ ```clojure (should-retry? ex & {:keys [max-retries current-retry] :or {max-retries 2 current-retry 0}}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L311-L315) ### cljs _platforms: cljs_ ```clojure (should-retry? ex & {:keys [max-retries current-retry] :or {max-retries 2 current-retry 0}}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L311-L315) --- ## retry-delay-ms ### clj _platforms: clj_ ```clojure (retry-delay-ms ex retry-count) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L317-L332) ### cljs _platforms: cljs_ ```clojure (retry-delay-ms ex retry-count) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L317-L332) --- ## retry-loop-async ### clj _platforms: clj_ ```clojure (retry-loop-async f max-retries sleep-fn) (retry-loop-async f max-retries sleep-fn {:keys [call-id provider max-retry-delay-ms]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L334-L377) ### cljs _platforms: cljs_ ```clojure (retry-loop-async f max-retries sleep-fn) (retry-loop-async f max-retries sleep-fn {:keys [call-id provider max-retry-delay-ms]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/errors.cljc#L334-L377) ## ol.llx.ai.impl.model-catalog.generate # ol.llx.ai.impl.model-catalog.generate ## supported-provider-rules [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/model_catalog/generate.clj#L10-L14) --- ## default-generated-artifact-path [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/model_catalog/generate.clj#L16-L16) --- ## default-overrides-path [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/model_catalog/generate.clj#L17-L17) --- ## models-dev-url [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/model_catalog/generate.clj#L18-L18) --- ## fetch-models-dev-data ```clojure (fetch-models-dev-data) ``` Fetches and decodes the models.dev catalog JSON as a Clojure map. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/model_catalog/generate.clj#L20-L28) --- ## build-catalog ```clojure (build-catalog {:keys [models-dev-data overrides]}) ``` Builds canonical model entries from models.dev source data and local override patches. `overrides` is a map of `model-id -> patch-map`. Existing source models are patched in a fine-grained way (nested maps merged). If a model id is absent in source, the patch map must include a full valid model definition. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/model_catalog/generate.clj#L201-L221) --- ## render-generated-source ```clojure (render-generated-source catalog) ``` Renders deterministic source for `ol.llx.ai.impl.models-generated` from normalized catalog entries. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/model_catalog/generate.clj#L236-L248) --- ## write-generated-artifact! ```clojure (write-generated-artifact! {:keys [path content]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/model_catalog/generate.clj#L250-L253) --- ## generate-models! ```clojure (generate-models! opts) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/model_catalog/generate.clj#L259-L269) --- ## -main ```clojure (-main & _args) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/model_catalog/generate.clj#L271-L274) ## ol.llx.ai.impl.models-generated # ol.llx.ai.impl.models-generated _platforms: clj, cljs_ ## generated-models ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/models_generated.cljc#L5-L1275) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/models_generated.cljc#L5-L1275) ## ol.llx.ai.impl.models # ol.llx.ai.impl.models _platforms: clj, cljs_ ## get-model ### clj _platforms: clj_ ```clojure (get-model provider model-id) ``` Returns a model map for `provider` and `model-id`, or `nil` when not found. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/models.cljc#L10-L13) ### cljs _platforms: cljs_ ```clojure (get-model provider model-id) ``` Returns a model map for `provider` and `model-id`, or `nil` when not found. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/models.cljc#L10-L13) --- ## get-providers ### clj _platforms: clj_ ```clojure (get-providers) ``` Returns supported providers as a deterministic sorted vector. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/models.cljc#L15-L20) ### cljs _platforms: cljs_ ```clojure (get-providers) ``` Returns supported providers as a deterministic sorted vector. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/models.cljc#L15-L20) --- ## get-models ### clj _platforms: clj_ ```clojure (get-models provider) ``` Returns all models for `provider` as a deterministic vector sorted by `:id`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/models.cljc#L22-L27) ### cljs _platforms: cljs_ ```clojure (get-models provider) ``` Returns all models for `provider` as a deterministic vector sorted by `:id`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/models.cljc#L22-L27) --- ## calculate-cost ### clj _platforms: clj_ ```clojure (calculate-cost model usage) ``` Calculates usage cost totals for `model` rates and `usage` token counts. Returns a map with `:input`, `:output`, `:cache-read`, `:cache-write`, and `:total`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/models.cljc#L29-L51) ### cljs _platforms: cljs_ ```clojure (calculate-cost model usage) ``` Calculates usage cost totals for `model` rates and `usage` token counts. Returns a map with `:input`, `:output`, `:cache-read`, `:cache-write`, and `:total`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/models.cljc#L29-L51) --- ## supports-xhigh? ### clj _platforms: clj_ ```clojure (supports-xhigh? model) ``` Returns true when `model` supports xhigh reasoning effort. Supports explicit capability flags and known model/API compatibility rules. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/models.cljc#L53-L64) ### cljs _platforms: cljs_ ```clojure (supports-xhigh? model) ``` Returns true when `model` supports xhigh reasoning effort. Supports explicit capability flags and known model/API compatibility rules. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/models.cljc#L53-L64) --- ## models-equal? ### clj _platforms: clj_ ```clojure (models-equal? a b) ``` Returns true when both models are non-nil and share the same `:provider` and `:id`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/models.cljc#L66-L72) ### cljs _platforms: cljs_ ```clojure (models-equal? a b) ``` Returns true when both models are non-nil and share the same `:provider` and `:id`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/models.cljc#L66-L72) ## ol.llx.ai.impl.oauth.core # ol.llx.ai.impl.oauth.core _platforms: clj, cljs_ ## refresh-oauth-token ### clj _platforms: clj_ ```clojure (refresh-oauth-token provider-id credentials) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/core.cljc#L17-L24) ### cljs _platforms: cljs_ ```clojure (refresh-oauth-token provider-id credentials) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/core.cljc#L17-L24) --- ## get-oauth-api-key ### clj _platforms: clj_ ```clojure (get-oauth-api-key provider-id credentials-by-provider) (get-oauth-api-key provider-id credentials-by-provider opts) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/core.cljc#L26-L56) ### cljs _platforms: cljs_ ```clojure (get-oauth-api-key provider-id credentials-by-provider) (get-oauth-api-key provider-id credentials-by-provider opts) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/core.cljc#L26-L56) ## ol.llx.ai.impl.oauth.openai-codex-jvm # ol.llx.ai.impl.oauth.openai-codex-jvm ## client-id [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex_jvm.clj#L16-L17) --- ## token-url [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex_jvm.clj#L19-L20) --- ## create-authorization-flow ```clojure (create-authorization-flow) (create-authorization-flow {:keys [originator redirect-uri]}) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex_jvm.clj#L84-L105) --- ## start-local-oauth-server ```clojure (start-local-oauth-server expected-state) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex_jvm.clj#L115-L164) --- ## exchange-authorization-code ```clojure (exchange-authorization-code code verifier) (exchange-authorization-code code verifier redirect-uri) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex_jvm.clj#L204-L212) --- ## refresh-openai-codex-token ```clojure (refresh-openai-codex-token refresh-token) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex_jvm.clj#L214-L227) --- ## oauth-provider [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex_jvm.clj#L229-L244) ## ol.llx.ai.impl.oauth.openai-codex-node # ol.llx.ai.impl.oauth.openai-codex-node ## login-openai-codex ```clojure (login-openai-codex _callbacks) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex_node.cljs#L9-L11) --- ## refresh-openai-codex-token ```clojure (refresh-openai-codex-token _refresh-token) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex_node.cljs#L13-L15) --- ## oauth-provider [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex_node.cljs#L17-L25) ## ol.llx.ai.impl.oauth.openai-codex # ol.llx.ai.impl.oauth.openai-codex _platforms: clj, cljs_ ## token-claim-path ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex.cljc#L6-L7) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex.cljc#L6-L7) --- ## default-redirect-uri ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex.cljc#L9-L10) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex.cljc#L9-L10) --- ## default-authorize-url ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex.cljc#L12-L13) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex.cljc#L12-L13) --- ## default-scope ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex.cljc#L15-L16) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex.cljc#L15-L16) --- ## parse-authorization-input ### clj _platforms: clj_ ```clojure (parse-authorization-input input) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex.cljc#L50-L77) ### cljs _platforms: cljs_ ```clojure (parse-authorization-input input) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex.cljc#L50-L77) --- ## account-id-from-access-token ### clj _platforms: clj_ ```clojure (account-id-from-access-token token) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex.cljc#L99-L110) ### cljs _platforms: cljs_ ```clojure (account-id-from-access-token token) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex.cljc#L99-L110) --- ## login-openai-codex ### clj _platforms: clj_ ```clojure (login-openai-codex callbacks hooks) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex.cljc#L134-L177) ### cljs _platforms: cljs_ ```clojure (login-openai-codex callbacks hooks) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/openai_codex.cljc#L134-L177) ## ol.llx.ai.impl.oauth.registry # ol.llx.ai.impl.oauth.registry _platforms: clj, cljs_ ## register-oauth-provider! ### clj _platforms: clj_ ```clojure (register-oauth-provider! provider) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/registry.cljc#L8-L14) ### cljs _platforms: cljs_ ```clojure (register-oauth-provider! provider) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/registry.cljc#L8-L14) --- ## get-oauth-provider ### clj _platforms: clj_ ```clojure (get-oauth-provider provider-id) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/registry.cljc#L16-L19) ### cljs _platforms: cljs_ ```clojure (get-oauth-provider provider-id) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/registry.cljc#L16-L19) --- ## get-oauth-providers ### clj _platforms: clj_ ```clojure (get-oauth-providers) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/registry.cljc#L21-L25) ### cljs _platforms: cljs_ ```clojure (get-oauth-providers) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/registry.cljc#L21-L25) --- ## clear-oauth-providers! ### clj _platforms: clj_ ```clojure (clear-oauth-providers!) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/registry.cljc#L27-L30) ### cljs _platforms: cljs_ ```clojure (clear-oauth-providers!) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/oauth/registry.cljc#L27-L30) ## ol.llx.ai.impl.registry # ol.llx.ai.impl.registry _platforms: clj, cljs_ ## adapters-key ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L6-L6) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L6-L6) --- ## tools-key ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L7-L7) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L7-L7) --- ## ->MutableRegistry ### clj _platforms: clj_ ```clojure (->MutableRegistry registry*) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L9-L9) ### cljs _platforms: cljs_ ```clojure (->MutableRegistry registry*) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L9-L9) --- ## MutableRegistry ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L9-L9) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L9-L9) --- ## map->MutableRegistry ### clj _platforms: clj_ ```clojure (map->MutableRegistry m) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L9-L9) ### cljs _platforms: cljs_ ```clojure (map->MutableRegistry m) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L9-L9) --- ## ->DynamicRegistry ### clj _platforms: clj_ ```clojure (->DynamicRegistry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L10-L10) ### cljs _platforms: cljs_ ```clojure (->DynamicRegistry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L10-L10) --- ## DynamicRegistry ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L10-L10) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L10-L10) --- ## map->DynamicRegistry ### clj _platforms: clj_ ```clojure (map->DynamicRegistry m) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L10-L10) ### cljs _platforms: cljs_ ```clojure (map->DynamicRegistry m) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L10-L10) --- ## *registry* ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L12-L12) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L12-L12) --- ## immutable-registry ### clj _platforms: clj_ ```clojure (immutable-registry) (immutable-registry registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L14-L19) ### cljs _platforms: cljs_ ```clojure (immutable-registry) (immutable-registry registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L14-L19) --- ## mutable-registry ### clj _platforms: clj_ ```clojure (mutable-registry registry*) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L21-L23) ### cljs _platforms: cljs_ ```clojure (mutable-registry registry*) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L21-L23) --- ## dynamic-registry ### clj _platforms: clj_ ```clojure (dynamic-registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L25-L27) ### cljs _platforms: cljs_ ```clojure (dynamic-registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L25-L27) --- ## resolve-registry ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L31-L31) ### clj _platforms: clj_ ```clojure (resolve-registry) (resolve-registry registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L41-L54) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L31-L31) ### cljs _platforms: cljs_ ```clojure (resolve-registry) (resolve-registry registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L41-L54) --- ## default-registry ### clj _platforms: clj_ ```clojure (default-registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L33-L35) ### cljs _platforms: cljs_ ```clojure (default-registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L33-L35) --- ## set-default-registry! ### clj _platforms: clj_ ```clojure (set-default-registry! registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L37-L39) ### cljs _platforms: cljs_ ```clojure (set-default-registry! registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L37-L39) --- ## register-adapter ### clj _platforms: clj_ ```clojure (register-adapter registry adapter) (register-adapter registry adapter source-id) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L56-L64) ### cljs _platforms: cljs_ ```clojure (register-adapter registry adapter) (register-adapter registry adapter source-id) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L56-L64) --- ## unregister-adapters-by-source ### clj _platforms: clj_ ```clojure (unregister-adapters-by-source registry source-id) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L66-L77) ### cljs _platforms: cljs_ ```clojure (unregister-adapters-by-source registry source-id) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L66-L77) --- ## clear-adapters ### clj _platforms: clj_ ```clojure (clear-adapters registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L79-L81) ### cljs _platforms: cljs_ ```clojure (clear-adapters registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L79-L81) --- ## get-adapter ### clj _platforms: clj_ ```clojure (get-adapter api) (get-adapter registry api) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L83-L90) ### cljs _platforms: cljs_ ```clojure (get-adapter api) (get-adapter registry api) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L83-L90) --- ## get-adapters ### clj _platforms: clj_ ```clojure (get-adapters) (get-adapters registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L92-L96) ### cljs _platforms: cljs_ ```clojure (get-adapters) (get-adapters registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/registry.cljc#L92-L96) ## ol.llx.ai.impl.schema # ol.llx.ai.impl.schema _platforms: clj, cljs_ ## non-blank-string? ### clj _platforms: clj_ ```clojure (non-blank-string? s) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L11-L13) ### cljs _platforms: cljs_ ```clojure (non-blank-string? s) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L11-L13) --- ## non-negative-int? ### clj _platforms: clj_ ```clojure (non-negative-int? n) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L15-L17) ### cljs _platforms: cljs_ ```clojure (non-negative-int? n) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L15-L17) --- ## non-negative-number? ### clj _platforms: clj_ ```clojure (non-negative-number? n) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L19-L21) ### cljs _platforms: cljs_ ```clojure (non-negative-number? n) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L19-L21) --- ## deferred? ### clj _platforms: clj_ ```clojure (deferred? x) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L23-L25) ### cljs _platforms: cljs_ ```clojure (deferred? x) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L23-L25) --- ## schema-form? ### clj _platforms: clj_ ```clojure (schema-form? x) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L27-L33) ### cljs _platforms: cljs_ ```clojure (schema-form? x) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L27-L33) --- ## schemas ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L35-L520) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L35-L520) --- ## custom-schemas ### clj _platforms: clj_ ```clojure (custom-schemas) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L522-L525) ### cljs _platforms: cljs_ ```clojure (custom-schemas) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L522-L525) --- ## registry ### clj _platforms: clj_ ```clojure (registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L527-L530) ### cljs _platforms: cljs_ ```clojure (registry) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L527-L530) --- ## schema ### clj _platforms: clj_ ```clojure (schema schema-id) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L534-L536) ### cljs _platforms: cljs_ ```clojure (schema schema-id) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L534-L536) --- ## valid? ### clj _platforms: clj_ ```clojure (valid? schema-id data) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L538-L540) ### cljs _platforms: cljs_ ```clojure (valid? schema-id data) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L538-L540) --- ## explain ### clj _platforms: clj_ ```clojure (explain schema-id data) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L542-L544) ### cljs _platforms: cljs_ ```clojure (explain schema-id data) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L542-L544) --- ## humanize ### clj _platforms: clj_ ```clojure (humanize schema-id data) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L546-L548) ### cljs _platforms: cljs_ ```clojure (humanize schema-id data) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L546-L548) --- ## assert-valid! ### clj _platforms: clj_ ```clojure (assert-valid! schema-id data) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L550-L558) ### cljs _platforms: cljs_ ```clojure (assert-valid! schema-id data) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L550-L558) --- ## malli->json-schema ### clj _platforms: clj_ ```clojure (malli->json-schema schema-form) ``` Converts a Malli schema form to a JSON Schema object map. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L560-L565) ### cljs _platforms: cljs_ ```clojure (malli->json-schema schema-form) ``` Converts a Malli schema form to a JSON Schema object map. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/schema.cljc#L560-L565) ## ol.llx.ai.impl.transform-messages # ol.llx.ai.impl.transform-messages _platforms: clj, cljs_ ## for-target-model ### clj _platforms: clj_ ```clojure (for-target-model messages target-model opts) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/transform_messages.cljc#L145-L159) ### cljs _platforms: cljs_ ```clojure (for-target-model messages target-model opts) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/transform_messages.cljc#L145-L159) ## ol.llx.ai.impl.utils.overflow # ol.llx.ai.impl.utils.overflow _platforms: clj, cljs_ ## context-overflow? ### clj _platforms: clj_ ```clojure (context-overflow? assistant-message) (context-overflow? assistant-message context-window) ``` Returns true when `assistant-message` appears to be a context-window overflow. Supports two detection modes: 1. error-message pattern matching for explicit overflow responses. 2. silent overflow heuristic when `context-window` is provided and `(:usage :input + :cache-read)` exceeds it. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/utils/overflow.cljc#L32-L52) ### cljs _platforms: cljs_ ```clojure (context-overflow? assistant-message) (context-overflow? assistant-message context-window) ``` Returns true when `assistant-message` appears to be a context-window overflow. Supports two detection modes: 1. error-message pattern matching for explicit overflow responses. 2. silent overflow heuristic when `context-window` is provided and `(:usage :input + :cache-read)` exceeds it. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/utils/overflow.cljc#L32-L52) ## ol.llx.ai.impl.utils.rate-limit # ol.llx.ai.impl.utils.rate-limit _platforms: clj, cljs_ ## rate-limited? ### clj _platforms: clj_ ```clojure (rate-limited? assistant-message) ``` Returns true when `assistant-message` appears to represent a provider quota or rate-limit error. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/utils/rate_limit.cljc#L18-L27) ### cljs _platforms: cljs_ ```clojure (rate-limited? assistant-message) ``` Returns true when `assistant-message` appears to represent a provider quota or rate-limit error. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/utils/rate_limit.cljc#L18-L27) ## ol.llx.ai.impl.utils.tool-validation # ol.llx.ai.impl.utils.tool-validation _platforms: clj, cljs_ ## validate-tool-call ### clj _platforms: clj_ ```clojure (validate-tool-call tools tool-call) ``` Validates tool-call arguments against the matching tool `:input-schema`. Returns validated arguments on success. Throws `ExceptionInfo` with structured `ex-data`: - `{:type :ol.llx/tool-not-found ...}` when `tool-call` name is unknown. - `{:type :ol.llx/validation-error ...}` when arguments do not satisfy the schema. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/utils/tool_validation.cljc#L11-L30) ### cljs _platforms: cljs_ ```clojure (validate-tool-call tools tool-call) ``` Validates tool-call arguments against the matching tool `:input-schema`. Returns validated arguments on success. Throws `ExceptionInfo` with structured `ex-data`: - `{:type :ol.llx/tool-not-found ...}` when `tool-call` name is unknown. - `{:type :ol.llx/validation-error ...}` when arguments do not satisfy the schema. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/utils/tool_validation.cljc#L11-L30) ## ol.llx.ai.impl.utils.unicode # ol.llx.ai.impl.utils.unicode === === ## sanitize-surrogates === ```clojure (sanitize-surrogates text) ``` Removes unpaired UTF-16 surrogate code units from `text`. Preserves valid surrogate pairs (for example, emoji) and removes standalone high/low surrogates that can break JSON serialization. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/utils/unicode.clj#L5-L36) === ```clojure (sanitize-surrogates text) ``` Removes unpaired UTF-16 surrogate code units from `text`. Preserves valid surrogate pairs and removes standalone high/low surrogates. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/utils/unicode.cljs#L13-L38) --- ## sanitize-payload === ```clojure (sanitize-payload data) ``` Recursively walks a data structure, applying `sanitize-surrogates` to all strings. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/utils/unicode.clj#L38-L41) === ```clojure (sanitize-payload data) ``` Recursively walks a data structure, applying `sanitize-surrogates` to all strings. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/utils/unicode.cljs#L40-L43) --- ## truncate === ```clojure (truncate s max-len) ``` Returns `s` truncated to at most `max-len` characters. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/utils/unicode.clj#L43-L49) === ```clojure (truncate s max-len) ``` Returns `s` truncated to at most `max-len` characters. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/impl/utils/unicode.cljs#L45-L51) ## ol.llx.ai.oauth.cli # ol.llx.ai.oauth.cli ## -main ```clojure (-main & args) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/oauth/cli.clj#L79-L87) ## ol.llx.ai.oauth # ol.llx.ai.oauth _platforms: clj, cljs_ ## register-oauth-provider! ### clj _platforms: clj_ ```clojure (register-oauth-provider! provider) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/oauth.cljc#L13-L15) ### cljs _platforms: cljs_ ```clojure (register-oauth-provider! provider) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/oauth.cljc#L13-L15) --- ## get-oauth-provider ### clj _platforms: clj_ ```clojure (get-oauth-provider provider-id) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/oauth.cljc#L17-L19) ### cljs _platforms: cljs_ ```clojure (get-oauth-provider provider-id) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/oauth.cljc#L17-L19) --- ## get-oauth-providers ### clj _platforms: clj_ ```clojure (get-oauth-providers) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/oauth.cljc#L21-L23) ### cljs _platforms: cljs_ ```clojure (get-oauth-providers) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/oauth.cljc#L21-L23) --- ## refresh-oauth-token ### clj _platforms: clj_ ```clojure (refresh-oauth-token provider-id credentials) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/oauth.cljc#L25-L27) ### cljs _platforms: cljs_ ```clojure (refresh-oauth-token provider-id credentials) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/oauth.cljc#L25-L27) --- ## get-oauth-api-key ### clj _platforms: clj_ ```clojure (get-oauth-api-key provider-id credentials-by-provider) (get-oauth-api-key provider-id credentials-by-provider opts) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/oauth.cljc#L29-L33) ### cljs _platforms: cljs_ ```clojure (get-oauth-api-key provider-id credentials-by-provider) (get-oauth-api-key provider-id credentials-by-provider opts) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/oauth.cljc#L29-L33) ## ol.llx.ai.registry # ol.llx.ai.registry _platforms: clj, cljs_ ## immutable-registry ### clj _platforms: clj_ ```clojure (immutable-registry) (immutable-registry registry-map) ``` Creates an immutable registry map. With no argument it creates an empty normalized registry. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L5-L12) ### cljs _platforms: cljs_ ```clojure (immutable-registry) (immutable-registry registry-map) ``` Creates an immutable registry map. With no argument it creates an empty normalized registry. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L5-L12) --- ## mutable-registry ### clj _platforms: clj_ ```clojure (mutable-registry registry*) ``` Wraps an atom-backed registry for mutable use cases. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L14-L17) ### cljs _platforms: cljs_ ```clojure (mutable-registry registry*) ``` Wraps an atom-backed registry for mutable use cases. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L14-L17) --- ## dynamic-registry ### clj _platforms: clj_ ```clojure (dynamic-registry) ``` Creates a dynamic registry wrapper that resolves from thread-local bindings. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L19-L22) ### cljs _platforms: cljs_ ```clojure (dynamic-registry) ``` Creates a dynamic registry wrapper that resolves from thread-local bindings. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L19-L22) --- ## default-registry ### clj _platforms: clj_ ```clojure (default-registry) ``` Returns the process default registry. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L24-L27) ### cljs _platforms: cljs_ ```clojure (default-registry) ``` Returns the process default registry. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L24-L27) --- ## set-default-registry! ### clj _platforms: clj_ ```clojure (set-default-registry! registry-value) ``` Sets the process default registry after resolving wrapper implementations. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L29-L32) ### cljs _platforms: cljs_ ```clojure (set-default-registry! registry-value) ``` Sets the process default registry after resolving wrapper implementations. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L29-L32) --- ## resolve-registry ### clj _platforms: clj_ ```clojure (resolve-registry) (resolve-registry registry-value) ``` Resolves supported registry wrapper implementations to a registry map. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L34-L39) ### cljs _platforms: cljs_ ```clojure (resolve-registry) (resolve-registry registry-value) ``` Resolves supported registry wrapper implementations to a registry map. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L34-L39) --- ## register-adapter ### clj _platforms: clj_ ```clojure (register-adapter registry-value adapter) (register-adapter registry-value adapter source-id) ``` Registers `adapter` in `registry-value`, with optional `source-id` metadata. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L41-L46) ### cljs _platforms: cljs_ ```clojure (register-adapter registry-value adapter) (register-adapter registry-value adapter source-id) ``` Registers `adapter` in `registry-value`, with optional `source-id` metadata. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L41-L46) --- ## unregister-adapters-by-source ### clj _platforms: clj_ ```clojure (unregister-adapters-by-source registry-value source-id) ``` Removes adapters from `registry-value` whose registration `source-id` matches. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L48-L51) ### cljs _platforms: cljs_ ```clojure (unregister-adapters-by-source registry-value source-id) ``` Removes adapters from `registry-value` whose registration `source-id` matches. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L48-L51) --- ## clear-adapters ### clj _platforms: clj_ ```clojure (clear-adapters registry-value) ``` Removes all adapters from `registry-value`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L53-L56) ### cljs _platforms: cljs_ ```clojure (clear-adapters registry-value) ``` Removes all adapters from `registry-value`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L53-L56) --- ## get-adapter ### clj _platforms: clj_ ```clojure (get-adapter api) (get-adapter registry-value api) ``` Returns the adapter for an API key. With one argument, uses the default registry. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L58-L65) ### cljs _platforms: cljs_ ```clojure (get-adapter api) (get-adapter registry-value api) ``` Returns the adapter for an API key. With one argument, uses the default registry. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L58-L65) --- ## get-adapters ### clj _platforms: clj_ ```clojure (get-adapters) (get-adapters registry-value) ``` Returns all adapters in the registry. With no argument, uses the default registry. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L67-L74) ### cljs _platforms: cljs_ ```clojure (get-adapters) (get-adapters registry-value) ``` Returns all adapters in the registry. With no argument, uses the default registry. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/registry.cljc#L67-L74) ## ol.llx.ai.schema.runtime # ol.llx.ai.schema.runtime _platforms: clj, cljs_ ## stream-channel? ### clj _platforms: clj_ ```clojure (stream-channel? x) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/schema/runtime.cljc#L5-L7) ### cljs _platforms: cljs_ ```clojure (stream-channel? x) ``` [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/schema/runtime.cljc#L5-L7) --- ## schemas ### clj _platforms: clj_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/schema/runtime.cljc#L9-L148) ### cljs _platforms: cljs_ [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai/schema/runtime.cljc#L9-L148) ## ol.llx.ai # ol.llx.ai _platforms: clj, cljs_ ## default-env ### clj _platforms: clj_ ```clojure (default-env) ``` Returns the default environment for your platform. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L12-L17) ### cljs _platforms: cljs_ ```clojure (default-env) ``` Returns the default environment for your platform. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L12-L17) --- ## complete* ### clj _platforms: clj_ ```clojure (complete* env model context opts) ``` Runs one non-streaming assistant turn using provider-style options. Use `complete*` when you need provider-level control and adapter-specific options. This is the provider path. `opts` is validated against `:ol.llx/provider-request-options` in `src/ol/llx/ai/impl/schema/options.cljc`. Adapter `build-request` boundaries also validate adapter-specific schemas: `:ol.llx/openai-completions-provider-options`, `:ol.llx/openai-responses-provider-options`, `:ol.llx/anthropic-provider-options`, and `:ol.llx/google-provider-options`. Common provider option keys: | | | | --- | --- | | key | description | | `:max-output-tokens` | Requested output token cap. | | `:temperature` | Sampling temperature. | | `:top-p` | Nucleus sampling probability. | | `:reasoning` | Provider reasoning map (shape depends on adapter). | | `:session-id` | Optional session identifier for provider-side caching/routing. | | `:api-key` | Provider API key override for this call. | | `:headers` | Additional provider request headers. | | `:signal` | Abort/cancel signal forwarded to runtime/provider layer. | | `:max-retry-delay-ms` | Optional cap for server-requested retry delays. | | `:metadata` | Request metadata map forwarded to adapter payload builders. | | `:registry` | Per-call adapter registry override. | | `:max-retries` | Retry count for transient failures (default `2`). | Returns a promise that resolves to one canonical assistant message map. Errors reject the promise with structured LLX exception data. Use [`complete`](#complete) for the unified API. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L19-L56) ### cljs _platforms: cljs_ ```clojure (complete* env model context opts) ``` Runs one non-streaming assistant turn using provider-style options. Use `complete*` when you need provider-level control and adapter-specific options. This is the provider path. `opts` is validated against `:ol.llx/provider-request-options` in `src/ol/llx/ai/impl/schema/options.cljc`. Adapter `build-request` boundaries also validate adapter-specific schemas: `:ol.llx/openai-completions-provider-options`, `:ol.llx/openai-responses-provider-options`, `:ol.llx/anthropic-provider-options`, and `:ol.llx/google-provider-options`. Common provider option keys: | | | | --- | --- | | key | description | | `:max-output-tokens` | Requested output token cap. | | `:temperature` | Sampling temperature. | | `:top-p` | Nucleus sampling probability. | | `:reasoning` | Provider reasoning map (shape depends on adapter). | | `:session-id` | Optional session identifier for provider-side caching/routing. | | `:api-key` | Provider API key override for this call. | | `:headers` | Additional provider request headers. | | `:signal` | Abort/cancel signal forwarded to runtime/provider layer. | | `:max-retry-delay-ms` | Optional cap for server-requested retry delays. | | `:metadata` | Request metadata map forwarded to adapter payload builders. | | `:registry` | Per-call adapter registry override. | | `:max-retries` | Retry count for transient failures (default `2`). | Returns a promise that resolves to one canonical assistant message map. Errors reject the promise with structured LLX exception data. Use [`complete`](#complete) for the unified API. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L19-L56) --- ## stream* ### clj _platforms: clj_ ```clojure (stream* env model context opts) ``` Runs one streaming assistant turn using provider-style options. Use `stream*` when you need provider-level control and adapter-specific options. This is the provider path. `opts` is validated against `:ol.llx/provider-request-options` in `src/ol/llx/ai/impl/schema/options.cljc`, and adapter-specific schemas are enforced at each adapter `build-request` boundary. Common provider option keys: | | | | --- | --- | | key | description | | `:max-output-tokens` | Requested output token cap. | | `:temperature` | Sampling temperature. | | `:top-p` | Nucleus sampling probability. | | `:reasoning` | Provider reasoning map (shape depends on adapter). | | `:session-id` | Optional session identifier for provider-side caching/routing. | | `:api-key` | Provider API key override for this call. | | `:headers` | Additional provider request headers. | | `:signal` | Abort/cancel signal forwarded to runtime/provider layer. | | `:max-retry-delay-ms` | Optional cap for server-requested retry delays. | | `:metadata` | Request metadata map forwarded to adapter payload builders. | | `:registry` | Per-call adapter registry override. | | `:max-retries` | Retry count for transient failures (default `2`). | Returns a Promesa CSP channel emitting canonical LLX event maps. Stream completion emits terminal `:done` or `:error` and closes the channel. Consumer cancellation is channel closure. Use [`stream`](#stream) for the unified API. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L58-L91) ### cljs _platforms: cljs_ ```clojure (stream* env model context opts) ``` Runs one streaming assistant turn using provider-style options. Use `stream*` when you need provider-level control and adapter-specific options. This is the provider path. `opts` is validated against `:ol.llx/provider-request-options` in `src/ol/llx/ai/impl/schema/options.cljc`, and adapter-specific schemas are enforced at each adapter `build-request` boundary. Common provider option keys: | | | | --- | --- | | key | description | | `:max-output-tokens` | Requested output token cap. | | `:temperature` | Sampling temperature. | | `:top-p` | Nucleus sampling probability. | | `:reasoning` | Provider reasoning map (shape depends on adapter). | | `:session-id` | Optional session identifier for provider-side caching/routing. | | `:api-key` | Provider API key override for this call. | | `:headers` | Additional provider request headers. | | `:signal` | Abort/cancel signal forwarded to runtime/provider layer. | | `:max-retry-delay-ms` | Optional cap for server-requested retry delays. | | `:metadata` | Request metadata map forwarded to adapter payload builders. | | `:registry` | Per-call adapter registry override. | | `:max-retries` | Retry count for transient failures (default `2`). | Returns a Promesa CSP channel emitting canonical LLX event maps. Stream completion emits terminal `:done` or `:error` and closes the channel. Consumer cancellation is channel closure. Use [`stream`](#stream) for the unified API. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L58-L91) --- ## complete ### clj _platforms: clj_ ```clojure (complete env model context unified-opts) ``` Runs one non-streaming assistant turn using the unified options API. This is the unified path and is recommended for most callers. `opts` is validated against `:ol.llx/unified-request-options` in `src/ol/llx/ai/impl/schema/options.cljc`. Unified options are normalized and forwarded to provider adapters. For example: - `:max-tokens` -> provider `:max-output-tokens` - `:reasoning` / `:reasoning-effort` -> provider reasoning shape Unified option keys: | | | | --- | --- | | key | description | | `:max-tokens` | Requested output cap. Defaults to `min(model.max-tokens, 32000)`. | | `:temperature` | Sampling temperature. | | `:top-p` | Nucleus sampling probability. | | `:reasoning` | Reasoning level keyword (`:minimal` `:low` `:medium` `:high` `:xhigh`). | | `:reasoning-effort` | Alias for `:reasoning`. | | `:session-id` | Optional session identifier for provider-side caching/routing. | | `:thinking-budgets` | Optional token budgets per reasoning level (provider-dependent). | | `:api-key` | Provider API key override for this call. | | `:headers` | Additional provider request headers. | | `:signal` | Abort/cancel signal forwarded to runtime/provider layer. | | `:max-retry-delay-ms` | Optional cap for server-requested retry delays. | | `:metadata` | Request metadata map forwarded to adapter payload builders. | | `:registry` | Per-call adapter registry override. | Returns a promise that resolves to one canonical assistant message map. Errors reject the promise with structured LLX exception data. Use [`complete*`](#complete*) if you need provider-specific options that are outside the unified schema. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L93-L129) ### cljs _platforms: cljs_ ```clojure (complete env model context unified-opts) ``` Runs one non-streaming assistant turn using the unified options API. This is the unified path and is recommended for most callers. `opts` is validated against `:ol.llx/unified-request-options` in `src/ol/llx/ai/impl/schema/options.cljc`. Unified options are normalized and forwarded to provider adapters. For example: - `:max-tokens` -> provider `:max-output-tokens` - `:reasoning` / `:reasoning-effort` -> provider reasoning shape Unified option keys: | | | | --- | --- | | key | description | | `:max-tokens` | Requested output cap. Defaults to `min(model.max-tokens, 32000)`. | | `:temperature` | Sampling temperature. | | `:top-p` | Nucleus sampling probability. | | `:reasoning` | Reasoning level keyword (`:minimal` `:low` `:medium` `:high` `:xhigh`). | | `:reasoning-effort` | Alias for `:reasoning`. | | `:session-id` | Optional session identifier for provider-side caching/routing. | | `:thinking-budgets` | Optional token budgets per reasoning level (provider-dependent). | | `:api-key` | Provider API key override for this call. | | `:headers` | Additional provider request headers. | | `:signal` | Abort/cancel signal forwarded to runtime/provider layer. | | `:max-retry-delay-ms` | Optional cap for server-requested retry delays. | | `:metadata` | Request metadata map forwarded to adapter payload builders. | | `:registry` | Per-call adapter registry override. | Returns a promise that resolves to one canonical assistant message map. Errors reject the promise with structured LLX exception data. Use [`complete*`](#complete*) if you need provider-specific options that are outside the unified schema. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L93-L129) --- ## stream ### clj _platforms: clj_ ```clojure (stream env model context unified-opts) ``` Runs one streaming assistant turn using the unified options API. This is the unified path and is recommended for most callers. `opts` is validated against `:ol.llx/unified-request-options` in `src/ol/llx/ai/impl/schema/options.cljc`. Unified option keys: | | | | --- | --- | | key | description | | `:max-tokens` | Requested output cap. Defaults to `min(model.max-tokens, 32000)`. | | `:temperature` | Sampling temperature. | | `:top-p` | Nucleus sampling probability. | | `:reasoning` | Reasoning level keyword (`:minimal` `:low` `:medium` `:high` `:xhigh`). | | `:reasoning-effort` | Alias for `:reasoning`. | | `:session-id` | Optional session identifier for provider-side caching/routing. | | `:thinking-budgets` | Optional token budgets per reasoning level (provider-dependent). | | `:api-key` | Provider API key override for this call. | | `:headers` | Additional provider request headers. | | `:signal` | Abort/cancel signal forwarded to runtime/provider layer. | | `:max-retry-delay-ms` | Optional cap for server-requested retry delays. | | `:metadata` | Request metadata map forwarded to adapter payload builders. | | `:registry` | Per-call adapter registry override. | Returns a Promesa CSP channel emitting canonical LLX event maps. Stream completion emits terminal `:done` or `:error` and closes the channel. Consumer cancellation is channel closure. Use [`stream*`](#stream*) for provider-specific option control. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L131-L162) ### cljs _platforms: cljs_ ```clojure (stream env model context unified-opts) ``` Runs one streaming assistant turn using the unified options API. This is the unified path and is recommended for most callers. `opts` is validated against `:ol.llx/unified-request-options` in `src/ol/llx/ai/impl/schema/options.cljc`. Unified option keys: | | | | --- | --- | | key | description | | `:max-tokens` | Requested output cap. Defaults to `min(model.max-tokens, 32000)`. | | `:temperature` | Sampling temperature. | | `:top-p` | Nucleus sampling probability. | | `:reasoning` | Reasoning level keyword (`:minimal` `:low` `:medium` `:high` `:xhigh`). | | `:reasoning-effort` | Alias for `:reasoning`. | | `:session-id` | Optional session identifier for provider-side caching/routing. | | `:thinking-budgets` | Optional token budgets per reasoning level (provider-dependent). | | `:api-key` | Provider API key override for this call. | | `:headers` | Additional provider request headers. | | `:signal` | Abort/cancel signal forwarded to runtime/provider layer. | | `:max-retry-delay-ms` | Optional cap for server-requested retry delays. | | `:metadata` | Request metadata map forwarded to adapter payload builders. | | `:registry` | Per-call adapter registry override. | Returns a Promesa CSP channel emitting canonical LLX event maps. Stream completion emits terminal `:done` or `:error` and closes the channel. Consumer cancellation is channel closure. Use [`stream*`](#stream*) for provider-specific option control. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L131-L162) --- ## get-model ### clj _platforms: clj_ ```clojure (get-model provider model-id) ``` Returns the model definition for `provider` and `model-id`, or `nil` when absent. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L164-L167) ### cljs _platforms: cljs_ ```clojure (get-model provider model-id) ``` Returns the model definition for `provider` and `model-id`, or `nil` when absent. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L164-L167) --- ## get-models ### clj _platforms: clj_ ```clojure (get-models provider) ``` Returns all models for `provider` as a deterministic vector sorted by `:id`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L169-L172) ### cljs _platforms: cljs_ ```clojure (get-models provider) ``` Returns all models for `provider` as a deterministic vector sorted by `:id`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L169-L172) --- ## get-providers ### clj _platforms: clj_ ```clojure (get-providers) ``` Returns supported providers as a deterministic sorted vector. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L174-L177) ### cljs _platforms: cljs_ ```clojure (get-providers) ``` Returns supported providers as a deterministic sorted vector. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L174-L177) --- ## calculate-cost ### clj _platforms: clj_ ```clojure (calculate-cost model usage) ``` Calculates usage cost totals from `model` pricing and `usage` token counts. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L179-L182) ### cljs _platforms: cljs_ ```clojure (calculate-cost model usage) ``` Calculates usage cost totals from `model` pricing and `usage` token counts. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L179-L182) --- ## supports-xhigh? ### clj _platforms: clj_ ```clojure (supports-xhigh? model) ``` Returns true when `model` supports `:xhigh` reasoning effort. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L184-L187) ### cljs _platforms: cljs_ ```clojure (supports-xhigh? model) ``` Returns true when `model` supports `:xhigh` reasoning effort. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L184-L187) --- ## models-equal? ### clj _platforms: clj_ ```clojure (models-equal? a b) ``` Returns true when two model maps refer to the same `:provider` and `:id`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L189-L192) ### cljs _platforms: cljs_ ```clojure (models-equal? a b) ``` Returns true when two model maps refer to the same `:provider` and `:id`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L189-L192) --- ## validate-tool-call ### clj _platforms: clj_ ```clojure (validate-tool-call tools tool-call) ``` Validates a `tool-call` entry against matching tool definitions in `tools`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L194-L197) ### cljs _platforms: cljs_ ```clojure (validate-tool-call tools tool-call) ``` Validates a `tool-call` entry against matching tool definitions in `tools`. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L194-L197) --- ## context-overflow? ### clj _platforms: clj_ ```clojure (context-overflow? assistant-message) (context-overflow? assistant-message context-window) ``` Returns true when the input matches known context-window overflow patterns. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L199-L204) ### cljs _platforms: cljs_ ```clojure (context-overflow? assistant-message) (context-overflow? assistant-message context-window) ``` Returns true when the input matches known context-window overflow patterns. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L199-L204) --- ## sanitize-surrogates ### clj _platforms: clj_ ```clojure (sanitize-surrogates text) ``` Removes unpaired surrogate code units while preserving valid Unicode pairs. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L206-L209) ### cljs _platforms: cljs_ ```clojure (sanitize-surrogates text) ``` Removes unpaired surrogate code units while preserving valid Unicode pairs. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L206-L209) --- ## schema-regsitry ### clj _platforms: clj_ ```clojure (schema-regsitry) ``` Returns the full LLX schema registry map. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L211-L214) ### cljs _platforms: cljs_ ```clojure (schema-regsitry) ``` Returns the full LLX schema registry map. [source,window=_blank](https://github.com/outskirtslabs/llx/blob/main/src/ol/llx/ai.cljc#L211-L214) ## ol.llx # ol.llx > Unified LLM API and agent runtime for Clojure, ClojureScript, and Clojure Dart. ![doc](https://img.shields.io/badge/doc-outskirtslabs-orange.svg) ![status: experimental](https://img.shields.io/badge/status-experimental-orange.svg) ![Clojars Project](https://img.shields.io/clojars/v/com.outskirtslabs/llx.svg) ## ol.llx.ai `ol.llx.ai` targets JVM Clojure, ClojureScript, and ClojureDart. Under the hood it is built around the API families that cover most of the current LLM ecosystem: OpenAI Completions, OpenAI Responses, Anthropic Messages, and Google Generative AI. It absorbs provider quirks around streaming, tool calls, reasoning traces, and model behavior to present a unified API without relying on vendor SDKs or Java wrappers. ## ol.llx.agent `ol.llx.agent` sits on top of `ol.llx.ai` and handles the multi-turn agent loop. Feature highlights: * tools run concurrently and can be aborted mid-execution * the steering queue can interrupt an active run, skip pending tools, and re-prompt * the follow-up queue can defer messages until the current turn finishes * event subscriptions expose structured turn, message, and tool lifecycle events * agent state can be snapshotted and rehydrated by the application * custom message roles allow app-specific history that is filtered before LLM submission Project status: **[Experimental](https://docs.outskirtslabs.com/open-source-vital-signs#experimental)**. ## Installation Only git dep usage will be supported for now while we are in the experimental phase. ```clojure ;; deps.edn {:deps {io.github.outskirtslabs/llx {:git/sha "3427a11a5ddff01d21b6c6fe24374cac270ecf62"}}} ``` ## Quick Start ```clojure (require '[ol.llx.ai :as ai] '[ol.llx.agent :as agent] '[promesa.exec.csp :as sp]) (def read-tool {:name "read_file" :description "Read the contents of a file at the given path." :input-schema [:map [:path :string]] :execute (fn [_id {:keys [path]} _abort _on-update] {:content [{:type :text :text (slurp path)}]})}) (def a (agent/create-agent {:model (ai/get-model :anthropic "claude-sonnet-4-6") :system-prompt "You are a helpful assistant." :tools [read-tool]})) ;; subscribe to events (let [ch (agent/subscribe a)] (future (loop [] (when-let [ev (sp/take! ch)] (println (:type ev)) (recur))))) (agent/prompt a [{:role :user :content "read README.adoc" :timestamp 1}]) (agent/close a) ``` `ol.llx.ai` exposes unified entrypoints at `ol.llx.ai/complete` and `ol.llx.ai/stream`, with `complete*` and `stream*` available when you need provider-specific escape hatches. ## Documentation * [Docs](https://docs.outskirtslabs.com/ol.llx/next/) * [API Reference](https://docs.outskirtslabs.com/ol.llx/next/api) * [Example: Minimal Coding Agent](examples/minimal-coding-agent/README.md) * [Support via GitHub Issues](https://github.com/outskirtslabs/llx/issues) ## License Copyright (C) 2026 Casey Link Distributed under the [EUPL-1.2](https://spdx.org/licenses/EUPL-1.2.html).