KnowledgeBase class is the primary interface for working with a1facts. It encapsulates the ontology, the knowledge graph, and the knowledge acquirer, providing a unified access point to all the functionalities of the framework.
To get started, you need to create an instance of the KnowledgeBase class, which requires configuration files for the ontology and knowledge sources.
__init__
Initializes a new instance of the KnowledgeBase class.
Parameters
If
True, the knowledge base will use a Neo4j backend. Otherwise, it will use an in-memory graph.query
Executes a query against the knowledge graph to retrieve information.
Parameters
Returns
ingest_knowledge
Ingests and integrates a string of new knowledge into the knowledge graph.
Parameters
Returns
acquire_knowledge_for_query
Acquires new knowledge from configured sources based on a query and integrates it into the knowledge graph.
Parameters
Returns
get_tools
Returns a list of tools that can be used by an AI agent to interact with the knowledge base. These tools allow the agent to query for information and acquire new knowledge.
Returns
query_tool
The query_tool allows an agent to retrieve precise information from the knowledge graph by translating a natural language query into a graph traversal.
Parameters
Returns
The result of the query from the knowledge graph. The type of the result will depend on the query.
acquire_tool
The acquire_tool enables an agent to ingest new information into the knowledge graph from the configured knowledge sources. It takes a query, fetches relevant data, and updates the graph according to the ontology.
Parameters
Returns