Internals
Provider Abstraction Layer
Learn about the provider abstraction layer in Polyglot.
The provider abstraction layer is where Polyglot handles the differences between LLM providers. This layer includes:
- Drivers: Classes that implement provider-specific logic
- Adapters: Classes that convert between unified and provider-specific formats
- Formatters: Classes that handle specific aspects of request/response formatting
Key Interfaces for LLM
Several interfaces define the contract for LLM drivers and adapters:
Key Interface for Embeddings
The embeddings functionality uses a simpler interface:
ModularLLMDriver
The ModularLLMDriver
is a central component that implements the CanHandleInference
interface using adapters:
InferenceDriverFactory
The InferenceDriverFactory
creates the appropriate driver for each provider: