Backend serves signed URLs for ElevenLabs agents and PDF upload to Databricks for RAG.
pip install -r requirements.txt
cp .env.example .env
# Edit .env with required keyscd frontend
npm installTerminal 1 – Backend:
python main.py
# or: uvicorn main:app --reload --port 8000Terminal 2 – Frontend:
cd frontend && npm run devOpen http://localhost:5173 for voice agent.
GET /signed-url– ElevenLabs signed URL for WebSocket connection
Note: The ElevenLabs WebSocket can close after inactivity or network hiccups. The frontend auto-reconnects once on disconnect and shows a "Reconnect" button if the connection fails.
POST /api/cases/{case_id}/pdf– Upload PDF; stores innyusw.buildathon.rag_pdfsand embeddings innyusw.buildathon.rag_chunks
POST /conversation-upload– Store conversation text, save toconversation_raw, embed and save torag_chunks(one chunk per role)
Request body:
{
"case_id": "case-123",
"thread_id": "1",
"Defence": "concatenated defendant arguments...",
"Plaintiff": "concatenated plaintiff arguments..."
}Example:
curl -X POST "http://localhost:8000/api/conversation" \
-H "Content-Type: application/json" \
-d '{"case_id":"c1","thread_id":"t1","Defence":"defendant text","Plaintiff":"plaintiff text"}'POST /api/query– Fetch case chunks, pass to LLM as context, return answer
Request body:
{"case_id": "case-123", "query": "What did the defendant argue?"}Response: answer (LLM response), chunks_used (case chunks provided as context)
ElevenLabs
ELEVENLABS_API_KEY– ElevenLabs API keyELEVENLABS_AGENT_ID– Agent ID
Databricks
DATABRICKS_HOST– e.g.https://xxx.cloud.databricks.comDATABRICKS_TOKEN– Personal access tokenDATABRICKS_HTTP_PATH– SQL warehouse HTTP path (e.g./sql/1.0/warehouses/xxx)
Gemini
GEMINI_API_KEY– For 768-d embeddings
Other
PORT– Backend port (default 8000)
Create volume and tables if needed:
- Volume:
nyusw.buildathon.rag_pdfs(for PDF storage) - Table:
nyusw.buildathon.rag_chunks(chunk_id, doc_id, source_type, source_uri, chunk_index, chunk_text, updated_at, metadata_json, vector_embeddings array) - Table:
nyusw.buildathon.conversation_raw(event_id, thread_id, tenant_id, role, text, created_at, metadata_json, case_id)