fix(models): add text field to ChunkMetadata for Qdrant storage
Why: - Qdrant was storing only metadata, not chunk text - Queries returned empty text in retrieved chunks - Scores were low (~0.25) because embeddings were on empty strings Changes: - Added 'text' field to ChunkMetadata model - Updated chunk_to_metadata() to copy text
This commit is contained in:
@@ -21,7 +21,6 @@ class Chunk(BaseModel):
|
||||
Strategy-specific fields (parent_id, enriched_content) are nullable
|
||||
when not applicable to the strategy that produced the chunk.
|
||||
"""
|
||||
|
||||
document_name: str
|
||||
chunk_id: str
|
||||
strategy_name: StrategyName
|
||||
@@ -35,11 +34,11 @@ class Chunk(BaseModel):
|
||||
|
||||
class ChunkMetadata(BaseModel):
|
||||
"""Payload stored alongside every chunk vector in Qdrant."""
|
||||
|
||||
document_name: str
|
||||
chunk_id: str
|
||||
strategy_name: StrategyName
|
||||
chunk_index: int
|
||||
text: str
|
||||
token_count: int
|
||||
character_count: int
|
||||
parent_id: Optional[str] = None
|
||||
@@ -52,6 +51,7 @@ def chunk_to_metadata(chunk: Chunk) -> ChunkMetadata:
|
||||
chunk_id=chunk.chunk_id,
|
||||
strategy_name=chunk.strategy_name,
|
||||
chunk_index=chunk.chunk_index,
|
||||
text=chunk.text,
|
||||
token_count=chunk.token_count,
|
||||
character_count=chunk.character_count,
|
||||
parent_id=chunk.parent_id,
|
||||
@@ -92,4 +92,4 @@ class PaginatedResponse(BaseModel):
|
||||
items: list = Field(default_factory=list)
|
||||
total: int = 0
|
||||
offset: int = 0
|
||||
limit: int = 50
|
||||
limit: int = 50
|
||||
|
||||
Reference in New Issue
Block a user