Module

sources

Shared source protocols and types.

A source is anything that produces typed data — a database, an LLM, a file watcher, a message queue. Sources have two modes:

  • fetch: produce a complete result (await source.fetch())
  • stream: produce results incrementally (async for item in source.stream())

Both modes yield frozen dataclasses. The template engine (kida) renders them identically regardless of origin. AUser from Postgres and a Summary from Claude are both just frozen dataclasses in a template context.

This module defines the shared vocabulary thatchirp.data and chirp.ai build on. Application code rarely imports from here directly.

Classes

Fetchable 1
A source that can produce a complete typed result.

A source that can produce a complete typed result.

Methods

fetch 0 list[T]
async
async def fetch(self) -> list[T]
Returns
list[T]
Streamable 1
A source that can produce results incrementally.

A source that can produce results incrementally.

Methods

stream 0 AsyncIterator[T]
def stream(self) -> AsyncIterator[T]
Returns
AsyncIterator[T]
Source 0
A source that supports both fetch and stream access.

A source that supports both fetch and stream access.