mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-05-17 19:35:13 +02:00
Added missing file (#249)
This commit is contained in:
parent
6aa212061d
commit
ae00831e39
1 changed files with 30 additions and 0 deletions
30
trustgraph-flow/trustgraph/gateway/document_rag.py
Normal file
30
trustgraph-flow/trustgraph/gateway/document_rag.py
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
from .. schema import DocumentRagQuery, DocumentRagResponse
|
||||||
|
from .. schema import document_rag_request_queue
|
||||||
|
from .. schema import document_rag_response_queue
|
||||||
|
|
||||||
|
from . endpoint import ServiceEndpoint
|
||||||
|
from . requestor import ServiceRequestor
|
||||||
|
|
||||||
|
class DocumentRagRequestor(ServiceRequestor):
|
||||||
|
def __init__(self, pulsar_host, timeout, auth):
|
||||||
|
|
||||||
|
super(DocumentRagRequestor, self).__init__(
|
||||||
|
pulsar_host=pulsar_host,
|
||||||
|
request_queue=document_rag_request_queue,
|
||||||
|
response_queue=document_rag_response_queue,
|
||||||
|
request_schema=DocumentRagQuery,
|
||||||
|
response_schema=DocumentRagResponse,
|
||||||
|
timeout=timeout,
|
||||||
|
)
|
||||||
|
|
||||||
|
def to_request(self, body):
|
||||||
|
return DocumentRagQuery(
|
||||||
|
query=body["query"],
|
||||||
|
user=body.get("user", "trustgraph"),
|
||||||
|
collection=body.get("collection", "default"),
|
||||||
|
)
|
||||||
|
|
||||||
|
def from_response(self, message):
|
||||||
|
return { "response": message.response }, True
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue