File size: 1,459 Bytes
4a13628
c7fc3b6
 
 
674469e
 
 
4a13628
 
 
 
c7fc3b6
 
674469e
c7fc3b6
 
 
 
4a13628
c7fc3b6
674469e
4a13628
 
674469e
4a13628
 
674469e
4a13628
 
674469e
4a13628
 
674469e
 
 
4a13628
 
 
 
 
674469e
95cb26e
c7fc3b6
674469e
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
from pydantic import BaseModel, Field
from typing import Optional

class STTResponse(BaseModel):
    text: str = Field(..., description="Transcribed text")
    model_name: str = Field(default="whisper-base", description="Model used")
    language: Optional[str] = Field(default="en", description="Language detected")
    duration_seconds: Optional[float] = Field(None, description="Audio duration")
    
    class Config:
        json_schema_extra = {
            "example": {
                "text": "hello how are you",
                "model_name": "whisper-base",
                "language": "en",
                "duration_seconds": 3.2
            }
        }

class TTSRequest(BaseModel):
    text: str = Field(..., min_length=1, max_length=500, description="Text to convert")
    
    class Config:
        json_schema_extra = {"example": {"text": "Hello world"}}

class ChatbotRequest(BaseModel):
    text: str = Field(..., min_length=1, max_length=500, description="User input")
    
    class Config:
        json_schema_extra = {"example": {"text": "What is AI?"}}

class ChatbotResponse(BaseModel):
    user_input: str
    bot_response: str
    model_name: str = Field(default="DialoGPT-medium")
    
    class Config:
        json_schema_extra = {
            "example": {
                "user_input": "Hello",
                "bot_response": "Hi there! How can I help?",
                "model_name": "DialoGPT-medium"
            }
        }