Adds types property to pydantic Datapoint inherited classes (#523)

<!-- .github/pull_request_template.md -->

## Description
This PR adds types to DataPoint pydantic class + fixes visualization
colors

## DCO Affirmation
I affirm that all code in every commit of this pull request conforms to
the terms of the Topoteretes Developer Certificate of Origin


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added a `type` field to the `DataPoint` model for clearer data
classification.
- Enhanced color mapping in visualizations by assigning a distinct color
to "TextSummary" nodes.

- **Refactor**
- Improved default settings for version control and ordering to ensure
consistent data behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
hajdul88 2025-02-11 19:23:19 +01:00 committed by GitHub
parent ebd1d2adbf
commit 1b630366c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View file

@ -25,6 +25,11 @@ class DataPoint(BaseModel):
version: int = 1 # Default version
topological_rank: Optional[int] = 0
metadata: Optional[MetaData] = {"index_fields": []}
type: str = Field(default_factory=lambda: DataPoint.__name__)
def __init__(self, **data):
super().__init__(**data)
object.__setattr__(self, "type", self.__class__.__name__)
@classmethod
def get_embeddable_data(self, data_point: "DataPoint"):

View file

@ -19,6 +19,7 @@ async def cognee_network_visualization(graph_data, destination_file_path: str =
"Entity": "#f47710",
"EntityType": "#6510f4",
"DocumentChunk": "#801212",
"TextSummary": "#1077f4",
"default": "#D3D3D3",
}