Spaces:
Runtime error
Runtime error
File size: 1,117 Bytes
a22e84b |
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 |
from pydantic import UUID4, Field
from llm_engineering.domain.base import VectorBaseDocument
from llm_engineering.domain.types import DataCategory
from typing import Optional, Tuple
class Query(VectorBaseDocument):
content: str
author_id: UUID4 | None = None
author_full_name: str | None = None
metadata: dict = Field(default_factory=dict)
# Video-specific fields
time_constraints: Optional[Tuple[float, float]] = None
visual_context: Optional[str] = None # Path to reference image
class Config:
category = DataCategory.QUERIES
@classmethod
def from_str(cls, query: str) -> "Query":
# return Query(content=query.strip("\n "))
return Query(content=query)
def replace_content(self, new_content: str) -> "Query":
return Query(
id=self.id,
content=new_content,
author_id=self.author_id,
author_full_name=self.author_full_name,
metadata=self.metadata,
)
class EmbeddedQuery(Query):
embedding: list[float]
class Config:
category = DataCategory.QUERIES
|