|
| 1 | +# Tavus Avatar Agent |
| 2 | + |
| 3 | +A LiveKit-powered educational AI agent that uses the Tavus to create an interactive study partner focused on teaching about the Fall of the Roman Empire. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Conversational Teaching**: Uses the Socratic method to guide students through learning |
| 8 | +- **Flash Cards**: Creates and manages flash cards for important concepts |
| 9 | +- **Interactive Quizzes**: Builds multiple-choice quizzes to test knowledge retention |
| 10 | +- **Visual Avatar**: Powered by Tavus for procedural visual generation |
| 11 | +- **Voice Interaction**: Natural voice conversation using Deepgram STT and ElevenLabs TTS |
| 12 | + |
| 13 | +## Prerequisites |
| 14 | + |
| 15 | +- Python 3.10+ |
| 16 | +- LiveKit account |
| 17 | +- Tavus account with configured avatar (replica_id and persona_id) |
| 18 | +- API keys for: |
| 19 | + - OpenAI |
| 20 | + - Deepgram |
| 21 | + - ElevenLabs |
| 22 | + - Tavus |
| 23 | + |
| 24 | +## Installation |
| 25 | + |
| 26 | +1. Clone this repository |
| 27 | +2. Install dependencies from the root level of `python-agents-examples` |
| 28 | + ``` |
| 29 | + pip install -r requirements.txt |
| 30 | + ``` |
| 31 | +3. Create a `.env` file in the parent directory with your API keys |
| 32 | + |
| 33 | +## Configuration |
| 34 | + |
| 35 | +Set the following environment variables in your `.env` file: |
| 36 | + |
| 37 | +``` |
| 38 | +OPENAI_API_KEY=your_openai_key |
| 39 | +ELEVENLABS_API_KEY=your_elevenlabs_key |
| 40 | +DEEPGRAM_API_KEY=your_deepgram_key |
| 41 | +TAVUS_API_KEY=your_tavus_key |
| 42 | +LIVEKIT_API_KEY=your_livekit_key |
| 43 | +LIVEKIT_API_SECRET=your_livekit_secret |
| 44 | +``` |
| 45 | + |
| 46 | +Customize the avatar by changing the `replica_id` and `persona_id` in the `entrypoint` function. |
| 47 | + |
| 48 | +## Usage |
| 49 | + |
| 50 | +Run the agent with: |
| 51 | + |
| 52 | +``` |
| 53 | +python tavus.py dev |
| 54 | +``` |
| 55 | + |
| 56 | +### Frontend Setup |
| 57 | + |
| 58 | +1. Navigate to the frontend directory: |
| 59 | + ``` |
| 60 | + cd voice-assistant-frontend |
| 61 | + ``` |
| 62 | + |
| 63 | +2. Install dependencies: |
| 64 | + ``` |
| 65 | + npm install |
| 66 | + ``` |
| 67 | + |
| 68 | +3. Start the development server: |
| 69 | + ``` |
| 70 | + npm run dev |
| 71 | + ``` |
| 72 | + |
| 73 | +4. Open your browser and navigate to: |
| 74 | + ``` |
| 75 | + http://localhost:3000 |
| 76 | + ``` |
| 77 | + |
| 78 | +### Flash Cards |
| 79 | + |
| 80 | +The agent automatically creates flash cards for important concepts. Users can flip cards through the UI or by asking the agent. |
| 81 | + |
| 82 | +### Quizzes |
| 83 | + |
| 84 | +The agent creates interactive quizzes with multiple-choice questions. After completion: |
| 85 | +- Users receive immediate feedback on their performance |
| 86 | +- Flash cards are automatically created for incorrectly answered questions |
| 87 | + |
| 88 | +## Extending |
| 89 | + |
| 90 | +To modify the agent's topic focus: |
| 91 | +1. Update the instructions in the `AvatarAgent` class |
| 92 | +2. Adjust the quiz templates and flash card content to match your subject matter |
0 commit comments