Feature/structured query tool integration (#493)

* Agent integration to structured query

* Update tests
This commit is contained in:
cybermaggedon 2025-09-04 16:23:43 +01:00 committed by GitHub
parent a6d9f5e849
commit ed0e02791d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 553 additions and 2 deletions

View file

@ -31,4 +31,5 @@ from . graph_rag_client import GraphRagClientSpec
from . tool_service import ToolService
from . tool_client import ToolClientSpec
from . agent_client import AgentClientSpec
from . structured_query_client import StructuredQueryClientSpec

View file

@ -0,0 +1,33 @@
from . request_response_spec import RequestResponse, RequestResponseSpec
from .. schema import StructuredQueryRequest, StructuredQueryResponse
class StructuredQueryClient(RequestResponse):
async def structured_query(self, question, timeout=600):
resp = await self.request(
StructuredQueryRequest(
question = question
),
timeout=timeout
)
if resp.error:
raise RuntimeError(resp.error.message)
# Return the full response structure for the tool to handle
return {
"data": resp.data,
"errors": resp.errors if resp.errors else [],
"error": resp.error
}
class StructuredQueryClientSpec(RequestResponseSpec):
def __init__(
self, request_name, response_name,
):
super(StructuredQueryClientSpec, self).__init__(
request_name = request_name,
request_schema = StructuredQueryRequest,
response_name = response_name,
response_schema = StructuredQueryResponse,
impl = StructuredQueryClient,
)