Skip to content

CompositeVoiceConfig

Main configuration type for the CompositeVoice SDK.

Defined in: src/core/types/config.ts:441

Main configuration type for the CompositeVoice SDK.

Remarks

This is the top-level configuration object passed to the CompositeVoice constructor. It accepts a flat providers array containing all pipeline providers, plus optional settings for queue buffering, reconnection, logging, turn-taking, conversation history, eager LLM, error recovery, and custom extensions.

The providers array replaces the old { stt, llm, tts } pattern, enabling multi-role providers (e.g., NativeSTT covering both 'input' and 'stt' roles) and explicit audio I/O providers (e.g., MicrophoneInput, BrowserAudioOutput).

All optional fields have sensible defaults that are applied automatically by the SDK.

Examples

import { CompositeVoice, NativeSTT, AnthropicLLM, NativeTTS } from 'composite-voice';

const agent = new CompositeVoice({
  providers: [
    new NativeSTT(),
    new AnthropicLLM({ proxyUrl: '/api/proxy/anthropic', model: 'claude-haiku-4-5' }),
    new NativeTTS(),
  ],
  conversationHistory: { enabled: true, maxTurns: 10 },
  logging: { enabled: true, level: 'debug' },
});
import {
  CompositeVoice,
  MicrophoneInput,
  DeepgramSTT,
  AnthropicLLM,
  DeepgramTTS,
  BrowserAudioOutput,
} from 'composite-voice';

const agent = new CompositeVoice({
  providers: [
    new MicrophoneInput({ sampleRate: 16000 }),
    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(),
  ],
  queue: {
    input: { maxSize: 2000 },
    output: { maxSize: 500 },
  },
});

See

Properties

PropertyTypeDescriptionDefined in
autoRecover?booleanWhether to enable automatic error recovery. Remarks When true, the SDK attempts to recover from provider errors automatically (e.g., reinitializing a crashed provider) instead of propagating the error immediately.src/core/types/config.ts:540
conversationHistory?ConversationHistoryConfigConversation history configuration. Remarks When enabled, previous turns are sent to the LLM as context for multi-turn conversations. See ConversationHistoryConfigsrc/core/types/config.ts:519
eagerLLM?EagerLLMConfigEager LLM configuration. Remarks When enabled, the LLM starts speculatively on STT preflight events, reducing speech-to-first-token latency. See EagerLLMConfigsrc/core/types/config.ts:530
extra?Record<string, unknown>Additional custom configuration for provider-specific or application-specific needs. Remarks This catch-all record allows you to pass arbitrary data through the configuration without extending the type. Providers can read from this via the config object.src/core/types/config.ts:566
logging?LoggingConfigLogging configuration. Remarks Defaults to DEFAULT_LOGGING_CONFIG when not specified. See LoggingConfigsrc/core/types/config.ts:498
providersBaseProvider[]Array of provider instances for the voice pipeline. Remarks Each provider declares its roles property indicating which pipeline slots it covers. The SDK resolves the 5-role pipeline (input, stt, llm, tts, output) from this array: - Multi-role providers (e.g., NativeSTT with roles: ['input', 'stt']) cover multiple slots with a single instance. - Single-role providers (e.g., MicrophoneInput with roles: ['input']) cover exactly one slot. - The llm role is always required. - When input+stt are uncovered, defaults to NativeSTT(). - When tts+output are uncovered, defaults to NativeTTS(). See BaseProvider for the interface all providers implementsrc/core/types/config.ts:460
queue?{ input?: Partial<AudioBufferQueueConfig>; output?: Partial<AudioBufferQueueConfig>; }Queue configuration for input and output audio buffer queues. Remarks When separate input and STT providers are used (e.g., MicrophoneInput + DeepgramSTT), an AudioBufferQueue buffers audio between them to prevent frame loss during STT connection. Similarly for TTS + output. This config lets you tune queue sizes and overflow behavior. See AudioBufferQueueConfigsrc/core/types/config.ts:473
queue.input?Partial<AudioBufferQueueConfig>Configuration overrides for the input→STT buffer queue.src/core/types/config.ts:475
queue.output?Partial<AudioBufferQueueConfig>Configuration overrides for the TTS→output buffer queue.src/core/types/config.ts:477
reconnection?ReconnectionConfigWebSocket reconnection configuration. Remarks Defaults to DEFAULT_RECONNECTION_CONFIG when not specified. See ReconnectionConfigsrc/core/types/config.ts:488
tools?{ definitions: LLMToolDefinition[]; onToolCall: (toolCall) => Promise<LLMToolResult>; }Tool use configuration for LLM function calling. Remarks When provided, the LLM can invoke tools during generation. Text output is streamed to TTS as usual, while tool calls are handled via the onToolCall callback. After tool execution, the LLM is called again with the tool result to generate a natural language follow-up. Requires the LLM provider to implement ToolAwareLLMProvider.src/core/types/config.ts:553
tools.definitionsLLMToolDefinition[]-src/core/types/config.ts:554
tools.onToolCall(toolCall) => Promise<LLMToolResult>-src/core/types/config.ts:555
turnTaking?TurnTakingConfigTurn-taking behavior configuration. Remarks Defaults to DEFAULT_TURN_TAKING_CONFIG when not specified. See TurnTakingConfigsrc/core/types/config.ts:508

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency