from typing import Optional
from agno.agent import Agent
from agno.models.google import Gemini
from pydantic import BaseModel, Field
class Contact(BaseModel):
name: Optional[str] = Field(None, description="Full name as written")
email: Optional[str] = Field(None, description="Email address")
phone: Optional[str] = Field(None, description="Phone number, raw format")
company: Optional[str] = Field(None, description="Company or organization")
title: Optional[str] = Field(None, description="Job title")
agent = Agent(
model=Gemini(id="gemini-3.5-flash"),
instructions=(
"Extract contact information from the input. Use exactly what the "
"text shows. If a field is missing, leave it null. Do not guess."
),
output_schema=Contact,
)
result = agent.run(
"Hi - Sarah Johnson, VP of Marketing at Acme Corp. "
"sarah@acme.com / +1-555-0102."
).content
# Contact(name='Sarah Johnson', email='sarah@acme.com',
# phone='+1-555-0102', company='Acme Corp.', title='VP of Marketing')