0

Product Review Agent

awesome-llm-apps2_2_product_review_agent

A complex structured output agent demonstrating advanced Pydantic schemas for product review analysis.

Sign in to save downloads to your library and vote.

Preview

Product Review Agent

A complex structured output agent demonstrating advanced Pydantic schemas for product review analysis.

๐ŸŽฏ What This Demonstrates

  • Complex Schemas: Multi-field Pydantic models with various data types
  • List Fields: Arrays of strings for pros/cons analysis
  • Boolean Logic: Recommendation decisions based on review content
  • Sentiment Analysis: Automated sentiment classification

๐Ÿš€ Quick Start

  1. Install OpenAI Agents SDK:

    pip install openai-agents
    
  2. Set up environment:

    cp ../env.example .env
    # Edit .env and add your OpenAI API key
    
  3. Run the agent:

    from agents import Runner
    from agent import root_agent
    
    review_text = "This laptop is amazing! Great performance, long battery life, but a bit heavy."
    result = Runner.run_sync(root_agent, f"Analyze this review: {review_text}")
    print(result.final_output)  # Returns ProductReview object
    

๐Ÿ’ก Key Concepts

  • Rating Validation: Integer constraints (1-5 stars)
  • Sentiment Enum: Automatic positive/negative/neutral classification
  • List Processing: Extracting multiple pros and cons
  • Optional Fields: Handling missing reviewer information

๐Ÿงช Example Output

{
    "product_name": "Gaming Laptop XYZ",
    "rating": 4,
    "summary": "Great performance but heavy design",
    "sentiment": "positive",
    "pros": ["Great performance", "Long battery life", "Good display"],
    "cons": ["Heavy weight", "Expensive price"],
    "recommend": true,
    "reviewer_name": "TechEnthusiast123"
}

๐Ÿ”— Next Steps

Ingestion metadata

Source catalog
awesome-llm-apps
Repository
Shubhamsaboo/awesome-llm-apps ยท main
File path
ai_agent_framework_crash_course/openai_sdk_crash_course/2_structured_output_agent/2_2_product_review_agent/README.md
Last refreshed
7/23/2026, 10:39:09 PM (4h ago)
Refresh schedule
Daily ยท 03:00 UTC
Dedupe status
Unique ยท deduped by (source, url)