Generated: 2026-04-16 15:39:30 UTC
Both columns come from the real /v1/messages/count_tokens endpoint.
| Category | claude-opus-4-6 | claude-opus-4-7 | Ratio |
|---|
name: dependency-injection
description: FastAPI pattern for app-scoped dependency injection via ResourceProvider[T] classes. Each provider owns one resource's construction and teardown as a single @asynccontextmanager, declares dependencies on other providers via constructor arguments, and is exposed as a fastapi.Depends callable; providers are composed into the app with compose_providers(*providers), which accepts None entries so conditional wiring inlines at the call site as provider if cond else None. "Resource" is load-bearing - this is only for things that live for the lifetime of the app. Per-request values (authenticated user, request-id, per-request DB transaction) use plain async def + Depends; ResourceProvider is not a universal DI container. Trigger whenever you add, refactor, or wire any app-scoped resource in a FastAPI project; HTTP clients, DB pools, service clients, Kafka producers/consumers, schedulers, caches, feature-flag clients, or any singleton that previously