- Provider Classes:
LLMProvider
andEmbeddingsProvider
- Builder classes for configuring and resolving driver configurations - Drivers: Classes that implement provider-specific logic for inference and embeddings
- Adapters: Classes that convert between unified and provider-specific formats
- Factories: Classes that create appropriate drivers based on configuration
Provider Builder Classes
LLMProvider
TheLLMProvider
class is a builder that configures inference settings and resolves configuration from various sources. It provides a fluent interface for setting up LLM configurations:
withLLMPreset(string $preset)
: Set configuration presetwithConfig(LLMConfig $config)
: Set explicit configurationwithConfigOverrides(array $overrides)
: Override specific config valueswithDsn(string $dsn)
: Configure via DSN stringwithDriver(CanHandleInference $driver)
: Set explicit driver- Use
resolveConfig()
+InferenceDriverFactory::makeDriver()
to create drivers
EmbeddingsProvider
TheEmbeddingsProvider
class builds and configures embeddings settings, resolving configuration from various sources:
withPreset(string $preset)
: Set configuration presetwithConfig(EmbeddingsConfig $config)
: Set explicit configurationwithDsn(string $dsn)
: Configure via DSN stringwithDriver(CanHandleVectorization $driver)
: Set explicit driver- Use
resolveConfig()
+EmbeddingsDriverFactory::makeDriver()
to create drivers
Key Interfaces for LLM
Several interfaces define the contract for LLM drivers and adapters:Key Interfaces for Embeddings
The embeddings functionality uses these key interfaces:ModularLLMDriver
TheModularLLMDriver
is a central component that implements the CanHandleInference
interface using adapters:
Driver Factories
InferenceDriverFactory
TheInferenceDriverFactory
creates the appropriate driver for each LLM provider:
EmbeddingsDriverFactory
TheEmbeddingsDriverFactory
creates embeddings drivers: