35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
"""
|
||
Pydantic models for structured output extraction.
|
||
|
||
Two schemas:
|
||
1. PersonInfo – name, optional age, profession, skills list.
|
||
2. MeetingNotes – date, participants, topics, decisions, next_steps.
|
||
|
||
All fields have Field(description=...).
|
||
"""
|
||
from __future__ import annotations
|
||
|
||
from datetime import date
|
||
from typing import List, Optional
|
||
|
||
from pydantic import BaseModel, Field
|
||
|
||
class PersonInfo(BaseModel):
|
||
"""Information about a person extracted from free text."""
|
||
|
||
name: str = Field(..., description="Full name of the person")
|
||
age: Optional[int] = Field(None, description="Age in years; optional if not mentioned")
|
||
profession: str = Field(..., description="Primary occupation or role")
|
||
skills: List[str] = Field(..., description="List of technical or soft skills")
|
||
|
||
class MeetingNotes(BaseModel):
|
||
"""Structured notes from a meeting extracted from free text."""
|
||
|
||
date: date = Field(..., description="Date of the meeting in ISO format (YYYY-MM-DD)")
|
||
participants: List[str] = Field(..., description="Names of attendees")
|
||
topics: List[str] = Field(..., description="Discussion topics covered during the meeting")
|
||
decisions: List[str] = Field(..., description="Decisions made during the meeting")
|
||
next_steps: List[str] = Field(..., description="Action items to be performed after the meeting")
|
||
|
||
# End of models.py
|