File tree 5 files changed +28
-11
lines changed
5 files changed +28
-11
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,11 @@ async def get_response(
96
96
logger .debug ("Received model response" )
97
97
else :
98
98
logger .debug (
99
- f"LLM resp:\n { json .dumps (response .choices [0 ].message .model_dump (), indent = 2 )} \n "
99
+ f"LLM resp:\n { json .dumps (
100
+ response .choices [0 ].message .model_dump (),
101
+ indent = 2 ,
102
+ ensure_ascii = False
103
+ )} \n "
100
104
)
101
105
102
106
if hasattr (response , "usage" ):
@@ -251,8 +255,8 @@ async def _fetch_response(
251
255
else :
252
256
logger .debug (
253
257
f"Calling Litellm model: { self .model } \n "
254
- f"{ json .dumps (converted_messages , indent = 2 )} \n "
255
- f"Tools:\n { json .dumps (converted_tools , indent = 2 )} \n "
258
+ f"{ json .dumps (converted_messages , indent = 2 , ensure_ascii = False )} \n "
259
+ f"Tools:\n { json .dumps (converted_tools , indent = 2 , ensure_ascii = False )} \n "
256
260
f"Stream: { stream } \n "
257
261
f"Tool choice: { tool_choice } \n "
258
262
f"Response format: { response_format } \n "
Original file line number Diff line number Diff line change @@ -116,7 +116,10 @@ async def invoke_mcp_tool(
116
116
if len (result .content ) == 1 :
117
117
tool_output = result .content [0 ].model_dump_json ()
118
118
elif len (result .content ) > 1 :
119
- tool_output = json .dumps ([item .model_dump () for item in result .content ])
119
+ tool_output = json .dumps (
120
+ [item .model_dump () for item in result .content ],
121
+ ensure_ascii = False
122
+ )
120
123
else :
121
124
logger .error (f"Errored MCP tool result: { result } " )
122
125
tool_output = "Error running tool."
Original file line number Diff line number Diff line change @@ -393,7 +393,8 @@ def ensure_assistant_message() -> ChatCompletionAssistantMessageParam:
393
393
{
394
394
"queries" : file_search .get ("queries" , []),
395
395
"status" : file_search .get ("status" ),
396
- }
396
+ },
397
+ ensure_ascii = False
397
398
),
398
399
},
399
400
)
Original file line number Diff line number Diff line change @@ -74,7 +74,12 @@ async def get_response(
74
74
logger .debug ("Received model response" )
75
75
else :
76
76
logger .debug (
77
- f"LLM resp:\n { json .dumps (response .choices [0 ].message .model_dump (), indent = 2 )} \n "
77
+ "LLM resp:\n " ,
78
+ f"{ json .dumps (
79
+ response .choices [0 ].message .model_dump (),
80
+ indent = 2 ,
81
+ ensure_ascii = False
82
+ )} \n "
78
83
)
79
84
80
85
usage = (
@@ -222,8 +227,8 @@ async def _fetch_response(
222
227
logger .debug ("Calling LLM" )
223
228
else :
224
229
logger .debug (
225
- f"{ json .dumps (converted_messages , indent = 2 )} \n "
226
- f"Tools:\n { json .dumps (converted_tools , indent = 2 )} \n "
230
+ f"{ json .dumps (converted_messages , indent = 2 , ensure_ascii = False )} \n "
231
+ f"Tools:\n { json .dumps (converted_tools , indent = 2 , ensure_ascii = False )} \n "
227
232
f"Stream: { stream } \n "
228
233
f"Tool choice: { tool_choice } \n "
229
234
f"Response format: { response_format } \n "
Original file line number Diff line number Diff line change @@ -89,7 +89,11 @@ async def get_response(
89
89
else :
90
90
logger .debug (
91
91
"LLM resp:\n "
92
- f"{ json .dumps ([x .model_dump () for x in response .output ], indent = 2 )} \n "
92
+ f"{ json .dumps (
93
+ [x .model_dump () for x in response .output ],
94
+ indent = 2 ,
95
+ ensure_ascii = False
96
+ )} \n "
93
97
)
94
98
95
99
usage = (
@@ -231,8 +235,8 @@ async def _fetch_response(
231
235
else :
232
236
logger .debug (
233
237
f"Calling LLM { self .model } with input:\n "
234
- f"{ json .dumps (list_input , indent = 2 )} \n "
235
- f"Tools:\n { json .dumps (converted_tools .tools , indent = 2 )} \n "
238
+ f"{ json .dumps (list_input , indent = 2 , ensure_ascii = False )} \n "
239
+ f"Tools:\n { json .dumps (converted_tools .tools , indent = 2 , ensure_ascii = False )} \n "
236
240
f"Stream: { stream } \n "
237
241
f"Tool choice: { tool_choice } \n "
238
242
f"Response format: { response_format } \n "
You can’t perform that action at this time.
0 commit comments