Skip to slide
053 / 221

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

Read as one page

A model registry and validation

Centralise the list of allowed model ids in one place: a registry. This does double duty:

  • Provider inference. A simple id-prefix rule (or an explicit map) tells the dispatcher which provider owns a model.
  • Validation. The model id often arrives from the client (the user picked it). Validate it against the registry's allow-list before passing it to a provider, and fall back to a safe default for unknown ids. Never hand an unvalidated, client-supplied model id straight to an API.

Finished this idea?

Your learning progress stays in this browser.