BaseProvider
Base interface that all providers must implement.
Defined in: src/core/types/providers.ts:138
Base interface that all providers must implement.
Remarks
Defines the lifecycle methods and metadata properties common to every provider. All STT, LLM, and TTS provider interfaces extend this base. The SDK calls initialize during agent startup and dispose during shutdown.
Example
class MyCustomProvider implements BaseProvider {
readonly type: ProviderType = 'rest';
readonly roles: readonly ProviderRole[] = ['stt'];
private ready = false;
async initialize(): Promise<void> {
// Set up resources
this.ready = true;
}
async dispose(): Promise<void> {
// Clean up resources
this.ready = false;
}
isReady(): boolean {
return this.ready;
}
}
See
- ProviderType for communication type values
- ProviderRole for the pipeline roles a provider can declare
- RestSTTProvider for a REST-based STT implementation contract
- LiveSTTProvider for a WebSocket-based STT implementation contract
- LLMProvider for the LLM implementation contract
- RestTTSProvider for a REST-based TTS implementation contract
- LiveTTSProvider for a WebSocket-based TTS implementation contract
Extended by
Properties
| Property | Modifier | Type | Default value | Description | Defined in |
|---|---|---|---|---|---|
roles | readonly | readonly ProviderRole[] | [] | Pipeline roles this provider covers. Remarks Each provider declares which stages of the 5-role audio pipeline it can fulfil. Single-role providers list one role (e.g. ['stt']); multi-role providers list every role they handle (e.g. ['input', 'stt'] for NativeSTT, which manages its own microphone access). The provider resolution algorithm reads this property to assign providers to pipeline slots. Base provider classes set sensible defaults: - BaseSTTProvider: ['stt'] - BaseLLMProvider: ['llm'] - BaseTTSProvider: ['tts'] See - ProviderRole for the possible role values - ResolvedPipeline for the resolved pipeline slots | src/core/types/providers.ts:166 |
type | readonly | ProviderType | undefined | The communication type this provider uses. See ProviderType | src/core/types/providers.ts:144 |
Methods
dispose()
dispose(): Promise<void>;
Defined in: src/core/types/providers.ts:186
Clean up resources and dispose of the provider.
Returns
Promise<void>
Remarks
Called by CompositeVoice during agent shutdown. The provider should close any open connections, clear buffers, and release resources.
initialize()
initialize(): Promise<void>;
Defined in: src/core/types/providers.ts:177
Initialize the provider and allocate any required resources.
Returns
Promise<void>
Remarks
Called by CompositeVoice during agent startup. The provider should be ready to process requests after this method resolves.
Throws
Error if initialization fails (e.g., invalid API key, network error)
isReady()
isReady(): boolean;
Defined in: src/core/types/providers.ts:193
Check if the provider is initialized and ready to process requests.
Returns
boolean
true if the provider has been initialized and is operational