feat(ai,ingestion-ocr): choose the model adapter per call and report its token usage #62

Merged
crapougnax merged 1 commit from feat/61-ai-usage-per-call into develop 2026-11-17 16:22:48 +00:00
Member

Closes #61

  • @quatrain/ai: exports AiUsageInterface and AiUsageCallbackType.
  • @quatrain/ai-gemini: generateText reports usage through onUsage, like generateStructured.
  • @quatrain/ingestion-ocr: process accepts ai (adapter to use, the process-wide one by default) and forwards onUsage. Its build no longer compiles the tests.

Backward compatible: without the new options nothing changes.

Tests: 7 passing on the three packages (4 new).

🤖 Generated with Claude Code

Closes #61 - `@quatrain/ai`: exports `AiUsageInterface` and `AiUsageCallbackType`. - `@quatrain/ai-gemini`: `generateText` reports usage through `onUsage`, like `generateStructured`. - `@quatrain/ingestion-ocr`: `process` accepts `ai` (adapter to use, the process-wide one by default) and forwards `onUsage`. Its build no longer compiles the tests. Backward compatible: without the new options nothing changes. Tests: 7 passing on the three packages (4 new). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(ai,ingestion-ocr): choose the model adapter per call and report its token usage (#61)
All checks were successful
Quatrain Core CI / Monorepo Build, Tests & Quality Audit (push) Successful in 10m55s
Quatrain Core CI / Monorepo Build, Tests & Quality Audit (pull_request) Successful in 11m18s
Quatrain Core CI / Publish Changed Packages to npm (push) Has been skipped
Quatrain Core CI / Publish Changed Packages to npm (pull_request) Has been skipped
71207b2c79
- @quatrain/ai exports the type of a usage report and of its callback.
- GeminiAdapter.generateText reports usage through onUsage, like generateStructured.
- OcrIngestionAdapter.process accepts the adapter to use (ai) and forwards onUsage,
  so an application serving several tenants can run an ingestion with the model of
  one tenant and record what it consumed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
crapougnax merged commit c42700c8c6 into develop 2026-11-17 16:22:48 +00:00
crapougnax deleted branch feat/61-ai-usage-per-call 2026-11-17 16:22:48 +00:00
Sign in to join this conversation.
No description provided.