Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Promptfoo Promptfoo Provider Registry

From Leeroopedia
Knowledge Sources
Domains Provider_Management, Plugin_Architecture
Last Updated 2026-02-14 08:00 GMT

Overview

A registry pattern that maps provider path prefixes to factory functions for instantiating 70+ LLM provider implementations.

Description

The Provider Registry is the central mapping between provider identifier strings and their concrete implementations. It uses a factory pattern where each registered ProviderFactory has a `test()` predicate (to match provider paths by prefix or pattern) and a `create()` method (to instantiate the provider).

This architecture enables extensibility: adding a new provider requires only registering a new factory entry, without modifying the core loading logic. The registry supports providers like OpenAI, Anthropic, Google, AWS Bedrock, Azure, Ollama, and many more.

Usage

Use this principle when understanding how providers are resolved from config strings. The registry is consulted by loadApiProvider for every provider that isn't a cloud or file reference.

Theoretical Basis

Pseudo-code Logic:

providerMap = [
  { test: (path) => path.startsWith('openai:'), create: (path, opts) => new OpenAiProvider(...) },
  { test: (path) => path.startsWith('anthropic:'), create: (path, opts) => new AnthropicProvider(...) },
  { test: (path) => path.startsWith('python:'), create: (path, opts) => new PythonProvider(...) },
  // ... 70+ entries
]

// Resolution: first matching factory wins
for factory of providerMap:
  if factory.test(providerPath):
    return factory.create(providerPath, options)

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment