mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-04-22 13:49:45 +08:00
24 lines
485 B
Python
24 lines
485 B
Python
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
|