haiku.rag/haiku_rag_slim/haiku/rag/capabilities
Yiorgis Gozadinos cab510d0d5
Give the evidence capabilities one typed state
RAGState and AnalysisState each declared the same five fields, so the generic
base could not name them: StateT was bound to BaseModel, and every access
went through cast(Any, state), a getattr by string, or a loop clearing fields
by name so it could skip the one only AnalysisState has.

EvidenceState declares them once. RAGState adds nothing, AnalysisState adds
executions and overrides begin_invocation to clear them. StateT binds to
EvidenceState, which removes all ten casts and both state-shape getattrs; the
three getattr(ctx.deps, "state") probes stay, since those check a
host-supplied object rather than our own state.

discover_evidence reached into capability.state for two fields. It now asks
through evidence_record() and citation_index(), alongside the
evidence_tool_names() and cite_available accessors it already used. The eval
runner's _RagLikeState protocol and the chat app's getattr reads described
this shape from outside and are gone.

Compatibility is semantic JSON-object equivalence, not bytes: field names and
nesting are unchanged, so a dict stored by 0.75.0 loads and re-dumps equal,
but deriving from a shared base reorders AnalysisState's keys. Nothing
serializes, hashes or string-compares this state — every carry point
re-validates by key.
2026-08-19 17:08:44 +03:00
..
instructions Let a model declare that nothing grounds its answer 2026-08-13 13:39:42 +03:00
__init__.py Give the evidence capabilities one typed state 2026-08-19 17:08:44 +03:00
_base.py Give the evidence capabilities one typed state 2026-08-19 17:08:44 +03:00
_tools.py replace haiku.skills with native Pydantic AI capabilities 2026-07-24 15:26:17 +03:00
analysis.py Give the evidence capabilities one typed state 2026-08-19 17:08:44 +03:00
compaction.py Judge each capability's evidence by its own record 2026-08-13 15:57:33 +03:00
evidence.py Give the evidence capabilities one typed state 2026-08-19 17:08:44 +03:00
ledger.py Let the record say whether a question is still being answered 2026-08-13 15:03:24 +03:00
policy.py Notice the endings a structured answer arrives in 2026-08-13 13:39:43 +03:00
rag.py Give the evidence capabilities one typed state 2026-08-19 17:08:44 +03:00