Spaces:
Build error
Build error
File size: 922 Bytes
d660b02 |
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 |
from pydantic import UUID4, Field
from llm_engineering.domain.base import VectorBaseDocument
from llm_engineering.domain.types import DataCategory
class Query(VectorBaseDocument):
content: str
author_id: UUID4 | None = None
author_full_name: str | None = None
metadata: dict = Field(default_factory=dict)
class Config:
category = DataCategory.QUERIES
@classmethod
def from_str(cls, query: str) -> "Query":
return Query(content=query.strip("\n "))
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
|