kg_chat.schema package
Submodules
kg_chat.schema.graph_schema module
A module for the schema of a knowledge graph.
- class kg_chat.schema.graph_schema.Edge(**data)
Bases:
BaseModel
A class to represent an edge in a knowledge graph.
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'object': FieldInfo(annotation=Node, required=True), 'predicate': FieldInfo(annotation=str, required=True), 'subject': FieldInfo(annotation=Node, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
-
predicate:
str
- class kg_chat.schema.graph_schema.GraphSchema(**data)
Bases:
BaseModel
A class to represent the schema of a knowledge graph.
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'edges': FieldInfo(annotation=List[kg_chat.schema.graph_schema.Edge], required=True), 'nodes': FieldInfo(annotation=List[kg_chat.schema.graph_schema.Node], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
- to_dict()
Return the schema as a dictionary.
- to_json()
Return the schema as a JSON string.
- class kg_chat.schema.graph_schema.Node(**data)
Bases:
BaseModel
A class to represent a node in a knowledge graph.
-
category:
str
-
id:
str
-
label:
str
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[Dict[str, FieldInfo]] = {'category': FieldInfo(annotation=str, required=True), 'id': FieldInfo(annotation=str, required=True), 'label': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.__fields__ from Pydantic V1.
-
category:
Module contents
Initiate the schema module.