File size: 1,632 Bytes
625daea
 
306b243
 
625daea
 
306b243
 
 
 
 
 
 
 
 
 
 
 
 
 
 
625daea
 
306b243
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
625daea
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""Pydantic models for text generation"""

from pydantic import BaseModel, ConfigDict, Field
from typing import Optional, List

class GenerateRequest(BaseModel):
    """Request model for argument generation"""
    model_config = ConfigDict(
        json_schema_extra={
            "example": {
                "topic": "Assisted suicide should be a criminal offence",
                "position": "positive"  # "positive" or "negative"
            }
        }
    )
    
    topic: str = Field(..., min_length=5, max_length=1000, 
                       description="The debate topic or statement")
    position: str = Field(..., min_length=5, max_length=50,
                         description="The stance to take")


class GenerateResponse(BaseModel):
    """Response model for argument generation"""
    model_config = ConfigDict(
        json_schema_extra={
            "example": {
                "topic": "Assisted suicide should be a criminal offence",
                "position": "positive",  # "positive" or "negative"
                "argument": "People have the right to choose how they end their lives",
                "timestamp": "2024-11-15T10:30:00"
            }
        }
    )
    
    topic: str  
    position: str
    argument: str
    timestamp: str
    timestamp: str


class BatchGenerateRequest(BaseModel):
    """Request model for batch argument generation"""
    items: List[GenerateRequest]


class BatchGenerateResponse(BaseModel):
    """Response model for batch argument generation"""
    results: List[GenerateResponse]
    model_info: Optional[str] = "KPA T5 Generation Model"
    timestamp: str