sarvamconv_ai_sdk library
Classes
- AudioInterface
- Abstract audio interface for handling audio input and output.
- ClientAudioChunkMsg
- Client audio chunk message - sends audio data to the server.
- ClientAudioMsg
- Client audio message - sends complete audio data for transcription.
- ClientInteractionEndMsg
- Client requesting interaction end.
- ClientInteractionStartMsg
- Initialize interaction message from client.
- ClientMsgBase
- Base class for all client messages.
- ClientPongMsg
- Response to latency ping.
- ClientTextChunkMsg
- Client text chunk message - streaming text to the server.
- ClientTextMsg
- Client text message - send text to the server.
- CustomAppOverrides
- Custom app overrides for an interaction.
- DefaultAudioInterface
- Default audio interface with platform-specific audio output.
- InteractionConfig
- Configuration used to start an interaction.
- MsgBase
- Base class for all messages.
- SamvaadAgent
- Main conversational agent class for real-time voice and text interactions.
- ServerAudioChunkMsg
- Server audio chunk message - receives audio data from the server.
- ServerEventBase
- Base class for all server events.
- ServerInteractionConnectedEvent
- Conversation session has started/connected.
- ServerInteractionEndEvent
- Conversation session has ended.
- ServerMsgBase
- Base class for all server messages.
- ServerPingMsg
- Latency measurement ping from server.
- ServerTextChunkMsg
- Server text chunk message - streaming text from the server.
- ServerTextMsg
- Server text message - complete text from the server.
- ServerUserInterruptEvent
- Signals that the user interrupted the agent (e.g., barge-in).
Enums
- AudioEncoding
- Audio encoding formats supported by the SDK.
- ClientMsgCategory
- Categories of client messages.
- ClientMsgType
- Types of messages the client can send.
- InteractionType
- Type of interaction.
- MsgOrigin
- Origin of a message.
- MsgStatus
- Status of a message stream.
- SarvamToolLanguageName
- Language names supported by Sarvam tools.
- ServerMsgCategory
- Categories of server messages.
- ServerMsgType
- Types of messages the server can send.
- SupportedSampleRate
- Supported sample rates for audio.
- UserIdentifierType
- Type of user identifier.
Constants
- outputSampleRate → const int
- Default output sample rate.
-
supportedSampleRates
→ const List<
int> - List of supported sample rates for validation.
Functions
-
createConversation(
{required InteractionConfig config, String? apiKey, AudioInterface? audioInterface, AudioCallback? audioCallback, TextCallback? textCallback, EventCallback? eventCallback, String baseUrl = 'https://apps.sarvam.ai/api/app-runtime/', Map< String, String> ? headers}) → Future<SamvaadAgent> - Create and start a conversation session.
-
isValidSampleRate(
int sampleRate) → bool - Validates if a sample rate is supported.
-
parseServerMessage(
Map< String, dynamic> data) → ServerMsgBase - Parse a server message from a raw JSON-like map.
Typedefs
-
AudioCallback
= Future<
void> Function(ServerAudioChunkMsg msg) - Callback type for audio messages from the server.
-
AudioInputCallback
= Future<
void> Function(Uint8List audioData, int frameCount) - Callback type for receiving audio input data.
- ClientTextMsgType = ClientMsgBase
- Union type for client text messages.
-
EventCallback
= Future<
void> Function(ServerEventBase event) - Callback type for event messages from the server.
- ServerTextMsgType = ServerMsgBase
- Union type for server text messages.
-
TextCallback
= Future<
void> Function(ServerMsgBase msg) - Callback type for text messages from the server.