add models.py
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
"""
|
"""
|
||||||
Pydantic models for structured output extraction.
|
Pydantic models for structured output extraction.
|
||||||
|
|
||||||
Two schemas:
|
Two schemas are defined:
|
||||||
1. PersonInfo – name, optional age, profession, skills list.
|
1. PersonInfo – information about a person.
|
||||||
2. MeetingNotes – date, participants, topics, decisions, next_steps.
|
2. MeetingNotes – notes from a meeting.
|
||||||
|
|
||||||
All fields have Field(description=...).
|
Both models use `Field(description=...)` to provide clear field descriptions that LangChain can expose in the prompt.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import date
|
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
@@ -20,15 +20,27 @@ class PersonInfo(BaseModel):
|
|||||||
name: str = Field(..., description="Full name of the person")
|
name: str = Field(..., description="Full name of the person")
|
||||||
age: Optional[int] = Field(None, description="Age in years; optional if not mentioned")
|
age: Optional[int] = Field(None, description="Age in years; optional if not mentioned")
|
||||||
profession: str = Field(..., description="Primary occupation or role")
|
profession: str = Field(..., description="Primary occupation or role")
|
||||||
skills: List[str] = Field(..., description="List of technical or soft skills")
|
skills: List[str] = Field(
|
||||||
|
...,
|
||||||
|
description="List of technical or soft skills the person possesses",
|
||||||
|
)
|
||||||
|
|
||||||
class MeetingNotes(BaseModel):
|
class MeetingNotes(BaseModel):
|
||||||
"""Structured notes from a meeting extracted from free text."""
|
"""Structured notes from a meeting extracted from free text."""
|
||||||
|
|
||||||
date: date = Field(..., description="Date of the meeting in ISO format (YYYY-MM-DD)")
|
date: str = Field(..., description="Date of the meeting in ISO format (YYYY-MM-DD)")
|
||||||
participants: List[str] = Field(..., description="Names of attendees")
|
participants: List[str] = Field(
|
||||||
topics: List[str] = Field(..., description="Discussion topics covered during the meeting")
|
..., description="Names of people who attended 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")
|
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"
|
||||||
|
)
|
||||||
|
|
||||||
# End of models.py
|
__all__ = ["PersonInfo", "MeetingNotes"]
|
||||||
|
|||||||
Reference in New Issue
Block a user