CHAPTER 04 · Model-Provider Abstraction and Multi-Model Strategy · 4 / 8
Keep the adapter thin and domain-free
A disciplined adapter knows nothing about your domain. It doesn't know what a "document" or a "citation" is. Its only job is: neutral input → native call → neutral streaming out → accumulated text. All the domain logic (which tools ran, what they touched, how to format the answer) is reconstructed above the adapter, from the callbacks and tool results. This separation keeps adapters small and interchangeable, and keeps your domain logic in one place rather than smeared across three provider files.