Skip to content

Commit cba83f5

Browse files
authored
docs: move glossary to reference section (#892)
Signed-off-by: Paul S. Schweigert <paul@paulschweigert.com>
1 parent 1b796df commit cba83f5

30 files changed

Lines changed: 97 additions & 93 deletions

docs/docs/advanced/custom-components.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ less boilerplate.
3232

3333
## The Component Protocol
3434

35-
[`Component`](../guide/glossary#component) is a `Protocol` generic over `S`, the return type produced when the
35+
[`Component`](../reference/glossary#component) is a `Protocol` generic over `S`, the return type produced when the
3636
component parses LLM output:
3737

3838
```python
@@ -43,10 +43,10 @@ The protocol has three required methods and one public method that wraps `_parse
4343

4444
| Method | Signature | Purpose |
4545
| ------ | --------- | ------- |
46-
| `parts()` | `-> list[Component \| CBlock]` | Returns child components and [`CBlock`](../guide/glossary#cblock) content blocks |
46+
| `parts()` | `-> list[Component \| CBlock]` | Returns child components and [`CBlock`](../reference/glossary#cblock) content blocks |
4747
| `format_for_llm()` | `-> TemplateRepresentation \| str` | Formats the component for LLM consumption |
4848
| `_parse()` | `(computed: ModelOutputThunk) -> S` | Parses LLM output into the return type `S` |
49-
| `parse()` | `(computed: ModelOutputThunk) -> S` | Public wrapper — catches exceptions as [`ComponentParseError`](../guide/glossary#componentparseerror) |
49+
| `parse()` | `(computed: ModelOutputThunk) -> S` | Public wrapper — catches exceptions as [`ComponentParseError`](../reference/glossary#componentparseerror) |
5050

5151
You implement `parts()`, `format_for_llm()`, and `_parse()`. You do not override
5252
`parse()` — the base implementation calls `_parse()` and wraps any exception in a
@@ -135,7 +135,7 @@ with start_session() as m:
135135
## Using TemplateRepresentation for Jinja2-based rendering
136136

137137
For components that need model-specific prompt formatting, return a
138-
[`TemplateRepresentation`](../guide/glossary#templaterepresentation) from `format_for_llm()` instead of a plain string.
138+
[`TemplateRepresentation`](../reference/glossary#templaterepresentation) from `format_for_llm()` instead of a plain string.
139139
`TemplateRepresentation` is a dataclass with these fields:
140140

141141
| Field | Type | Purpose |

docs/docs/advanced/mellea-core-internals.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ boundaries let you control exactly where the tokeniser makes splits.
4141

4242
A `Component` is a declarative structure that can depend on other `Component`s or
4343
`CBlock`s. Components are the unit of composition in Mellea. `Message`,
44-
[`Instruction`](../guide/glossary#instruction), `@mify` objects, and `@generative` functions all produce `Component`s.
44+
[`Instruction`](../reference/glossary#instruction), `@mify` objects, and `@generative` functions all produce `Component`s.
4545

4646
### `ModelOutputThunk`
4747

@@ -220,7 +220,7 @@ in parallel if the backend supports it), and returns `z`'s result.
220220

221221
### TemplateFormatter
222222

223-
Mellea formats Python objects into LLM-readable text using a [`TemplateFormatter`](../guide/glossary#templateformatter).
223+
Mellea formats Python objects into LLM-readable text using a [`TemplateFormatter`](../reference/glossary#templateformatter).
224224
It uses Jinja2 templates stored in a `templates/prompts/` directory. Each
225225
component class can have its own template, looked up by class name.
226226

@@ -247,7 +247,7 @@ The formatter returns the template from the deepest matching directory. A model
247247
of `ibm-granite/granite-3.2-8b-instruct` matches `granite/granite-3-2/instruct`
248248
but not `ibm/` — only one path should match in any given templates directory.
249249

250-
### [`TemplateRepresentation`](../guide/glossary#templaterepresentation)
250+
### [`TemplateRepresentation`](../reference/glossary#templaterepresentation)
251251

252252
Each component's `format_for_llm()` method returns either a string or a
253253
`TemplateRepresentation`. The `TemplateRepresentation` specifies:

docs/docs/advanced/security-and-taint-tracking.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ print(f"Content is safe: {results[0]._result}")
4040
```
4141

4242
`thinking=True` enables extended reasoning mode in the Guardian model for more
43-
accurate results. `results` is a list of [`ValidationResult`](../guide/glossary#validationresult) objects — one per
43+
accurate results. `results` is a list of [`ValidationResult`](../reference/glossary#validationresult) objects — one per
4444
requirement passed to `validate()`.
4545

4646
## Risk types

docs/docs/community/building-extensions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Choose the pathway that fits the scope of your work:
2525
2626
## Custom requirements
2727

28-
A [`Requirement`](../guide/glossary#requirement) validates a generation against a
28+
A [`Requirement`](../reference/glossary#requirement) validates a generation against a
2929
criterion. You can provide a Python function for deterministic checks, or rely on
3030
LLM-as-a-Judge for semantic validation.
3131

@@ -92,7 +92,7 @@ For deeper validation patterns, see [Write Custom Verifiers](../how-to/write-cus
9292

9393
## Custom components
9494

95-
A [`Component`](../guide/glossary#component) is a composite data structure that an LLM
95+
A [`Component`](../reference/glossary#component) is a composite data structure that an LLM
9696
can read and write. Implement the `Component` protocol by providing `parts`,
9797
`format_for_llm`, and `_parse`:
9898

@@ -141,7 +141,7 @@ For a full walkthrough of the Component protocol and templating system, see
141141

142142
## Custom sampling strategies
143143

144-
A [`SamplingStrategy`](../guide/glossary#sampling-strategy) controls how Mellea
144+
A [`SamplingStrategy`](../reference/glossary#sampling-strategy) controls how Mellea
145145
generates and validates outputs — for example, rejection sampling, best-of-n, or
146146
beam search. Subclass `SamplingStrategy` and implement `sample`:
147147

@@ -226,7 +226,7 @@ For built-in strategies and advanced patterns, see
226226

227227
## Custom backends
228228

229-
A [`Backend`](../guide/glossary#backend) connects Mellea to an inference provider.
229+
A [`Backend`](../reference/glossary#backend) connects Mellea to an inference provider.
230230
Subclass the abstract `Backend` class from `mellea.core.backend` and implement
231231
the two abstract methods:
232232

docs/docs/concepts/architecture-vs-agents.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Mellea also supports building agentic programs directly, without an external
132132
orchestrator:
133133

134134
- **ReACT loops** — implement thought/action/observation cycles using `m.chat()`
135-
with [`ChatContext`](../guide/glossary#chatcontext) and the `@tool` decorator. See
135+
with [`ChatContext`](../reference/glossary#chatcontext) and the `@tool` decorator. See
136136
[Tools and Agents](../how-to/tools-and-agents).
137137
- **Guarded agents** — combine the ReACT pattern with `requirements` and
138138
`GuardianCheck` to enforce safety constraints at every step. See

docs/docs/concepts/context-and-sessions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ description: "How Component, Backend, Context, and Session fit together in Melle
44
# diataxis: explanation
55
---
66

7-
Every call to an LLM in Mellea passes through four layers: [**Component**](../guide/glossary#component), [**Backend**](../guide/glossary#backend),
8-
[**Context**](../guide/glossary#context), and **Session**. Understanding how these fit together explains both why
7+
Every call to an LLM in Mellea passes through four layers: [**Component**](../reference/glossary#component), [**Backend**](../reference/glossary#backend),
8+
[**Context**](../reference/glossary#context), and **Session**. Understanding how these fit together explains both why
99
Mellea is structured the way it is and how to extend it effectively.
1010

1111
> **Looking to use this in code?** See [Context and Sessions](../how-to/use-context-and-sessions) for practical examples and session extension patterns.
@@ -30,7 +30,7 @@ raw text or a parsed representation of a model output.
3030
### Backends
3131

3232
A `Backend` takes a `Component`, formats it into a prompt, sends it to an LLM, and
33-
returns the model output as a [`ModelOutputThunk`](../guide/glossary#modeloutputthunk). The `Thunk` is a lazy wrapper: it
33+
returns the model output as a [`ModelOutputThunk`](../reference/glossary#modeloutputthunk). The `Thunk` is a lazy wrapper: it
3434
holds the raw model output and parses it on access (via `.value` or `str()`).
3535

3636
The backend is responsible for:
@@ -52,15 +52,15 @@ The context serves two purposes:
5252

5353
1. **Prompt construction** — the backend calls `ctx.view_for_generation()` to get
5454
the components that should appear in the prompt. For `ChatContext`, this includes
55-
all prior turns. For [`SimpleContext`](../guide/glossary#simplecontext), it includes only the current instruction.
55+
all prior turns. For [`SimpleContext`](../reference/glossary#simplecontext), it includes only the current instruction.
5656

5757
2. **Validation** — during the IVR loop, requirement validators receive the
5858
`Context` object. They can call `ctx.last_output()` to inspect the most recent
5959
model output, or examine the full history for more complex checks.
6060

6161
### Sessions
6262

63-
[`MelleaSession`](../guide/glossary#melleasession) is the developer-facing layer. It wraps a backend and a context,
63+
[`MelleaSession`](../reference/glossary#melleasession) is the developer-facing layer. It wraps a backend and a context,
6464
exposes the `instruct()`, `chat()`, `validate()`, and other methods you use in your
6565
code, and handles the bookkeeping that ties components, context updates, and backend
6666
calls together.
@@ -201,7 +201,7 @@ print(last.value)
201201
turn = m.ctx.last_turn()
202202
```
203203

204-
`last_turn()` returns a [`ContextTurn`](../guide/glossary#contextturn) with `.input` and `.output` fields. It is
204+
`last_turn()` returns a [`ContextTurn`](../reference/glossary#contextturn) with `.input` and `.output` fields. It is
205205
useful for observability or when you need to log exactly what the model received and
206206
produced.
207207

docs/docs/concepts/generative-functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: "How the @generative decorator turns a Python function signature in
66

77
In classical programming, a pure function takes inputs and produces outputs deterministically.
88
In a generative program, a function can have the same interface but delegate its implementation
9-
to an LLM. Mellea calls these [**generative functions**](../guide/glossary#generative-function) and provides the [`@generative`](../guide/glossary#generative) decorator
9+
to an LLM. Mellea calls these [**generative functions**](../reference/glossary#generative-function) and provides the [`@generative`](../reference/glossary#generative) decorator
1010
to define them.
1111

1212
> **Looking to use this in code?** See [Generative Functions](../how-to/generative-functions) for practical examples and API details.

docs/docs/concepts/generative-programming.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "The ideas behind Mellea — what generative programs are, why they
44
# diataxis: explanation
55
---
66

7-
A [_generative program_](../guide/glossary#generative-program) is any program that contains calls to an LLM. This covers
7+
A [_generative program_](../reference/glossary#generative-program) is any program that contains calls to an LLM. This covers
88
everything from a simple prompt wrapper to a complex multi-step reasoning system.
99
The term is deliberately broad: what matters is not how many LLM calls a program
1010
makes, but the structural challenges that arise when you combine stochastic LLM
@@ -32,7 +32,7 @@ unchecked through the system.
3232

3333
## Requirements as the core tool
3434

35-
The primary mechanism Mellea provides for managing stochasticity is [_requirements_](../guide/glossary#requirement).
35+
The primary mechanism Mellea provides for managing stochasticity is [_requirements_](../reference/glossary#requirement).
3636
A requirement is a validation function that checks whether an LLM output meets a
3737
specified criterion:
3838

@@ -51,7 +51,7 @@ result = m.instruct(
5151
```
5252

5353
When the model's output fails a requirement, Mellea can retry the generation with
54-
feedback — the [_Instruct–Validate–Repair_ (IVR)](../guide/glossary#ivr-instruct-validate-repair) loop. This transforms a
54+
feedback — the [_Instruct–Validate–Repair_ (IVR)](../reference/glossary#ivr-instruct-validate-repair) loop. This transforms a
5555
probabilistically unreliable call into one with measurable, controllable reliability:
5656
set a `loop_budget` and the probability of the output satisfying your requirements
5757
approaches 1 as budget increases.
@@ -66,7 +66,7 @@ Not all requirements can be checked cheaply. A constraint like "this JSON is
6666
syntactically valid" can be verified in microseconds; a constraint like "this
6767
answer is grounded in the provided context" may require a second model call.
6868

69-
Mellea's [sampling strategies](../guide/glossary#sampling-strategy) control how retries work:
69+
Mellea's [sampling strategies](../reference/glossary#sampling-strategy) control how retries work:
7070

7171
- **`RejectionSamplingStrategy`** — retry until a requirement passes or the budget
7272
is exhausted. The simplest strategy; good for cheap validators.
@@ -100,10 +100,10 @@ large enough to exceed model limits or degrade output quality.
100100

101101
Mellea addresses this through explicit context management:
102102

103-
- **[`SimpleContext`](../guide/glossary#context)** (default) resets history on each call. The model sees only
103+
- **[`SimpleContext`](../reference/glossary#context)** (default) resets history on each call. The model sees only
104104
the current instruction. This is usually the right choice for independent calls.
105-
- **[`ChatContext`](../guide/glossary#context)** preserves history for multi-turn conversations.
106-
- **[Components](../guide/glossary#component)** ([`@mify`](../guide/glossary#mify--mify), [`@generative`](../guide/glossary#generative)) encapsulate the context needed for a
105+
- **[`ChatContext`](../reference/glossary#context)** preserves history for multi-turn conversations.
106+
- **[Components](../reference/glossary#component)** ([`@mify`](../reference/glossary#mify--mify), [`@generative`](../reference/glossary#generative)) encapsulate the context needed for a
107107
single call, keeping context management compositional rather than global.
108108

109109
## Mellea's position in the ecosystem

docs/docs/concepts/instruct-validate-repair.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ description: "How instruct(), requirements, and the IVR loop work in Mellea."
77
**Prerequisites:** [Quick Start](../getting-started/quickstart) complete,
88
`pip install mellea`, Ollama running locally.
99

10-
`instruct()` is the primary API in Mellea. It builds a structured [`Instruction`](../guide/glossary#component)
10+
`instruct()` is the primary API in Mellea. It builds a structured [`Instruction`](../reference/glossary#component)
1111
component — not a raw chat message — with a description, requirements, user variables,
1212
grounding context, few-shot examples, and images. The instruction is rendered through
13-
[Jinja2](https://jinja.palletsprojects.com/) templates and run through an [instruct–validate–repair (IVR)](../guide/glossary#ivr-instruct-validate-repair) loop by default.
13+
[Jinja2](https://jinja.palletsprojects.com/) templates and run through an [instruct–validate–repair (IVR)](../reference/glossary#ivr-instruct-validate-repair) loop by default.
1414

1515
## Basic `instruct()`
1616

@@ -23,7 +23,7 @@ print(str(email))
2323
# Output will vary — LLM responses depend on model and temperature.
2424
```
2525

26-
`instruct()` returns a [`ModelOutputThunk`](../guide/glossary#modeloutputthunk). Access the result as a string with
26+
`instruct()` returns a [`ModelOutputThunk`](../reference/glossary#modeloutputthunk). Access the result as a string with
2727
`str(email)` or via `email.value`.
2828

2929
## User variables
@@ -76,7 +76,7 @@ print(str(email))
7676

7777
## Custom validation functions
7878

79-
For deterministic checks, attach a `validation_fn` to a [`Requirement`](../guide/glossary#requirement):
79+
For deterministic checks, attach a `validation_fn` to a [`Requirement`](../reference/glossary#requirement):
8080

8181
```python
8282
from mellea import start_session
@@ -129,7 +129,7 @@ print(str(email))
129129

130130
## Sampling strategies and the IVR loop
131131

132-
By default, `instruct()` uses [`RejectionSamplingStrategy`](../guide/glossary#sampling-strategy)`(loop_budget=2)`: it
132+
By default, `instruct()` uses [`RejectionSamplingStrategy`](../reference/glossary#sampling-strategy)`(loop_budget=2)`: it
133133
generates once, validates all requirements, and retries up to two times if any fail.
134134

135135
Configure the loop explicitly with `strategy`:
@@ -160,7 +160,7 @@ else:
160160
print(str(result.sample_generations[0].value))
161161
```
162162

163-
With `return_sampling_results=True`, `instruct()` returns a [`SamplingResult`](../guide/glossary#samplingresult) instead
163+
With `return_sampling_results=True`, `instruct()` returns a [`SamplingResult`](../reference/glossary#samplingresult) instead
164164
of a `ModelOutputThunk`. This lets you inspect whether validation passed and access
165165
all intermediate generations.
166166

@@ -242,7 +242,7 @@ print(str(m.ctx.last_output()))
242242
# Output will vary — LLM responses depend on model and temperature.
243243
```
244244

245-
[`ChatContext`](../guide/glossary#context) accumulates turns. `SimpleContext` (the default) discards the previous
245+
[`ChatContext`](../reference/glossary#context) accumulates turns. `SimpleContext` (the default) discards the previous
246246
turn on each call.
247247

248248
## `chat()` vs `instruct()`

docs/docs/concepts/plugins.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ When an event fires during Mellea's execution (e.g., "about to call the LLM" or
1818
Plugins are organized into six hook categories:
1919

2020
- **Session Lifecycle** — session init, reset, and cleanup (`session_pre_init`, `session_post_init`, `session_reset`, `session_cleanup`)
21-
- **[Component](../guide/glossary#component) Lifecycle** — before and after component execution (`component_pre_execute`, `component_post_success`, `component_post_error`)
21+
- **[Component](../reference/glossary#component) Lifecycle** — before and after component execution (`component_pre_execute`, `component_post_success`, `component_post_error`)
2222
- **Generation Pipeline** — before and after LLM calls (`generation_pre_call`, `generation_post_call`, `generation_error`)
23-
- **Validation** — before and after [requirement](../guide/glossary#requirement) checks (`validation_pre_check`, `validation_post_check`)
23+
- **Validation** — before and after [requirement](../reference/glossary#requirement) checks (`validation_pre_check`, `validation_post_check`)
2424
- **Sampling Pipeline** — sampling loop events (`sampling_loop_start`, `sampling_iteration`, `sampling_repair`, `sampling_loop_end`)
2525
- **Tool Execution** — before and after tool invocations (`tool_pre_invoke`, `tool_post_invoke`)
2626

@@ -246,7 +246,7 @@ unregister(log_generation)
246246

247247
### Session scope
248248

249-
Pass plugins to [`start_session()`](../guide/glossary#melleasession), fires only within that session.
249+
Pass plugins to [`start_session()`](../reference/glossary#melleasession), fires only within that session.
250250

251251
```python
252252
from mellea import start_session
@@ -1003,4 +1003,4 @@ from mellea.plugins import (
10031003

10041004
---
10051005

1006-
**See also:** [Glossary](../guide/glossary), [Tools and Agents](../how-to/tools-and-agents), [Security and Taint Tracking](../advanced/security-and-taint-tracking), [OpenTelemetry Tracing](../evaluation-and-observability/opentelemetry-tracing)
1006+
**See also:** [Glossary](../reference/glossary), [Tools and Agents](../how-to/tools-and-agents), [Security and Taint Tracking](../advanced/security-and-taint-tracking), [OpenTelemetry Tracing](../evaluation-and-observability/opentelemetry-tracing)

0 commit comments

Comments
 (0)