ArchUnitPython icon indicating copy to clipboard operation
ArchUnitPython copied to clipboard

[FEATURE] Provider-SDK boundary

Open LukasNiessen opened this issue 4 months ago • 0 comments

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

  • [ ] Importing openai from outside src/llm/** fails; the adapter passes.

LukasNiessen avatar Jul 26 '26 22:07 LukasNiessen