2025-05-06 23:44:10 +01:00
|
|
|
|
|
|
|
|
from pulsar.schema import Record, Bytes, String, Array, Long, Boolean
|
|
|
|
|
from . types import Triple
|
|
|
|
|
from . topic import topic
|
|
|
|
|
from . types import Error
|
|
|
|
|
from . metadata import Metadata
|
|
|
|
|
from . documents import Document, TextDocument
|
|
|
|
|
from . graph import Triples, GraphEmbeddings
|
|
|
|
|
|
2025-05-07 11:13:21 +01:00
|
|
|
# get-kg-core
|
2025-05-06 23:44:10 +01:00
|
|
|
# -> (???)
|
|
|
|
|
# <- ()
|
|
|
|
|
# <- (error)
|
|
|
|
|
|
|
|
|
|
# delete-kg-core
|
|
|
|
|
# -> (???)
|
|
|
|
|
# <- ()
|
|
|
|
|
# <- (error)
|
|
|
|
|
|
|
|
|
|
# list-kg-cores
|
|
|
|
|
# -> (user)
|
|
|
|
|
# <- ()
|
|
|
|
|
# <- (error)
|
|
|
|
|
|
|
|
|
|
class KnowledgeRequest(Record):
|
|
|
|
|
|
2025-05-07 11:13:21 +01:00
|
|
|
# get-kg-core, delete-kg-core, list-kg-cores, put-kg-core
|
2025-05-06 23:44:10 +01:00
|
|
|
operation = String()
|
|
|
|
|
|
2025-05-07 11:13:21 +01:00
|
|
|
# list-kg-cores, delete-kg-core, put-kg-core
|
2025-05-06 23:44:10 +01:00
|
|
|
user = String()
|
|
|
|
|
|
2025-05-07 11:13:21 +01:00
|
|
|
# get-kg-core, list-kg-cores, delete-kg-core, put-kg-core
|
2025-05-06 23:44:10 +01:00
|
|
|
id = String()
|
|
|
|
|
|
2025-05-07 11:13:21 +01:00
|
|
|
# put-kg-core
|
|
|
|
|
triples = Triples()
|
|
|
|
|
graph_embeddings = GraphEmbeddings()
|
|
|
|
|
|
2025-05-06 23:44:10 +01:00
|
|
|
class KnowledgeResponse(Record):
|
|
|
|
|
error = Error()
|
|
|
|
|
ids = Array(String())
|
|
|
|
|
eos = Boolean() # Indicates end of knowledge core stream
|
|
|
|
|
triples = Triples()
|
|
|
|
|
graph_embeddings = GraphEmbeddings()
|
|
|
|
|
|
|
|
|
|
knowledge_request_queue = topic(
|
|
|
|
|
'knowledge', kind='non-persistent', namespace='request'
|
|
|
|
|
)
|
|
|
|
|
knowledge_response_queue = topic(
|
|
|
|
|
'knowledge', kind='non-persistent', namespace='response',
|
|
|
|
|
)
|
|
|
|
|
|