Files
life-echo/api/app/agents/memoir/schemas.py

54 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""LLM JSON 边界契约Memoir agents"""
from __future__ import annotations
from pydantic import AliasChoices, BaseModel, ConfigDict, Field
class ClassificationOutput(BaseModel):
category: str = ""
class MemoirTitleOutput(BaseModel):
title: str = ""
class FidelityOutput(BaseModel):
model_config = ConfigDict(populate_by_name=True)
pass_: bool = Field(default=True, alias="pass")
reason: str | None = None
class StateExtractionOutput(BaseModel):
detected_stage: str = ""
slots: dict[str, str] = Field(default_factory=dict)
emotion: str | None = None
is_new_chapter: bool | None = None
class BatchPhase1SegmentRowOut(BaseModel):
id: str
detected_stage: str = ""
slots: dict[str, str] = Field(default_factory=dict)
chapter_category: str = Field(
default="",
validation_alias=AliasChoices("chapter_category", "category"),
)
model_config = ConfigDict(extra="ignore", populate_by_name=True)
class BatchPhase1LLMOutput(BaseModel):
segments: list[BatchPhase1SegmentRowOut]
__all__ = [
"BatchPhase1LLMOutput",
"BatchPhase1SegmentRowOut",
"ClassificationOutput",
"FidelityOutput",
"MemoirTitleOutput",
"StateExtractionOutput",
]