KnowledgeOntology class loads the ontology from a YAML file and provides methods to access its components.
__init__(self, ontology_file: str)
Initializes a new instance of the KnowledgeOntology class.
ontology_file(str): The path to the YAML file defining the ontology.
find_entity_class(self, name: str)
Finds an entity class by name.
name(str): The name of the entity class to find.
- An
EntityClassobject orNoneif not found.
get_add_or_update_tools(self, add_entity_func, add_relationship_func)
Gets a combined list of all add/update tools for both entities and relationships. These tools are used by agents to modify the knowledge graph.
add_entity_func(function): The function to call to add/update an entity.add_relationship_func(function): The function to call to add/update a relationship.
- A list of all add/update tool functions.
get_get_tools(self, get_all_entity_func, get_entity_properties_func, get_relationship_properties_func, get_relationship_entities_func)
Gets a combined list of all “get” tools for both entities and relationships. These tools are used by agents to query the knowledge graph.
get_all_entity_func(function): Function to get all entities of a certain type.get_entity_properties_func(function): Function to get the properties of an entity.get_relationship_properties_func(function): Function to get the properties of a relationship.get_relationship_entities_func(function): Function to get the entities connected by a relationship.
- A list of all “get” tool functions.