extract(), classify(), and complete() functions, you can transform, analyze, and synthesize content during compilation. Results are cached by input hash, making subsequent compilations fast and predictable.
The LLM provider is registered automatically—no configuration required. It uses pydantic-ai under the hood and supports any model that pydantic-ai can connect to.
Configuration
Configure a default model incolin.toml:
colin.toml
provider:model-name format. Supported providers include anthropic and openai.
| Field | Description | Default |
|---|---|---|
model | Model identifier (e.g., anthropic:claude-sonnet-4-5) | From settings |
instructions | System prompt for all LLM calls from this provider | None |
instructions_ref | Path to a document whose compiled content becomes the system prompt | None |
Named Providers
Beyond the default provider, you can configure named LLM instances for different use cases. A provider entry without aname becomes the default; entries with a name become accessible under that namespace.
colin.toml
colin.llm:
Instructions
Instructions act as system prompts, shaping how the LLM responds across all calls. Set them at the provider level:colin.toml
colin.toml
Template Functions
The LLM provider exposes three functions accessible through thecolin.llm namespace (colin.llm.extract(), colin.llm.classify(), colin.llm.complete()).
| Function | Purpose |
|---|---|
extract() | Pull specific information from content |
classify() | Categorize content into predefined labels |
complete() | Generate text from a prompt |
Extract
Theextract() function pulls specific information from content using an LLM. Pass the content and a prompt describing what to extract:
models/summary.md
models/brief.md
RefResult to extract(), Colin includes document metadata in the prompt context. The LLM sees the document name, description, URI, and content—helping it understand the source material.
Classify
Theclassify() function categorizes content into predefined labels:
multi=True:
Complete
Thecomplete() function generates text from a prompt:
{% llm %} blocks instead:
Caching
Colin caches LLM results by input hash. Forextract() and classify(), the hash includes content and prompt. For complete() and {% llm %} blocks, it’s the fully rendered prompt.
If content or prompt changes, the cache misses and Colin makes a fresh call. During compilation, Colin shows cache status:
Cost Management
LLM calls have associated costs. Colin’s caching minimizes redundant calls, but you can further optimize by using cheaper models for simple tasks:models/context/extracted.md