18 lines
520 B
Python
18 lines
520 B
Python
import random
|
|
from typing import List, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
from ielts_be.configs.constants import ReadingExerciseType, EducationalContent
|
|
|
|
class ReadingExercise(BaseModel):
|
|
type: ReadingExerciseType
|
|
quantity: int
|
|
num_random_words: Optional[int] = Field(1)
|
|
max_words: Optional[int] = Field(3)
|
|
|
|
class ReadingDTO(BaseModel):
|
|
text: str = Field(...)
|
|
exercises: List[ReadingExercise] = Field(...)
|
|
difficulty: str = Field(random.choice(EducationalContent.DIFFICULTIES))
|