tg-put-kg-core command (#369)

This commit is contained in:
cybermaggedon 2025-05-07 11:13:21 +01:00 committed by GitHub
parent 8080b54328
commit f7123ac57f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 298 additions and 22 deletions

View file

@ -36,9 +36,9 @@ class KnowledgeManager:
)
)
async def fetch_kg_core(self, request, respond):
async def get_kg_core(self, request, respond):
print("Fetch core...", flush=True)
print("Get core...", flush=True)
async def publish_triples(t):
await respond(
@ -76,7 +76,7 @@ class KnowledgeManager:
publish_ge,
)
print("Fetch complete", flush=True)
print("Get complete", flush=True)
await respond(
KnowledgeResponse(
@ -102,3 +102,23 @@ class KnowledgeManager:
)
)
async def put_kg_core(self, request, respond):
if request.triples:
await self.table_store.add_triples(request.triples)
if request.graph_embeddings:
await self.table_store.add_graph_embeddings(
request.graph_embeddings
)
await respond(
KnowledgeResponse(
error = None,
ids = None,
eos = False,
triples = None,
graph_embeddings = None
)
)