Can Pydantic describe output fields for LLM?

See, the field channel has a description. It is for AI.

class FillContentPlanGapsOutput(BaseModel):
    date: str
    time: str
    channel: str = Field(..., description="Channel ID. Lowercase name, e.g. twitter, youtube, etc.")
    typeOfContent: str

But in the logs, I see only the fields:

Ensure your final answer contains only the content in the following format: {
"date": str,
"time": str,
"channel": str,
"typeOfContent": str
}

Can we somehow propagate Pydantic metadata to the prompt, or where should I add the format explanation for LLM?

While browsing another question, I bumped into a topic with the same problem: Use more info from pydantic models - #10 by Dabnis

A short extract from there. This “sunrise manually” type of solution works but looks dirty. I’d appreciate an idiomatic way to implement this.

@task
def fill_content_plan_gaps(self) -> Task:
    field_info = "\nOutput fields:\n"
    for field_name, field_instance in FillContentPlanGapsOutput.model_fields.items():
        field_info += "- " + field_name + ((": " + field_instance.description) if field_instance.description is not None else "") + "\n"

    return Task(
        config=self.tasks_config['fill_content_plan_gaps'],
        expected_output=self.tasks_config['fill_content_plan_gaps']['expected_output'] + field_info,
        output_pydantic=FillContentPlanGapsOutput,
    )

From logs:

This is the expect criteria for your final answer: List of content requests with channel, content type, and time slot.

Output fields:
- date
- time
- channel: Channel ID. Lowercase name, e.g. twitter, youtube, etc.
- typeOfContent

you MUST return the actual complete content as the final answer, not a summary.
Ensure your final answer contains only the content in the following format: {
  "date": str,
  "time": str,
  "channel": str,
  "typeOfContent": str
}