c889a57b6b
Test Suites / Build CI Environment (push) Has been cancelled
Test Suites / Basic Tests (push) Has been cancelled
Test Suites / End-to-End Tests (push) Has been cancelled
Test Suites / CLI Tests (push) Has been cancelled
Test Suites / Slow End-to-End Tests (push) Has been cancelled
Test Suites / Graph Database Tests (push) Has been cancelled
Test Suites / Vector DB Tests (push) Has been cancelled
Test Suites / Temporal Graph Test (push) Has been cancelled
Test Suites / Search Test on Different DBs (push) Has been cancelled
Test Suites / Example Tests (push) Has been cancelled
Test Suites / Notebook Tests (push) Has been cancelled
Test Suites / OS and Python Tests Ubuntu (push) Has been cancelled
Test Suites / OS and Python Tests Extended (push) Has been cancelled
Test Suites / LLM Test Suite (push) Has been cancelled
Test Suites / S3 File Storage Test (push) Has been cancelled
Test Suites / Run Integration Tests (push) Has been cancelled
Test Suites / MCP Tests (push) Has been cancelled
Test Suites / Docker Compose Test (push) Has been cancelled
Test Suites / Docker CI test (push) Has been cancelled
Test Suites / Relational DB Migration Tests (push) Has been cancelled
Test Suites / Distributed Cognee Test (push) Has been cancelled
Test Suites / DB Examples Tests (push) Has been cancelled
Test Suites / Test Completion Status (push) Has been cancelled
Test Suites / Claude Code Review (push) Has been cancelled
Test Suites / basic checks (push) Has been cancelled
build | Build and Push Cognee MCP Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
build | Build and Push Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.11) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.12) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (kuzu, kuzu) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (neo4j, neo4j) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Examples (push) Has been cancelled
Weighted Edges Tests / Code Quality for Weighted Edges (push) Has been cancelled
46 lines
1.7 KiB
Python
46 lines
1.7 KiB
Python
from typing import List, Union, Optional
|
|
|
|
from cognee.infrastructure.engine import DataPoint
|
|
from cognee.infrastructure.engine.models.Edge import Edge
|
|
from cognee.modules.data.processing.document_types import Document
|
|
from cognee.modules.engine.models import Entity
|
|
from cognee.tasks.temporal_graph.models import Event
|
|
|
|
|
|
class DocumentChunk(DataPoint):
|
|
"""
|
|
Represents a chunk of text from a document with associated metadata.
|
|
|
|
Public methods include:
|
|
|
|
- No public methods defined in the provided code.
|
|
|
|
Instance variables include:
|
|
|
|
- text: The textual content of the chunk.
|
|
- chunk_size: The size of the chunk.
|
|
- chunk_index: The index of the chunk in the original document.
|
|
- cut_type: The type of cut that defined this chunk.
|
|
- is_part_of: The document to which this chunk belongs.
|
|
- contains: A list of entities or events contained within the chunk (default is None).
|
|
- document_id: Flat string id of the source document, for reference rendering.
|
|
- document_name: Display name (basename) of the source document, for reference rendering.
|
|
- metadata: A dictionary to hold meta information related to the chunk, including index
|
|
fields.
|
|
"""
|
|
|
|
text: str
|
|
chunk_size: int
|
|
chunk_index: int
|
|
cut_type: str
|
|
is_part_of: Document
|
|
contains: List[Union[Entity, Event, tuple[Edge, Entity]]] = None
|
|
importance_weight: Optional[float] = 0.5
|
|
document_id: Optional[str] = None
|
|
document_name: Optional[str] = None
|
|
# Optional truth-alignment fields; never embedded (kept out of index_fields)
|
|
# and not part of id/dedup.
|
|
truth_alignment: Optional[list[float]] = None
|
|
truth_epoch: Optional[int] = None
|
|
metadata: dict = {"index_fields": ["text"]}
|