mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 00:16:23 +02:00
Fix agent streaming tool failure (#602)
* Fix agent streaming linkage * Update tests
This commit is contained in:
parent
53cf5fd7f9
commit
16a5cf966a
2 changed files with 9 additions and 6 deletions
|
|
@ -47,8 +47,9 @@ Args: {
|
||||||
"}"
|
"}"
|
||||||
]
|
]
|
||||||
|
|
||||||
for chunk in chunks:
|
for i, chunk in enumerate(chunks):
|
||||||
await chunk_callback(chunk)
|
is_final = (i == len(chunks) - 1)
|
||||||
|
await chunk_callback(chunk, is_final)
|
||||||
|
|
||||||
return full_text
|
return full_text
|
||||||
else:
|
else:
|
||||||
|
|
@ -312,8 +313,10 @@ Final Answer: AI is the simulation of human intelligence in machines."""
|
||||||
call_count += 1
|
call_count += 1
|
||||||
|
|
||||||
if streaming and chunk_callback:
|
if streaming and chunk_callback:
|
||||||
for chunk in response.split():
|
chunks = response.split()
|
||||||
await chunk_callback(chunk + " ")
|
for i, chunk in enumerate(chunks):
|
||||||
|
is_final = (i == len(chunks) - 1)
|
||||||
|
await chunk_callback(chunk + " ", is_final)
|
||||||
return response
|
return response
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -241,8 +241,8 @@ class AgentManager:
|
||||||
logger.info("DEBUG: StreamingReActParser created")
|
logger.info("DEBUG: StreamingReActParser created")
|
||||||
|
|
||||||
# Create async chunk callback that feeds parser and sends collected chunks
|
# Create async chunk callback that feeds parser and sends collected chunks
|
||||||
async def on_chunk(text):
|
async def on_chunk(text, end_of_stream):
|
||||||
logger.info(f"DEBUG: on_chunk called with {len(text)} chars")
|
logger.info(f"DEBUG: on_chunk called with {len(text)} chars, end_of_stream={end_of_stream}")
|
||||||
|
|
||||||
# Track what we had before
|
# Track what we had before
|
||||||
prev_thought_count = len(thought_chunks)
|
prev_thought_count = len(thought_chunks)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue