[ perf ] Replace json-> orjson in hot path (#11221)

Signed-off-by: vincentzed <207368749+vincentzed@users.noreply.github.com>
This commit is contained in:
Vincent Zhong
2025-10-12 08:30:58 -04:00
committed by GitHub
parent 7b064f04f8
commit a220536f40
13 changed files with 32 additions and 20 deletions

View File

@@ -5,6 +5,8 @@ import logging
from abc import ABC, abstractmethod
from typing import Union
import orjson
logger = logging.getLogger(__name__)
try:
@@ -148,7 +150,7 @@ class HarmonyContext(ConversationContext):
if isinstance(tool_session, Tool):
return await tool_session.get_result(self)
tool_name = last_msg.recipient.split(".")[1]
args = json.loads(last_msg.content[0].text)
args = orjson.loads(last_msg.content[0].text)
result = await tool_session.call_tool(tool_name, args)
result_str = result.content[0].text
content = TextContent(text=result_str)