In short
Only one small 'adapter' module should import the AI SDKs (openai, anthropic, …); everything else uses your own interface. That keeps the app testable and lets you swap models/providers without touching everything.
Problem
Keeps prompts/agents testable and providers swappable behind an interface. Flagship AI rule: concrete and immediately useful — and Python is where most AI apps are written.
Proposal
Ship a preset built on the existing external-dependency rules — e.g. llm_provider_boundary("src/", adapter="**/llm/**", providers=["openai", "anthropic", "google.generativeai", "boto3"]) — so that only the adapter may import provider SDKs and everything else depends on an interface. Under the hood it is should_not().depend_on_external_modules().matching(...) for every folder except the adapter.
Acceptance criteria
In short
Only one small 'adapter' module should import the AI SDKs (openai, anthropic, …); everything else uses your own interface. That keeps the app testable and lets you swap models/providers without touching everything.
Problem
Keeps prompts/agents testable and providers swappable behind an interface. Flagship AI rule: concrete and immediately useful — and Python is where most AI apps are written.
Proposal
Ship a preset built on the existing external-dependency rules — e.g.
llm_provider_boundary("src/", adapter="**/llm/**", providers=["openai", "anthropic", "google.generativeai", "boto3"])— so that only the adapter may import provider SDKs and everything else depends on an interface. Under the hood it isshould_not().depend_on_external_modules().matching(...)for every folder except the adapter.Acceptance criteria
openaifrom outsidesrc/llm/**fails; the adapter passes.