Cookies

With your permission, we use Google Analytics cookies to measure visits and improve the site. Necessary cookies are always on. You can change your choice or withdraw consent anytime in the footer, under Cookie settings. Cookie Policy

Skip to content

Voice Agents ·Intermediate

Voice RAG OpenAI SDK

About this app

Creates a voice-enabled RAG system using OpenAI's SDK - Supports PDF document processing and chunking - Uses Qdrant as the vector database for efficient similarity search - Implements real-time text-to-speech with multiple voice options - Provides a user-friendly Streamlit interface - Allows downloading of generated audio responses - Supports multiple document uploads and tracking

  • Complete open-source code
  • Step-by-step tutorial

Technical sheet

Category
Voice Agents
Difficulty
Intermediate
Models
OpenAI
Frameworks
LangChain, OpenAI Agents SDK
Runs locally?
Needs cloud APIs
Required keys
OPENAI_API_KEYQDRANT_API_KEY

License Apache-2.0 · content curated and maintained by Doutor AI.

Full tutorial

🎙️ Voice RAG with OpenAI SDK

🎓 FREE Step-by-Step Tutorial

👉 Click here to follow our complete step-by-step tutorial and learn how to build this from scratch with detailed code walkthroughs, explanations, and best practices.

This script demonstrates how to build a voice-enabled Retrieval-Augmented Generation (RAG) system using OpenAI's SDK and Streamlit. The application allows users to upload PDF documents, ask questions, and receive both text and voice responses using OpenAI's text-to-speech capabilities.

Features

  • Creates a voice-enabled RAG system using OpenAI's SDK
  • Supports PDF document processing and chunking
  • Uses Qdrant as the vector database for efficient similarity search
  • Implements real-time text-to-speech with multiple voice options
  • Provides a user-friendly Streamlit interface
  • Allows downloading of generated audio responses
  • Supports multiple document uploads and tracking

How to get Started?

  1. Clone the GitHub repository
git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git
cd awesome-llm-apps/voice_ai_agents/voice_rag_openaisdk
  1. Install the required dependencies:
pip install -r requirements.txt
  1. Set up your API keys:
OPENAI_API_KEY='your-openai-api-key'
QDRANT_URL='your-qdrant-url'
QDRANT_API_KEY='your-qdrant-api-key'
  1. Run the Voice RAG application:
streamlit run rag_voice.py
  1. Open your web browser and navigate to the URL provided in the console output to interact with the Voice RAG system.

How it works?

  1. Document Processing:
  • Upload PDF documents through the Streamlit interface
  • Documents are split into chunks using LangChain's RecursiveCharacterTextSplitter
  • Each chunk is embedded using FastEmbed and stored in Qdrant
  1. Query Processing:
  • User questions are converted to embeddings
  • Similar documents are retrieved from Qdrant
  • A processing agent generates a clear, spoken-word friendly response
  • A TTS agent optimizes the response for speech synthesis
  1. Voice Generation:
  • Text responses are converted to speech using OpenAI's TTS
  • Users can choose from multiple voice options
  • Audio can be played directly or downloaded as MP3
  1. Features:
  • Real-time audio streaming
  • Multiple voice personality options
  • Document source tracking
  • Download capability for audio responses
  • Progress tracking for document processing

From the same category

Voice AgentsIntermediate

Self-Guided AI Audio Tour Agent

A conversational voice agent system that generates immersive, self-guided audio tours based on the user’s location, areas of interest, and tour durati…

  • OpenAI
Voice AgentsIntermediate

Customer Support Voice Agent

An OpenAI SDK powered customer support agent application that delivers voice-powered responses to questions about your knowledge base using OpenAI's G…

  • OpenAI
Voice AgentsIntermediate

Insurance Claim Live Agent Team

A voice-first insurance claim intake app that lets a claimant talk naturally while the agent builds a structured claim packet in real time. The UI sho…

  • Gemini

Need a tailor-made solution?

Not sure where to start with AI in your business? Get a free assessment and a tailored plan - no commitment.

Save hours every week with AI, no hassle

Doutor AI gives you 1,859 ready-to-copy AI prompts, by industry and in plain English - plus a complete technical library for those who want to go further.

See plans