mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-22 11:41:02 +02:00
- Keeps processing in different flows separate so that data can go to different stores / collections etc. - Potentially supports different processing flows - Tidies the processing API with common base-classes for e.g. LLMs, and automatic configuration of 'clients' to use the right queue names in a flow
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
|
|
from . request_response_spec import RequestResponse, RequestResponseSpec
|
|
from .. schema import AgentRequest, AgentResponse
|
|
from .. knowledge import Uri, Literal
|
|
|
|
class AgentClient(RequestResponse):
|
|
async def request(self, recipient, question, plan=None, state=None,
|
|
history=[], timeout=300):
|
|
|
|
resp = await self.request(
|
|
AgentRequest(
|
|
question = question,
|
|
plan = plan,
|
|
state = state,
|
|
history = history,
|
|
),
|
|
recipient=recipient,
|
|
timeout=timeout,
|
|
)
|
|
|
|
print(resp, flush=True)
|
|
|
|
if resp.error:
|
|
raise RuntimeError(resp.error.message)
|
|
|
|
return resp
|
|
|
|
class GraphEmbeddingsClientSpec(RequestResponseSpec):
|
|
def __init__(
|
|
self, request_name, response_name,
|
|
):
|
|
super(GraphEmbeddingsClientSpec, self).__init__(
|
|
request_name = request_name,
|
|
request_schema = GraphEmbeddingsRequest,
|
|
response_name = response_name,
|
|
response_schema = GraphEmbeddingsResponse,
|
|
impl = GraphEmbeddingsClient,
|
|
)
|
|
|