Spaces:
Runtime error
Runtime error
Download src/agents/module2_planner.py from aiassembled/agentic-diet-engine: direct link, hf CLI and curl.
- Browser
- Download file 896 Bytes
-
https://huggingface.co/spaces/aiassembled/agentic-diet-engine/resolve/main/src/agents/module2_planner.py
- Command line
-
hf download hf://spaces/aiassembled/agentic-diet-engine/src/agents/module2_planner.py
-
curl -L -o module2_planner.py https://huggingface.co/spaces/aiassembled/agentic-diet-engine/resolve/main/src/agents/module2_planner.py
896 Bytes
| import os | |
| from typing import List | |
| from pydantic import BaseModel, Field | |
| from dotenv import load_dotenv | |
| from langchain_google_genai import ChatGoogleGenerativeAI | |
| load_dotenv() | |
| class WeddingPlan(BaseModel): | |
| date: str = Field(..., description="The date of the wedding") | |
| location: str = Field(..., description="The location of the wedding") | |
| number_of_guests: int = Field(..., description="The number of guests attending the wedding") | |
| budget: float = Field(..., description="The budget for the wedding in USD") | |
| llm = ChatGoogleGenerativeAI(model="gemini-2.5-flash") | |
| planner_llm = llm.with_structured_output(WeddingPlan) | |
| query = "Plan a beach wedding for 50 people with a $15,000 budget at Las Vegas on April 20,2026." | |
| result = planner_llm.invoke(query) | |
| print(f"Plan created: {result.location} | Budget: ${result.budget} | Guests: {result.number_of_guests} | Date: {result.date}") | |