mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-15 05:46:52 +08:00
Feat/support parent child chunk (#12092)
This commit is contained in:
23
api/core/rag/embedding/retrieval.py
Normal file
23
api/core/rag/embedding/retrieval.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from models.dataset import DocumentSegment
|
||||
|
||||
|
||||
class RetrievalChildChunk(BaseModel):
|
||||
"""Retrieval segments."""
|
||||
|
||||
id: str
|
||||
content: str
|
||||
score: float
|
||||
position: int
|
||||
|
||||
|
||||
class RetrievalSegments(BaseModel):
|
||||
"""Retrieval segments."""
|
||||
|
||||
model_config = {"arbitrary_types_allowed": True}
|
||||
segment: DocumentSegment
|
||||
child_chunks: Optional[list[RetrievalChildChunk]] = None
|
||||
score: Optional[float] = None
|
||||
Reference in New Issue
Block a user