Skip to main content
Loading navigation
Back to prompt library

Integrating Deepgram for Voice Interaction

Linked challenge: Build Proactive Personalized Assistant with AutoGen & Gemini 2.5 Pro

Prompt source

implementation17 lines6 sectionsNo variables1 code block
Implement a component that uses Deepgram's real-time Speech-to-Text to convert spoken user queries into text input for the `user_proxy` agent. Then, integrate Deepgram's Text-to-Speech to vocalize the `user_proxy`'s responses. Describe the architectural flow and provide relevant code snippets for a simple voice interaction loop.

```python
# Deepgram initialization (example, needs actual implementation for streaming)
# from deepgram import DeepgramClient, LiveTranscriptionEvents
# import asyncio

# DEEPGRAM_API_KEY = "YOUR_DEEPGRAM_API_KEY"
# client = DeepgramClient(DEEPGRAM_API_KEY)

# async def get_transcript_from_mic():
#    # This would involve actual microphone input and streaming to Deepgram
#    pass

# async def speak_text(text):
#    # This would involve converting text to speech and playing audio
#    pass

# Modify user_proxy to use voice input/output
# user_proxy.initiate_chat(action_planner, message=await get_transcript_from_mic())
# await speak_text(response_from_agents)
```