Fix non streaming RAG problems (#607)

* Fix non-streaming failure in RAG services

* Fix non-streaming failure in API

* Fix agent non-streaming messaging

* Agent messaging unit & contract tests
This commit is contained in:
cybermaggedon 2026-01-12 18:45:52 +00:00 committed by GitHub
parent 30ca1d2e8b
commit 807f6cc4e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 677 additions and 21 deletions

View file

@ -232,12 +232,14 @@ class Processor(AgentService):
observation=None,
)
else:
# Legacy format
# Non-streaming format
r = AgentResponse(
answer=None,
error=None,
thought=x,
observation=None,
end_of_message=True,
end_of_dialog=False,
)
await respond(r)
@ -260,12 +262,14 @@ class Processor(AgentService):
observation=x,
)
else:
# Legacy format
# Non-streaming format
r = AgentResponse(
answer=None,
error=None,
thought=None,
observation=x,
end_of_message=True,
end_of_dialog=False,
)
await respond(r)
@ -288,12 +292,14 @@ class Processor(AgentService):
observation=None,
)
else:
# Legacy format - shouldn't be called in non-streaming mode
# Non-streaming format - shouldn't normally be called
r = AgentResponse(
answer=x,
error=None,
thought=None,
observation=None,
end_of_message=True,
end_of_dialog=False,
)
await respond(r)
@ -364,11 +370,14 @@ class Processor(AgentService):
thought=None,
)
else:
# Legacy format - send complete answer
# Non-streaming format - send complete answer
r = AgentResponse(
answer=act.final,
error=None,
thought=None,
observation=None,
end_of_message=True,
end_of_dialog=True,
)
await respond(r)

View file

@ -128,6 +128,7 @@ class Processor(FlowProcessor):
await flow("response").send(
DocumentRagResponse(
response = response,
end_of_stream = True,
error = None
),
properties = {"id": id}

View file

@ -171,6 +171,7 @@ class Processor(FlowProcessor):
await flow("response").send(
GraphRagResponse(
response = response,
end_of_stream = True,
error = None
),
properties = {"id": id}