resolveProviders
Resolve a flat array of providers into a fully typed ResolvedPipeline.
function resolveProviders(providers): ResolvedPipeline;
Defined in: src/core/pipeline/resolveProviders.ts:218
Resolve a flat array of providers into a fully typed ResolvedPipeline.
Parameters
| Parameter | Type | Description |
|---|---|---|
providers | BaseProvider[] | Array of provider instances, each declaring their roles |
Returns
A ResolvedPipeline with a typed provider in every slot
Remarks
This is the main entry point of the provider resolution algorithm. It:
- Iterates over each provider’s
rolesarray and assigns it to pipeline slots. - Detects and reports duplicate role assignments (two providers claiming the same role).
- Auto-fills default providers when both roles in a natural pair are uncovered:
input+stt→new NativeSTT()(multi-role, covers both)tts+output→new NativeTTS()(multi-role, covers both)
- Reports any uncovered roles as a ConfigurationError.
- Duck-type validates each slot’s provider against its role interface.
Only the llm role is strictly required — there is no default LLM provider.
Throws
ConfigurationError If the providers array is empty, a role is missing with no applicable default, two providers claim the same role, or a provider lacks required interface methods.
Examples
const pipeline = resolveProviders([
new AnthropicLLM({ proxyUrl: '/api/proxy/anthropic', model: 'claude-haiku-4-5' }),
]);
// pipeline.input === NativeSTT instance (also pipeline.stt)
// pipeline.tts === NativeTTS instance (also pipeline.output)
const pipeline = resolveProviders([
new NativeSTT(), // covers input + stt
new AnthropicLLM({ proxyUrl: '/api/proxy/anthropic', model: 'claude-haiku-4-5' }),
new NativeTTS(), // covers tts + output
]);
const pipeline = resolveProviders([
new MicrophoneInput(),
new DeepgramSTT({ proxyUrl: '/api/proxy/deepgram' }),
new AnthropicLLM({ proxyUrl: '/api/proxy/anthropic', model: 'claude-haiku-4-5' }),
new DeepgramTTS({ proxyUrl: '/api/proxy/deepgram' }),
new BrowserAudioOutput(),
]);
See
- ResolvedPipeline for the output type
- ConfigurationError for error details