from a1facts.enrichment import KnowledgeAcquirer
from a1facts.graph import KnowledgeGraph
from a1facts.ontology import KnowledgeOntology

ontology = KnowledgeOntology(ontology_file="ontology.yaml")
kg = KnowledgeGraph(ontology=ontology)
acquirer = KnowledgeAcquirer(
    graph=kg,
    ontology=ontology,
    knowledge_sources_config_file="sources.yaml",
    disable_exa=False
)
The KnowledgeAcquirer class uses an agent to interact with defined knowledge sources, acquire new information, and update the knowledge graph.

__init__(self, graph: KnowledgeGraph, ontology: KnowledgeOntology, knowledge_sources_config_file: str)

Initializes a new instance of the KnowledgeAcquirer class.
from a1facts.enrichment import KnowledgeAcquirer
from a1facts.graph import KnowledgeGraph
from a1facts.ontology import KnowledgeOntology

ontology = KnowledgeOntology(ontology_file="ontology.yaml")
kg = KnowledgeGraph(ontology=ontology)
acquirer = KnowledgeAcquirer(
    graph=kg,
    ontology=ontology,
    knowledge_sources_config_file="sources.yaml",
    disable_exa=False
)
Parameters:
  • graph (KnowledgeGraph): The knowledge graph to be updated.
  • ontology (KnowledgeOntology): The ontology that defines the structure of the knowledge graph.
  • knowledge_sources_config_file (str): The path to the YAML file that configures the knowledge sources.
  • disable_exa (bool): If True, the knowledge base will not use Exa search for knowledge acquisition. Defaults to False.

acquire(self, query: str)

Executes a query to acquire new knowledge from the configured sources.
result = acquirer.acquire("Find the latest financial report for Apple Inc.")
print(result)
Parameters:
  • query (str): The query to guide the knowledge acquisition process.
Returns:
  • The content of the agent’s response as a string.