<!-- .github/pull_request_template.md --> ## Description <!-- Provide a clear description of the changes in this PR --> ## 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** • Graph visualizations now allow exporting to a user-specified file path for more flexible output management. • The text embedding process has been enhanced with an additional tokenizer option for improved performance. • A new `ExtendableDataPoint` class has been introduced for future extensions. • New JSON files for companies and individuals have been added to facilitate testing and data processing. - **Improvements** • Search functionality now uses updated identifiers for more reliable content retrieval. • Metadata handling has been streamlined across various classes by removing unnecessary type specifications. • Enhanced serialization of properties in the Neo4j adapter for improved handling of complex structures. • The setup process for databases has been improved with a new asynchronous setup function. - **Chores** • Dependency and configuration updates improve overall stability and performance. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
98 lines
2 KiB
Python
98 lines
2 KiB
Python
from typing import Any, List, Literal, Optional, Union
|
|
|
|
from cognee.infrastructure.engine import DataPoint
|
|
|
|
|
|
class Variable(DataPoint):
|
|
id: str
|
|
name: str
|
|
description: str
|
|
is_static: Optional[bool] = False
|
|
default_value: Optional[str] = None
|
|
data_type: str
|
|
|
|
metadata: dict = {"index_fields": ["name"]}
|
|
|
|
|
|
class Operator(DataPoint):
|
|
id: str
|
|
name: str
|
|
description: str
|
|
return_type: str
|
|
metadata: dict = {"index_fields": ["name"]}
|
|
|
|
|
|
class Class(DataPoint):
|
|
id: str
|
|
name: str
|
|
description: str
|
|
constructor_parameters: List[Variable]
|
|
extended_from_class: Optional["Class"] = None
|
|
has_methods: List["Function"]
|
|
|
|
metadata: dict = {"index_fields": ["name"]}
|
|
|
|
|
|
class ClassInstance(DataPoint):
|
|
id: str
|
|
name: str
|
|
description: str
|
|
from_class: Class
|
|
instantiated_by: Union["Function"]
|
|
instantiation_arguments: List[Variable]
|
|
|
|
metadata: dict = {"index_fields": ["name"]}
|
|
|
|
|
|
class Function(DataPoint):
|
|
id: str
|
|
name: str
|
|
description: str
|
|
parameters: List[Variable]
|
|
return_type: str
|
|
is_static: Optional[bool] = False
|
|
|
|
metadata: dict = {"index_fields": ["name"]}
|
|
|
|
|
|
class FunctionCall(DataPoint):
|
|
id: str
|
|
called_by: Union[Function, Literal["main"]]
|
|
function_called: Function
|
|
function_arguments: List[Any]
|
|
metadata: dict = {"index_fields": []}
|
|
|
|
|
|
class Expression(DataPoint):
|
|
id: str
|
|
name: str
|
|
description: str
|
|
expression: str
|
|
members: List[Union[Variable, Function, Operator, "Expression"]]
|
|
metadata: dict = {"index_fields": ["name"]}
|
|
|
|
|
|
class SourceCodeGraph(DataPoint):
|
|
id: str
|
|
name: str
|
|
description: str
|
|
language: str
|
|
nodes: List[
|
|
Union[
|
|
Class,
|
|
ClassInstance,
|
|
Function,
|
|
FunctionCall,
|
|
Variable,
|
|
Operator,
|
|
Expression,
|
|
]
|
|
]
|
|
metadata: dict = {"index_fields": ["name"]}
|
|
|
|
|
|
Class.model_rebuild()
|
|
ClassInstance.model_rebuild()
|
|
Expression.model_rebuild()
|
|
FunctionCall.model_rebuild()
|
|
SourceCodeGraph.model_rebuild()
|