from typing import List | |
from pydantic import BaseModel, Field | |
class SingleCommentModel(BaseModel): | |
comment_ref: int = Field(description="Move number in the game") | |
comment: str = Field(description="Rewritten comment text for the move") | |
class MultiCommentModel(BaseModel): | |
comments: List[SingleCommentModel] = Field( | |
description="List of rewritten comments for each move (with comment) in the game", | |
) | |
from pydantic import TypeAdapter | |
# Optional sanity check: show the schema | |
adapter = TypeAdapter(MultiCommentModel) | |
schema = adapter.json_schema() | |
print(schema) | |