Ask for Citations

Add fields into the schema which asks for citation numbers for all the sentences which are relevant to the information which was extracted

For example consider these classes

class CitableInt(BaseModel):
    value: int = Field(..., ge=0, description="Non-negative integer value")
    citations: Optional[List[int]] = Field(default_factory=list, description="Citations for the value")


class CitableFloat(BaseModel):
    value: float = Field(..., ge=0, description="Floating point value which allows decimals")
    citations: Optional[List[int]] = Field(default_factory=list, description="Citations for the value")


class CitableBool(BaseModel):
    value: bool = Field(..., description="Boolean value")
    citations: Optional[List[int]] = Field(default_factory=list, description="Citations for the value")

And this is how it can be used

class InterventionRecord(BaseModel):
    interventions: CitableList[InterventionType] = Field(
        default_factory=lambda: CitableList[InterventionType](value=[], citations=[]),
        description="List of interventions with citations")
    is_intervention_ongoing: CitableBool = Field(description="Whether any interventions are ongoing, with citations")
    has_recovery: CitableBool = Field(description="Whether recovery occurred, with citations")

    class Config:
        use_enum_values = True

By asking for citation numbers you can see which sentence from the input text has the information, and this is especially useful for long inputs like VAERS reports.