-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyd.py
More file actions
41 lines (27 loc) · 2.32 KB
/
Copy pathpyd.py
File metadata and controls
41 lines (27 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from langchain_google_genai import ChatGoogleGenerativeAI
from pydantic import BaseModel, Field
from dotenv import load_dotenv
load_dotenv()
# Define your Pydantic model
class Review(BaseModel):
key_themes: list[str] = Field(description="Key themes discussed")
summary: str = Field(description="Brief summary")
sentiment: str = Field(description="positive or negative")
pros: list[str] = Field(default_factory=list)
cons: list[str] = Field(default_factory=list)
# Initialize Gemini
llm = ChatGoogleGenerativeAI(model="gemini-2.5-flash", temperature=0)
# Get structured output directly
structured_llm = llm.with_structured_output(Review)
# Use it
result = structured_llm.invoke("""
Vivo T2 Pro 5G is… fine. Not amazing, not trash. Its one of those phones that tries to look more premium than it actually is, and honestly, it kinda succeeds at that. The phone feels slim, light, and good in hand. If you give it to someone without telling the price, theyll probably think its more expensive than it is.
The display is one of its stronger points. AMOLED + 90Hz means scrolling feels smooth and the colors look nice. Watching Netflix, YouTube, reels—no complaints there. This is the kind of screen you notice every day, and Vivo did a good job here.
Performance-wise, its decent but dont hype it in your head. Daily stuff like WhatsApp, Instagram, Chrome, and even light gaming works smoothly. But if youre thinking of heavy gaming for long hours or max graphics, youll hit limits. Its not a power monster, its a “get the job done” phone.
Battery life is solid. One full day is easy unless youre glued to gaming or videos. Charging is okay—fast enough to not annoy you, but nothing crazy like those 80W phones.
Now the camera… this is where expectations need to be controlled. Daylight photos are good enough for social media, no drama. But low light? Yeah, it struggles. Photos get soft, details drop, and night shots wont impress anyone. If camera is your top priority, this phone isnt trying very hard there.
Software is typical Vivo. Some useful features, some unnecessary apps youll probably uninstall on day one. Updates are fine but dont expect Pixel-level care.
""")
print(f"Summary: {result.summary}")
print(f"Sentiment: {result.sentiment}")
print(f"Themes: {result.key_themes}")