Skip to content

e-ndorfin/philer-onboarding

Repository files navigation

Recipe Creation & Evaluation System - Philer Onboarding Project

🏗️ Project Architecture

System Components

philer-onboarding/
│
├── agents/                     # Agents package - modular agent components
│   ├── __init__.py            # Package initialization and exports
│   ├── agent_definitions.py   # Agent class definitions and roles
│   ├── workflow_state.py      # Shared workflow state definition
│   ├── recipe_creator_node.py # Recipe creation node function
│   ├── recipe_evaluator_node.py # Recipe evaluation node function
│   └── format_output_node.py  # Output formatting node function
├── frontend/                   # Frontend web interface
│   ├── frontend.py            # FastAPI web server and chat interface
│   └── templates/             # Frontend HTML templates
│       └── chat.html          # Main chat interface
├── workflow.py                 # Main LangGraph workflow orchestration
├── main.py                     # Main entry point to run the frontend server
├── requirements.txt            # Python dependencies
├── .env.example               # Environment variables template
├── test_setup.py              # Setup validation and testing
├── setup.py                   # Quick setup automation script
└── README.md                  # This file

🤖 Agent System Design

Agent 1: Recipe Creator Agent

  • Role: Creative Recipe Developer
  • Purpose: Generate detailed, practical recipes based on user requests
  • Capabilities:
    • Creates complete recipes with ingredients and instructions
    • Considers dietary restrictions and preferences
    • Provides cooking tips and variations
    • Estimates cooking and prep times

Agent 2: Recipe Evaluator Agent

  • Role: Recipe Quality Assurance Specialist
  • Purpose: Evaluate recipes for logic, safety, and quality
  • Capabilities:
    • Analyzes cooking procedures for correctness
    • Identifies potential food safety issues
    • Suggests recipe improvements
    • Validates ingredient combinations and cooking methods

📁 File System Guide

agents.py - Agent Definitions

This file contains the core agent classes and their configurations:

# Key Components:
- RecipeCreatorAgent class: Handles recipe generation
- RecipeEvaluatorAgent class: Handles recipe evaluation
- AGENT_DEFINITIONS: Registry of all available agents

Role: Defines the "who" - what each agent does and how they behave

workflow.py - LangGraph Workflow

This is the main orchestration file that defines how agents work together:

# Key Components:
- WorkflowState: Defines data structure passed between agents
- RecipeWorkflow class: Orchestrates the multi-agent process
- Node functions: Individual steps in the workflow
- Graph building: Defines the flow between agents

Role: Defines the "how" - the sequence and logic of agent interactions

🚀 Setup Instructions

1. Environment Setup

# Create and activate virtual environment
python -m venv venv
venv\Scripts\activate  # Windows
source venv/bin/activate  # Linux/Mac

# Install Python dependencies
pip install -r requirements.txt

# Set up environment variables
copy .env.example .env
# Edit .env file and add your OpenAI API key

2. Configuration

Edit the .env file:

OPENAI_API_KEY=your_openai_api_key_here

3. Running the Application

Option A: Run the Full Web Application (Recommended)

python main.py

Then open your browser to: http://localhost:8000

🔄 Workflow Flow Explanation

Step-by-Step Process

  1. User Input: User requests a recipe via the chat interface
  2. Recipe Creation: Recipe Creator Agent generates a detailed recipe
  3. Recipe Evaluation: Recipe Evaluator Agent reviews and critiques the recipe
  4. Output Formatting: System combines both outputs into a user-friendly response
  5. Response Delivery: Final result is displayed in the chat interface

State Management

The workflow uses a WorkflowState object that gets passed between nodes (this is easier for keeping track of progress and variables):

WorkflowState:
- user_input: Original user request
- recipe: Generated recipe
- evaluation: Professional evaluation
- final_output: Formatted final response
- step: Current workflow stage

🔧 Customization Ideas

  1. Read the LangGraph documentation
  2. Make custom agents (e.g. specializing in Chinese cuisine by editing agent role)
  3. Add more agents (cost calculators)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published