← Table of Contents · Page 86 of 868
THE ANATOMY OF A PRODUCTION HARNESS (COMPONENT MAP)
Part 5 of 14
THE MODEL ADAPTER
The model adapter is the translator between the harness and different model providers.
A provider is a company or service that offers access to a model.
Each provider has its own way of receiving requests and sending replies, including different field names, different ways of describing tools, and different error messages.
If the whole harness were written to speak one provider's dialect, switching providers would mean rewriting large parts of it.
The model adapter prevents that.
Inside the harness, everything uses one common internal format.
The adapter converts that format into the provider's format on the way out, and converts the provider's reply back into the common format on the way in.
You can think of an electrical plug adapter for travel.
Your laptop charger stays the same, and a small adapter makes it fit the wall sockets of each country.
A good adapter also gives you freedom: you can test a cheaper model, move to a different provider if prices change, or run a model on your own hardware, all without changing the rest of the harness.
You will see in Chapter 3 that models can be reached through an API, and the adapter is the piece of code that handles that doorway on the harness side.
Advertisement
Read Aloud:
0:00 / 0:00