-
Notifications
You must be signed in to change notification settings - Fork 966
Add type to DataPoint metadata #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
47f5da4
Add type to DataPoint metadata
alekszievr 6a99fc3
Add missing index_fields
alekszievr c097aee
Use DataPoint UUID type in pgvector create_data_points
alekszievr 23fc77a
Merge branch 'dev' into feat/COG-651-add-type-to-datapoint-metadata
alekszievr e1026ab
Merge branch 'dev' into feat/COG-651-add-type-to-datapoint-metadata
alekszievr c76af39
Merge branch 'dev' into feat/COG-651-add-type-to-datapoint-metadata
alekszievr 4665ab9
Make _metadata mandatory everywhere
alekszievr 0d9d7cc
Merge branch 'dev' into feat/COG-651-add-type-to-datapoint-metadata
alekszievr 313ca9b
Merge branch 'dev' into feat/COG-651-add-type-to-datapoint-metadata
alekszievr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
15 changes: 10 additions & 5 deletions
15
cognee/infrastructure/databases/hybrid/falkordb/FalkorDBAdapter.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 9 additions & 5 deletions
14
cognee/infrastructure/databases/vector/lancedb/LanceDBAdapter.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 8 additions & 4 deletions
12
cognee/infrastructure/databases/vector/qdrant/QDrantAdapter.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,17 @@ | ||
| from cognee.infrastructure.engine import DataPoint | ||
| from uuid import UUID | ||
|
|
||
| from cognee.infrastructure.engine import DataPoint | ||
|
|
||
|
|
||
| class Document(DataPoint): | ||
| type: str | ||
| name: str | ||
| raw_data_location: str | ||
| metadata_id: UUID | ||
| mime_type: str | ||
| _metadata: dict = { | ||
| "index_fields": ["name"], | ||
| "type": "Document" | ||
| } | ||
|
|
||
| def read(self, chunk_size: int) -> str: | ||
| pass | ||
| pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,4 +10,5 @@ class Entity(DataPoint): | |
|
|
||
| _metadata: dict = { | ||
| "index_fields": ["name"], | ||
| "type": "Entity" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,12 @@ | ||
| from cognee.infrastructure.engine import DataPoint | ||
|
|
||
|
|
||
| class EntityType(DataPoint): | ||
| __tablename__ = "entity_type" | ||
| name: str | ||
| type: str | ||
| description: str | ||
|
|
||
| _metadata: dict = { | ||
| "index_fields": ["name"], | ||
| "type": "EntityType" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,14 @@ | ||
| from typing import Optional | ||
|
|
||
| from cognee.infrastructure.engine import DataPoint | ||
|
|
||
|
|
||
| class EdgeType(DataPoint): | ||
| __tablename__ = "edge_type" | ||
| relationship_name: str | ||
| number_of_edges: int | ||
|
|
||
| _metadata: Optional[dict] = { | ||
| "index_fields": ["relationship_name"], | ||
| "type": "EdgeType" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,47 @@ | ||
| from typing import List, Optional | ||
|
|
||
| from cognee.infrastructure.engine import DataPoint | ||
|
|
||
|
|
||
| class Repository(DataPoint): | ||
| __tablename__ = "Repository" | ||
| path: str | ||
| type: Optional[str] = "Repository" | ||
| _metadata: dict = { | ||
| "index_fields": ["source_code"], | ||
| "type": "Repository" | ||
| } | ||
|
|
||
| class CodeFile(DataPoint): | ||
| __tablename__ = "codefile" | ||
| extracted_id: str # actually file path | ||
| type: Optional[str] = "CodeFile" | ||
| source_code: Optional[str] = None | ||
| part_of: Optional[Repository] = None | ||
| depends_on: Optional[List["CodeFile"]] = None | ||
| depends_directly_on: Optional[List["CodeFile"]] = None | ||
| contains: Optional[List["CodePart"]] = None | ||
|
|
||
| _metadata: dict = { | ||
| "index_fields": ["source_code"] | ||
| "index_fields": ["source_code"], | ||
| "type": "CodeFile" | ||
| } | ||
|
|
||
| class CodePart(DataPoint): | ||
| __tablename__ = "codepart" | ||
| # part_of: Optional[CodeFile] | ||
| source_code: str | ||
| type: Optional[str] = "CodePart" | ||
|
|
||
|
|
||
| _metadata: dict = { | ||
| "index_fields": ["source_code"] | ||
| "index_fields": ["source_code"], | ||
| "type": "CodePart" | ||
| } | ||
|
|
||
| class CodeRelationship(DataPoint): | ||
| source_id: str | ||
| target_id: str | ||
| type: str # between files | ||
| relation: str # depends on or depends directly | ||
| _metadata: dict = { | ||
| "type": "CodeRelationship" | ||
| } | ||
|
|
||
| CodeFile.model_rebuild() | ||
| CodePart.model_rebuild() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.