This repo includes a small FastAPI prototype for chatting with survey data through a browser UI.
Requirements:
- Python
3.13+ uv
Install dependencies:
uv syncSet the environment variables the prototype uses:
export OPENROUTER_API_KEY=...
export OPENAI_API_KEY=...
export TAVILY_API_KEY=...Notes:
OPENROUTER_API_KEYis used by the main chat agent. The default model isgoogle/gemini-2.5-flashvia OpenRouter.OPENAI_API_KEYis used for embeddings in the vector search tool.TAVILY_API_KEYis only needed if you want web search to work.
Make sure the processed survey assets exist under data/processed/. This repo already contains sample files for the Mental_Health_Tech survey:
data/processed/Mental_Health_Tech_metadata.jsondata/processed/Mental_Health_Tech_segmentation_analysis.jsondata/processed/Mental_Health_Tech_vector_store.json
Run the app:
uv run python fast-api-chat/app/api/main.pyThen open:
http://localhost:8000
Or the terminal:
uv run main.py
- The FastAPI backend lives in
fast-api-chat/app/api/main.py. - The UI is a static chat page served from
fast-api-chat/app/static/. - On connect, the app loads survey metadata from
data/processed/*_metadata.jsonand lists the available surveys in the chat.
Run the preprocessing pipeline to create the processed files:
uv run python insight_bot/preprocessing/run_preprocessing.py path/to/survey.csvThat will generate the metadata, segmentation analysis, and vector store files needed by the prototype.