mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-12 18:15:33 +00:00
fix: strict json in openai base
This commit is contained in:
1 parent
f7bfd38b28
commit
15d4e9dbf5
1 file changed
+7
-3
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user