Update parser (#14831)

Gpt-3.5 sometimes calls with empty string arguments instead of `{}`

I'd assume it's because the typescript representation on their backend
makes it a bit ambiguous.
This commit is contained in:
William FH 2023-12-17 20:02:07 -08:00 committed by GitHub
parent 11fda490ca
commit bbc98a234d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,7 @@ def parse_ai_message_to_openai_tool_action(
function = tool_call["function"]
function_name = function["name"]
try:
_tool_input = json.loads(function["arguments"])
_tool_input = json.loads(function["arguments"] or "{}")
except JSONDecodeError:
raise OutputParserException(
f"Could not parse tool input: {function} because "