diff --git a/README.md b/README.md index a676858..7047212 100644 --- a/README.md +++ b/README.md @@ -135,22 +135,33 @@ configure({ apiKey: 'YOUR_DEEPGRAM_API_KEY' }); | `useDeepgramTextIntelligence` | Text analysis (summaries, topics, intents, sentiment) | | `useDeepgramManagement` | Typed wrapper around the Management REST API | +> 💡 **Pro tip**: All hooks now export a `state` object (and other reactive values) so you can easily track connection status, errors, and transcripts without maintaining your own state. + --- ## Voice Agent (`useDeepgramVoiceAgent`) `useDeepgramVoiceAgent` connects to `wss://agent.deepgram.com/v1/agent/converse`, captures microphone audio, and optionally auto-plays the agent's streamed responses. It wraps the full Voice Agent messaging surface so you can react to conversation updates, function calls, warnings, and raw PCM audio. +> 🔊 **Audio Handling**: This hook uses `AVAudioEngine` on iOS for hardware-accelerated echo cancellation, ensuring the agent doesn't hear itself speak. It also manages the audio session automatically. + ### Quick start ```tsx const { connect, disconnect, + state, // { connectionState, error, warning } + agentStatus, // { thinking, latency } + conversation, // Array<{ role, content }> injectUserMessage, sendFunctionCallResponse, updatePrompt, } = useDeepgramVoiceAgent({ + trackState: true, // Enable reactive state tracking + trackConversation: true, // Enable conversation history tracking + trackAgentStatus: true, // Enable agent status tracking + autoPlayAudio: true, // Automatically play agent audio defaultSettings: { audio: { input: { encoding: 'linear16', sample_rate: 24_000 }, @@ -207,6 +218,7 @@ const rePrompt = () => { return ( <> + Status: {state.connectionState}