Skip to slide
052 / 221

CH 04 · Model-Provider Abstraction and Multi-Model Strategy · 07/15

Read as one page

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.

Finished this idea?

Your learning progress stays in this browser.