This project is an AI agent that helps you choose the most appropriate statistical test based on a natural language question. Built using LangGraph, LangChain, and a locally embedded version of the scipy.stats documentation, the agent even returns ready-to-run Python code.
"Which test should I use?"
Choosing the right statistical test can be confusing. This AI assistant breaks down your question, retrieves documentation if needed, asks clarifying questions, and recommends the correct test — plus generates the code using scipy.stats.
Access the deployed App here:
https://ai-statistical-advisor.streamlit.app/
Python3.10+- OpenAI API Key
chromadb>= 1.0.16langchain-chroma>= 0.2.5langchain-community>= 0.3.27langchain-openai>= 0.3.28langchain>= 0.3.27langgraph>= 0.6.4openai>= 1.99.3streamlit>= 1.48.0tiktoken>= 0.10.0
- Access the App on http...
- Get an OpenAI API key and add that to the sidebar on the app.
- Write a question about statistical tests
- Hit Search.
- Clone this repo
git clone https://github.com/gurezende/AI-Statistical-Advisor.git- Run the app
stramlit run main.pystat-test-advisor/
├── docs/ # Raw documentation (for RAG)
├── langgraph_agent/
│ ├── graph.py # LangGraph build logic
│ ├── nodes.py # All nodes (classify, clarify, retrieve, respond, code)
├── rag/
│ ├── embedder.py # Chunk + embed docs
│ ├── retriever.py # Load and query embedded docs
├── main.py # CLI interface to run the agent
├── embed.py # One-time embed script
├── requirements.txt
graph TD
A[Start: User Question] --> B[classify_intent]
B -->|search| C[retrieve_info]
B -->|simple| D[respond]
B -->|clarify| E[ask_clarification]
E --> B
C --> D
D --> F[generate_code]
F --> G[End]
I want to compare the means of two independent groups.
Created by Gustavo R Santos as a learning and teaching project using:
- LangGraph for agentic reasoning
- LangChain for RAG and embeddings
- SciPy for statistical tests
Project licensed under MIt License.

