Skip to content

Schemas for Structured Data

This module defines Pydantic models used for structuring and validating intermediate and final outputs from LLMs.

cogitator.schemas.LTMDecomposition

Bases: BaseModel

Schema for the output of the Least-to-Most decomposition step.

Source code in cogitator/schemas.py
class LTMDecomposition(BaseModel):
    """Schema for the output of the Least-to-Most decomposition step."""

    subquestions: List[str] = Field(..., description="List of sequential subquestions")

cogitator.schemas.ThoughtExpansion

Bases: BaseModel

Schema for the output of a thought expansion step (e.g., in ToT).

Source code in cogitator/schemas.py
class ThoughtExpansion(BaseModel):
    """Schema for the output of a thought expansion step (e.g., in ToT)."""

    thoughts: List[str] = Field(..., description="List of distinct reasoning steps or thoughts")

cogitator.schemas.EvaluationResult

Bases: BaseModel

Schema for the output of an evaluation step (e.g., in ToT, GoT).

Source code in cogitator/schemas.py
class EvaluationResult(BaseModel):
    """Schema for the output of an evaluation step (e.g., in ToT, GoT)."""

    score: int = Field(..., description="Quality score from 1 to 10")
    justification: str = Field(..., description="Brief justification for the score")

cogitator.schemas.ExtractedAnswer

Bases: BaseModel

Schema for the final extracted answer from a reasoning chain.

Source code in cogitator/schemas.py
class ExtractedAnswer(BaseModel):
    """Schema for the final extracted answer from a reasoning chain."""

    final_answer: Optional[Union[str, int, float]] = Field(
        ..., description="The final extracted answer"
    )