mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-24 04:31:02 +02:00
Plumbed into API gateway
This commit is contained in:
parent
5b84b87820
commit
c5e9a4132c
2 changed files with 32 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ from . triples_query import TriplesQueryRequestor
|
|||
from . objects_query import ObjectsQueryRequestor
|
||||
from . nlp_query import NLPQueryRequestor
|
||||
from . structured_query import StructuredQueryRequestor
|
||||
from . structured_diag import StructuredDiagRequestor
|
||||
from . embeddings import EmbeddingsRequestor
|
||||
from . graph_embeddings_query import GraphEmbeddingsQueryRequestor
|
||||
from . mcp_tool import McpToolRequestor
|
||||
|
|
@ -57,6 +58,7 @@ request_response_dispatchers = {
|
|||
"objects": ObjectsQueryRequestor,
|
||||
"nlp-query": NLPQueryRequestor,
|
||||
"structured-query": StructuredQueryRequestor,
|
||||
"structured-diag": StructuredDiagRequestor,
|
||||
}
|
||||
|
||||
global_dispatchers = {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
from ... schema import StructuredDataDiagnosisRequest, StructuredDataDiagnosisResponse
|
||||
from ... messaging import TranslatorRegistry
|
||||
|
||||
from . requestor import ServiceRequestor
|
||||
|
||||
class StructuredDiagRequestor(ServiceRequestor):
|
||||
def __init__(
|
||||
self, pulsar_client, request_queue, response_queue, timeout,
|
||||
consumer, subscriber,
|
||||
):
|
||||
|
||||
super(StructuredDiagRequestor, self).__init__(
|
||||
pulsar_client=pulsar_client,
|
||||
request_queue=request_queue,
|
||||
response_queue=response_queue,
|
||||
request_schema=StructuredDataDiagnosisRequest,
|
||||
response_schema=StructuredDataDiagnosisResponse,
|
||||
subscription = subscriber,
|
||||
consumer_name = consumer,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
self.request_translator = TranslatorRegistry.get_request_translator("structured-diag")
|
||||
self.response_translator = TranslatorRegistry.get_response_translator("structured-diag")
|
||||
|
||||
def to_request(self, body):
|
||||
return self.request_translator.to_pulsar(body)
|
||||
|
||||
def from_response(self, message):
|
||||
return self.response_translator.from_response_with_completion(message)
|
||||
Loading…
Add table
Add a link
Reference in a new issue