Spaces:
Paused
Paused
File size: 526 Bytes
869eb7d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import uuid
from datetime import datetime
from typing import Optional, Annotated
from pydantic import BaseModel, Field, BeforeValidator
class OneShotConversation(BaseModel):
q: str = Field()
a: str = Field()
sources: list[str] = Field()
class Conversation(BaseModel):
id: Optional[Annotated[str, BeforeValidator(str)]] = Field(alias="_id", default=None)
created: datetime = Field(default_factory=datetime.now)
conversation: list[OneShotConversation] = Field()
params: dict[str, str] = Field()
|