Pure context-extraction functions for AI features.
FC/IS rule: file I/O happens in the caller (shell layer). These functions receive already-read content as strings/maps and transform it into context strings for prompt building.
Pure context-extraction functions for AI features. FC/IS rule: file I/O happens in the caller (shell layer). These functions receive already-read content as strings/maps and transform it into context strings for prompt building.
Pure response-parsing functions for AI outputs.
FC/IS rule: no I/O here — receives raw AI response strings, returns parsed data or error maps.
Pure response-parsing functions for AI outputs. FC/IS rule: no I/O here — receives raw AI response strings, returns parsed data or error maps.
Pure prompt-building functions for AI features.
FC/IS rule: no I/O, no logging, no exceptions here. All functions are pure transformations from data to prompt strings/messages.
Pure prompt-building functions for AI features. FC/IS rule: no I/O, no logging, no exceptions here. All functions are pure transformations from data to prompt strings/messages.
Protocol definitions for the AI module.
FC/IS rule: protocols are interfaces — no implementation here. Adapters (shell/providers) implement these protocols.
Protocol definitions for the AI module. FC/IS rule: protocols are interfaces — no implementation here. Adapters (shell/providers) implement these protocols.
Malli validation schemas for the AI module.
Malli validation schemas for the AI module.
Clojure CLI entrypoint for AI features.
Called by the Babashka scripts/ai.clj script: clojure -M -m wagoe.ai.shell.cli-entry <subcommand> [args]
Subcommands: scaffold-ai <description> -- NL module scaffolding explain [--file path] [--stdin] -- error explainer gen-tests <source-file> -- test generator sql <description> -- SQL copilot docs --module <path> --type <type> -- documentation wizard
Clojure CLI entrypoint for AI features. Called by the Babashka scripts/ai.clj script: clojure -M -m wagoe.ai.shell.cli-entry <subcommand> [args] Subcommands: scaffold-ai <description> -- NL module scaffolding explain [--file path] [--stdin] -- error explainer gen-tests <source-file> -- test generator sql <description> -- SQL copilot docs --module <path> --type <type> -- documentation wizard
Integrant wiring for the AI module.
Config key: :wagoe/ai-service
Example (Ollama, offline-first): :wagoe/ai-service {:provider :ollama :model "qwen2.5-coder:7b" :base-url "http://localhost:11434"}
Example (Anthropic): :wagoe/ai-service {:provider :anthropic :model "claude-haiku-4-5-20251001" :api-key #env ANTHROPIC_API_KEY}
Example (Ollama with Anthropic fallback): :wagoe/ai-service {:provider :ollama :model "qwen2.5-coder:7b" :fallback {:provider :anthropic :model "claude-haiku-4-5-20251001" :api-key #env ANTHROPIC_API_KEY}}
Example (no-op, for tests): :wagoe/ai-service {:provider :no-op}
Integrant wiring for the AI module.
Config key: :wagoe/ai-service
Example (Ollama, offline-first):
:wagoe/ai-service
{:provider :ollama
:model "qwen2.5-coder:7b"
:base-url "http://localhost:11434"}
Example (Anthropic):
:wagoe/ai-service
{:provider :anthropic
:model "claude-haiku-4-5-20251001"
:api-key #env ANTHROPIC_API_KEY}
Example (Ollama with Anthropic fallback):
:wagoe/ai-service
{:provider :ollama
:model "qwen2.5-coder:7b"
:fallback {:provider :anthropic
:model "claude-haiku-4-5-20251001"
:api-key #env ANTHROPIC_API_KEY}}
Example (no-op, for tests):
:wagoe/ai-service
{:provider :no-op}No vars found in this namespace.
Anthropic API provider adapter.
Implements IAIProvider against the Anthropic Messages API. Requires an API key in the configuration.
Anthropic API provider adapter. Implements IAIProvider against the Anthropic Messages API. Requires an API key in the configuration. API docs: https://docs.anthropic.com/en/api/messages
No-op AI provider for tests and environments without AI.
Returns deterministic canned responses — no network calls, no API keys needed. Used in test configs.
No-op AI provider for tests and environments without AI. Returns deterministic canned responses — no network calls, no API keys needed. Used in test configs.
Ollama AI provider adapter.
Connects to a local Ollama instance (default: http://localhost:11434). No API key required — offline-first by design.
Implements IAIProvider via the Ollama REST API: POST /api/chat — used for all completions POST /api/generate — alternative for simple text generation
Ollama AI provider adapter. Connects to a local Ollama instance (default: http://localhost:11434). No API key required — offline-first by design. Implements IAIProvider via the Ollama REST API: POST /api/chat — used for all completions POST /api/generate — alternative for simple text generation
OpenAI API provider adapter.
Implements IAIProvider against the OpenAI Chat Completions API. Requires an API key in the configuration.
OpenAI API provider adapter. Implements IAIProvider against the OpenAI Chat Completions API. Requires an API key in the configuration.
Replicate provider adapter.
Implements IAIProvider against Replicate's predictions API, which hosts many models — including Anthropic and Google ones — behind a single token.
Replicate has no OpenAI-compatible endpoint (/v1/chat/completions is a
404), so it cannot be driven by the openai adapter. Two further differences
shape this namespace:
Prefer: wait header makes it synchronous, which is all
Wagoe needs and avoids a polling loop entirely.output comes back as a list of string chunks rather than a string.Input constraints are per-model rather than per-API. anthropic/claude-4.5-haiku
rejects max_tokens below 1024 with a 422 naming the field, so the failure
is reported with that detail instead of a bare status.
Replicate provider adapter. Implements IAIProvider against Replicate's predictions API, which hosts many models — including Anthropic and Google ones — behind a single token. Replicate has no OpenAI-compatible endpoint (`/v1/chat/completions` is a 404), so it cannot be driven by the openai adapter. Two further differences shape this namespace: - The documented flow is asynchronous: create a prediction, poll until it succeeds. The `Prefer: wait` header makes it synchronous, which is all Wagoe needs and avoids a polling loop entirely. - `output` comes back as a list of string chunks rather than a string. Input constraints are per-model rather than per-API. `anthropic/claude-4.5-haiku` rejects `max_tokens` below 1024 with a 422 naming the field, so the failure is reported with that detail instead of a bare status.
REPL helper functions for the AI module.
Provides convenient wrappers for use during interactive development:
(require '[wagoe.ai.shell.repl :as ai]) (ai/explain *e) (ai/sql "find active users with orders in the last 7 days")
The service is resolved from a dynamic var that you can bind in your dev/user.clj before using these helpers.
REPL helper functions for the AI module. Provides convenient wrappers for use during interactive development: (require '[wagoe.ai.shell.repl :as ai]) (ai/explain *e) (ai/sql "find active users with orders in the last 7 days") The service is resolved from a dynamic var that you can bind in your dev/user.clj before using these helpers.
AI service orchestration.
Public API entry points for all AI features. Combines context extraction (shell I/O) with pure core functions and delegates to the configured IAIProvider.
FC/IS: this namespace is in the shell layer — file reads happen here.
AI service orchestration. Public API entry points for all AI features. Combines context extraction (shell I/O) with pure core functions and delegates to the configured IAIProvider. FC/IS: this namespace is in the shell layer — file reads happen here.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |