Nutri AI is a Streamlit app that uses a LangGraph ReAct agent plus the USDA FoodData Central API to answer nutrition questions, compare foods, and visualize macro/micronutrients.
The high‑level interaction flow between the user, agent, and tools is:
-
main.py: Streamlit UI for the app.- Sets up the page, sidebar, and two modes: “💬 Chat with Agent” and “🔍 Quick Nutrition Lookup”.
- Manages session state, renders the chat history, and draws nutrition charts for USDA data.
-
agent.py: LangGraph ReAct agent and tools.- Defines tools like
search_food,get_nutrition, andcompare_foodsthat call the USDA API. - Builds the Groq LLM client and
build_agent_executor, plusrun_agentused by the Streamlit app.
- Defines tools like
- Install dependencies:
pip install -r requirements.txt- Create a
local.env(or.env) file in this folder with:
USDA_API_KEY=your_usda_api_key
GROQ_API_KEY=your_groq_api_key- Start Streamlit:
streamlit run main.pyThen open the URL shown in your terminal (usually http://localhost:8501) to use Nutri AI.
