fix: strict json in openai base

This commit is contained in:
Alex committed 2026-03-26 13:08:22 +00:00
1 parent f7bfd38b28
commit 15d4e9dbf5
1 file changed
+7 -3
+7 -3
View File
@@ -101,9 +101,13 @@ class OpenAILLM(BaseLLM):
for item in content:
if "function_call" in item:
# Function calls need their own message
cleaned_args = self._remove_null_values(
item["function_call"]["args"]
)
args = item["function_call"]["args"]
if isinstance(args, str):
try:
args = json.loads(args)
except (json.JSONDecodeError, TypeError):
pass
cleaned_args = self._remove_null_values(args)
tool_call = {
"id": item["function_call"]["call_id"],
"type": "function",