File size: 591 Bytes
e048cbb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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)
|