UNPKG

react-native-deepgram

Version:

React Native SDK for Deepgram's AI-powered speech-to-text, real-time transcription, and text intelligence APIs. Supports live audio streaming, file transcription, sentiment analysis, and topic detection for iOS and Android.

65 lines 4.39 kB
import type { DeepgramVoiceAgentSettings, DeepgramVoiceAgentFunctionCallResponseMessage, DeepgramVoiceAgentClientMessage, DeepgramVoiceAgentServerMessage, DeepgramVoiceAgentWelcomeMessage, DeepgramVoiceAgentSettingsAppliedMessage, DeepgramVoiceAgentConversationTextMessage, DeepgramVoiceAgentAgentThinkingMessage, DeepgramVoiceAgentAgentStartedSpeakingMessage, DeepgramVoiceAgentAgentAudioDoneMessage, DeepgramVoiceAgentUserStartedSpeakingMessage, DeepgramVoiceAgentFunctionCallRequestMessage, DeepgramVoiceAgentReceiveFunctionCallResponseMessage, DeepgramVoiceAgentPromptUpdatedMessage, DeepgramVoiceAgentSpeakUpdatedMessage, DeepgramVoiceAgentInjectionRefusedMessage, DeepgramVoiceAgentWarningMessage, DeepgramVoiceAgentErrorMessage, DeepgramVoiceAgentAudioConfigMessage } from './types'; export interface UseDeepgramVoiceAgentProps { endpoint?: string; defaultSettings?: DeepgramVoiceAgentSettings; autoStartMicrophone?: boolean; downsampleFactor?: number; autoPlayAudio?: boolean; trackState?: boolean; trackConversation?: boolean; trackAgentStatus?: boolean; onBeforeConnect?: () => void; onConnect?: () => void; onClose?: (event?: any) => void; onError?: (error: unknown) => void; onMessage?: (message: DeepgramVoiceAgentServerMessage) => void; onWelcome?: (message: DeepgramVoiceAgentWelcomeMessage) => void; onSettingsApplied?: (message: DeepgramVoiceAgentSettingsAppliedMessage) => void; onConversationText?: (message: DeepgramVoiceAgentConversationTextMessage) => void; onAgentThinking?: (message: DeepgramVoiceAgentAgentThinkingMessage) => void; onAgentStartedSpeaking?: (message: DeepgramVoiceAgentAgentStartedSpeakingMessage) => void; onAgentAudioDone?: (message: DeepgramVoiceAgentAgentAudioDoneMessage) => void; onUserStartedSpeaking?: (message: DeepgramVoiceAgentUserStartedSpeakingMessage) => void; onFunctionCallRequest?: (message: DeepgramVoiceAgentFunctionCallRequestMessage) => void; onFunctionCallResponse?: (message: DeepgramVoiceAgentReceiveFunctionCallResponseMessage) => void; onPromptUpdated?: (message: DeepgramVoiceAgentPromptUpdatedMessage) => void; onSpeakUpdated?: (message: DeepgramVoiceAgentSpeakUpdatedMessage) => void; onInjectionRefused?: (message: DeepgramVoiceAgentInjectionRefusedMessage) => void; onWarning?: (message: DeepgramVoiceAgentWarningMessage) => void; onServerError?: (message: DeepgramVoiceAgentErrorMessage) => void; onAudioConfig?: (message: DeepgramVoiceAgentAudioConfigMessage) => void; onAudio?: (audioData: ArrayBuffer) => void; } export interface UseDeepgramVoiceAgentReturn { connect: (settings?: DeepgramVoiceAgentSettings) => Promise<void>; disconnect: () => void; sendMessage: (message: DeepgramVoiceAgentClientMessage) => boolean; sendSettings: (settings: DeepgramVoiceAgentSettings) => boolean; injectUserMessage: (content: string) => boolean; injectAgentMessage: (message: string) => boolean; sendFunctionCallResponse: (response: Omit<DeepgramVoiceAgentFunctionCallResponseMessage, 'type'>) => boolean; sendKeepAlive: () => boolean; updatePrompt: (prompt: string) => boolean; sendMedia: (chunk: ArrayBuffer | Uint8Array | number[]) => boolean; isConnected: () => boolean; state?: { connectionState: 'idle' | 'connecting' | 'connected' | 'disconnected'; error: string | null; warning: string | null; }; conversation?: Array<{ role: string; content: string; }>; clearConversation?: () => void; agentStatus?: { thinking: string | null; latency: { total?: number; tts?: number; ttt?: number; } | null; }; } export declare function useDeepgramVoiceAgent({ endpoint, defaultSettings, autoStartMicrophone, autoPlayAudio, trackState, trackConversation, trackAgentStatus, downsampleFactor, onBeforeConnect, onConnect, onClose, onError, onMessage, onWelcome, onSettingsApplied, onConversationText, onAgentThinking, onAgentStartedSpeaking, onAgentAudioDone, onUserStartedSpeaking, onFunctionCallRequest, onFunctionCallResponse, onPromptUpdated, onSpeakUpdated, onInjectionRefused, onWarning, onServerError, onAudioConfig, onAudio, }?: UseDeepgramVoiceAgentProps): UseDeepgramVoiceAgentReturn; //# sourceMappingURL=useDeepgramVoiceAgent.d.ts.map