实时语音代理应用

一个基于React前端和Python后端的实时语音代理应用,具备RAG功能,适用于需要实时语音处理和智能交互的场景。

  • by SumanMadipeddi
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 SumanMadipeddi/voice-agent

使用说明

语音代理

实时语音代理应用程序,具有React前端和Python后端,基于具有RAG功能的LiveKit构建。

先决条件

  • Node.js 18+和npm
  • Python 3.10+
  • 紫外线 包管理器
  • LiveKit CLI: winget install LiveKit.LiveKitCLI
  • LiveKit Cloud、Pinecone和Azure OpenAI帐户

安装

前端

cd agent-react
npm install

后端

cd backend
uv sync

配置

创建一个 .env 项目根目录中的文件:

VITE_LIVEKIT_URL=wss://your-project.livekit.cloud
VITE_LIVEKIT_API_KEY=your-api-key
VITE_LIVEKIT_API_SECRET=your-api-secret
PINECONE_API_KEY=your-pinecone-api-key
AZURE_OPENAI_API_KEY=your-azure-openai-key
AZURE_OPENAI_ENDPOINT=your-azure-endpoint
AZURE_OPENAI_API_VERSION=2024-02-15-preview

从获取LiveKit凭据 LiveKit云仪表板 → 项目设置→ Keys.

跑步

前端

cd agent-react
npm run dev

访问地址: http://localhost:3000

后端

cd backend
uv run agent.py dev

lk agent create
lk agent delete

项目结构

voice-agent/
├── agent-react/          # React frontend
├── backend/              # Python agent
│   ├── agent.py         # Agent entrypoint
│   └── rag/             # RAG implementation
└── README.md

文档