38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
"""Pydantic models for LLM enrichment responses.
|
|
|
|
Defines the structured output format expected from the enrichment agent:
|
|
entities, action items, and the overall enrichment result.
|
|
"""
|
|
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class Entity(BaseModel):
|
|
"""A detected entity in the document text."""
|
|
|
|
type: Literal["person", "project", "date", "action_item"]
|
|
value: str
|
|
confidence: float = Field(ge=0.0, le=1.0)
|
|
position: int | None = None # character offset in source text
|
|
|
|
|
|
class ActionItem(BaseModel):
|
|
"""An extracted action item / task."""
|
|
|
|
description: str
|
|
assignee: str | None = None
|
|
deadline: str | None = None # ISO 8601 date string
|
|
|
|
|
|
class EnrichmentResult(BaseModel):
|
|
"""Complete enrichment output from the LLM."""
|
|
|
|
title: str
|
|
category: Literal["meeting", "project", "decision", "inbox"]
|
|
tags: list[str] = Field(default_factory=list)
|
|
entities: list[Entity] = Field(default_factory=list)
|
|
action_items: list[ActionItem] = Field(default_factory=list)
|
|
summary: str | None = None
|