Generate structured recipes from natural language using a multi-agent LangGraph pipeline and a Streamlit UI.
- Multi-agent pipeline: intent extraction, planning, ingredient optimization, steps, validation, confidence scoring.
- Streamlit UI for interactive use.
- CLI entrypoint for quick testing.
- YouTube transcript-based validation (optional, via
yt-dlp+faster-whisper).
- Create a virtual environment and install dependencies:
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt- Configure environment variables:
touch .envThen add this line inside .env:
OPENROUTER_API_KEY="your_openrouter_key_here"
Streamlit UI:
streamlit run streamlit_app.pyCLI:
python main.pyBuild image:
docker build -t cooking-assistant .Run container:
docker run --rm -p 8501:8501 --env-file .env cooking-assistantOptional (CLI in container):
docker run --rm --env-file .env cooking-assistant python main.pyThis project uses a LangGraph StateGraph with a shared state object that flows through specialized nodes.
Defined in state.py as CookingState. It is a Python dict that represents the current workflow data:
- Input:
user_query - Understanding:
intent,constraints - Planning:
recipe_plan,optimized_ingredients,steps - Validation and output:
validation,final_recipe - Meta:
confidence,safety_flags,retries
Defined in graph.py via graph.add_node(...). Each node reads state and returns an updated state:
intent_extractor-> parse intent + constraintsrecipe_planner-> high-level planingredient_optimizer-> adapt ingredientsstep_generator-> generate stepsrecipe_validator-> validate and finalizeconfidence_scorer-> compute confidence score
The current graph is linear:
intent_extractor
-> recipe_planner
-> ingredient_optimizer
-> step_generator
-> recipe_validator
-> confidence_scorer
-> END
Graph definition lives in graph.py:
- Nodes:
graph.add_node(...) - Edges:
graph.add_edge("from", "to") - Entry point:
graph.set_entry_point("intent_extractor")
- The graph is currently sequential (no branching, retries, or feedback loops).
- YouTube validation depends on network access and can be slow or fail if YouTube changes its HTML.