Skip to content

Commit e4fbe20

Browse files
committed
fix: fix streaming for load tools
1 parent 40a951d commit e4fbe20

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

veadk/cli/studio/fast_api.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from fastapi.staticfiles import StaticFiles
2323
from google.adk.agents.run_config import RunConfig, StreamingMode
2424
from google.genai import types
25+
from pydantic import BaseModel
2526

2627
from veadk.cli.studio.models import (
2728
GetAgentResponse,
@@ -151,6 +152,14 @@ async def runner_run_sse(user_text: str):
151152
yield f"data: {json.dumps(TOOL_INPUT_AVAILABLE)}\n\n"
152153

153154
for function_response in event.get_function_responses():
155+
# for load_memory and load_knowledgebase tools, the output is based BaseModel
156+
# we have to convert it
157+
for key, value in function_response.response.items():
158+
if isinstance(value, BaseModel):
159+
function_response.response[key] = value.model_dump(
160+
exclude_none=False
161+
)
162+
154163
TOOL_OUTPUT_AVAILABLE = {
155164
"type": "tool-output-available",
156165
"toolCallId": function_response.id,

0 commit comments

Comments
 (0)