KnowledgeGraph class is responsible for adding, updating, and querying entities and relationships in the graph database, based on a provided ontology.
__init__(self, ontology: KnowledgeOntology, use_neo4j: bool = False)
Initializes a new instance of the KnowledgeGraph class.
ontology(KnowledgeOntology): The ontology defining the graph’s structure.use_neo4j(bool, optional): Whether to use Neo4j as the backend. Defaults toFalse.
query(self, query: str)
Executes a natural language query against the knowledge graph.
query(str): The natural language query to execute.
- The content of the agent’s response as a string.
update_knowledge(self, knowledge: str)
Updates the knowledge graph with new, unstructured information.
knowledge(str): A string of unstructured knowledge to add to the graph.
- The content of the agent’s response as a string.