File size: 896 Bytes
e8eed08
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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}")