Skip to content

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

ParameterTypeDescription
providersBaseProvider[]Array of provider instances, each declaring their roles

Returns

ResolvedPipeline

A ResolvedPipeline with a typed provider in every slot

Remarks

This is the main entry point of the provider resolution algorithm. It:

  1. Iterates over each provider’s roles array and assigns it to pipeline slots.
  2. Detects and reports duplicate role assignments (two providers claiming the same role).
  3. Auto-fills default providers when both roles in a natural pair are uncovered:
    • input + sttnew NativeSTT() (multi-role, covers both)
    • tts + outputnew NativeTTS() (multi-role, covers both)
  4. Reports any uncovered roles as a ConfigurationError.
  5. 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

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency