Creates a new ProviderManagerImpl instance.
Configuration for the provider manager.
Gets a managed adapter instance based on runtime configuration.
The runtime provider configuration specifying which provider and model to use.
A promise resolving to a ManagedAdapterAccessor containing the adapter and release function.
This method implements sophisticated adapter management:
Cache Check: First checks if an existing instance matches the requested configuration
Local Provider Constraints: For local providers (isLocal: true):
API Provider Concurrency:
Instance Creation: Creates new instances using provider's adapter class
Accessor Return: Returns an object with:
// Request with a pooled instance
const accessor = await manager.getAdapter({
providerName: 'openai',
modelId: 'gpt-4',
adapterOptions: { temperature: 0.7 }
});
const stream = await accessor.adapter.call(prompt, options);
for await (const event of stream) { ... }
accessor.release();
// Request that will be queued if limit reached
const accessor2 = await manager.getAdapter({
providerName: 'openai',
modelId: 'gpt-4'
});
// ... request completes ...
Returns an array of all registered provider names.
Array of provider name strings.
Default implementation of the IProviderManager interface.
Remarks
This class provides intelligent management of LLM provider adapters with the following capabilities:
Lifecycle Management:
Concurrency Control:
Provider Types:
API-based providers (OpenAI, Anthropic, etc.):
Local providers (Ollama, local LLMs):
Request Queuing:
Error Handling:
Security:
Usage Example:
ProviderManagerImpl
Implements
IProviderManager