Batoi AIF Docs

Provider Abstraction

Route AI calls through provider contracts instead of binding apps to one vendor.

Provider Abstraction

Provider abstraction keeps application code independent from a single AI vendor SDK. Applications request governed inference through AIF. AIF chooses and calls the provider through a provider contract.

Why It Matters

  • change providers without rewriting product code
  • apply policy before vendor calls
  • normalize request and response metadata
  • support mock providers for development and tests
  • keep provider credentials behind backend controls

Provider Registry

The provider registry is responsible for resolving a named provider implementation.

$registry = new InMemoryProviderRegistry();
$registry->register(new MockProvider('mock'));

Production registries can load provider configuration from application configuration, RAD tables, environment variables, or a secrets manager.

Provider Capabilities

Provider metadata should describe what the provider can do:

  • text generation
  • structured output
  • tool/function calling
  • streaming
  • embeddings
  • image or multimodal input
  • model-specific limits

Policy should use provider capabilities before execution. UI should use capabilities to hide unsupported choices.