47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
"""
|
||
Pydantic models for structured output extraction.
|
||
|
||
Two schemas are defined:
|
||
1. PersonInfo – information about a person.
|
||
2. MeetingNotes – notes from a meeting.
|
||
|
||
Both models use `Field(description=...)` to provide clear field descriptions that LangChain can expose in the prompt.
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
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 the person possesses",
|
||
)
|
||
|
||
class MeetingNotes(BaseModel):
|
||
"""Structured notes from a meeting extracted from free text."""
|
||
|
||
date: str = Field(..., description="Date of the meeting in ISO format (YYYY-MM-DD)")
|
||
participants: List[str] = Field(
|
||
..., description="Names of people who attended the meeting"
|
||
)
|
||
topics: List[str] = Field(
|
||
...,
|
||
description="Main discussion topics covered during the meeting"
|
||
)
|
||
decisions: List[str] = Field(
|
||
..., description="Decisions made during the meeting"
|
||
)
|
||
next_steps: List[str] = Field(
|
||
..., description="Action items or follow‑up tasks after the meeting"
|
||
)
|
||
|
||
__all__ = ["PersonInfo", "MeetingNotes"]
|