2025-03-14 18:53:14 -07:00
|
|
|
import uuid
|
2025-07-24 14:43:48 -07:00
|
|
|
from datetime import datetime
|
|
|
|
|
|
2025-10-07 01:11:00 +05:30
|
|
|
from pydantic import BaseModel, ConfigDict
|
2025-07-24 14:43:48 -07:00
|
|
|
|
2025-03-14 18:53:14 -07:00
|
|
|
from .base import IDModel, TimestampModel
|
|
|
|
|
|
2025-07-24 14:43:48 -07:00
|
|
|
|
2025-03-14 18:53:14 -07:00
|
|
|
class SearchSpaceBase(BaseModel):
|
|
|
|
|
name: str
|
2025-07-24 14:43:48 -07:00
|
|
|
description: str | None = None
|
|
|
|
|
|
2025-03-14 18:53:14 -07:00
|
|
|
|
|
|
|
|
class SearchSpaceCreate(SearchSpaceBase):
|
2025-11-19 15:04:46 -08:00
|
|
|
# Optional on create, will use defaults if not provided
|
|
|
|
|
citations_enabled: bool = True
|
|
|
|
|
qna_custom_instructions: str | None = None
|
2025-03-14 18:53:14 -07:00
|
|
|
|
2025-07-24 14:43:48 -07:00
|
|
|
|
2025-11-19 15:04:46 -08:00
|
|
|
class SearchSpaceUpdate(BaseModel):
|
|
|
|
|
# All fields optional on update - only send what you want to change
|
|
|
|
|
name: str | None = None
|
|
|
|
|
description: str | None = None
|
|
|
|
|
citations_enabled: bool | None = None
|
|
|
|
|
qna_custom_instructions: str | None = None
|
2025-03-14 18:53:14 -07:00
|
|
|
|
2025-07-24 14:43:48 -07:00
|
|
|
|
2025-03-14 18:53:14 -07:00
|
|
|
class SearchSpaceRead(SearchSpaceBase, IDModel, TimestampModel):
|
|
|
|
|
id: int
|
|
|
|
|
created_at: datetime
|
|
|
|
|
user_id: uuid.UUID
|
2025-11-19 15:04:46 -08:00
|
|
|
# QnA configuration
|
|
|
|
|
citations_enabled: bool
|
|
|
|
|
qna_custom_instructions: str | None = None
|
2025-03-14 18:53:14 -07:00
|
|
|
|
2025-10-10 00:50:29 -07:00
|
|
|
model_config = ConfigDict(from_attributes=True)
|
2025-11-27 22:45:04 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class SearchSpaceWithStats(SearchSpaceRead):
|
|
|
|
|
"""Extended search space info with member count and ownership status."""
|
|
|
|
|
|
|
|
|
|
member_count: int = 1
|
|
|
|
|
is_owner: bool = False
|