mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
refactor(responses): simplify tool call argument serializer
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
9125a5b7a0
commit
ade21da9d0
1 changed files with 4 additions and 6 deletions
|
|
@ -53,13 +53,11 @@ def serialize_tool_call_arguments(raw_arguments: object, default: str = "") -> s
|
|||
single quotes, which every downstream JSON parser rejects with errors like
|
||||
"Expecting ',' delimiter".
|
||||
"""
|
||||
if raw_arguments is None or raw_arguments == "":
|
||||
return default
|
||||
if isinstance(raw_arguments, str):
|
||||
return raw_arguments
|
||||
if isinstance(raw_arguments, (dict, list, tuple, bool, int, float)):
|
||||
return json.dumps(raw_arguments)
|
||||
return str(raw_arguments)
|
||||
return raw_arguments or default
|
||||
if raw_arguments is None:
|
||||
return default
|
||||
return json.dumps(raw_arguments, default=str)
|
||||
|
||||
|
||||
def unwrap_custom_tool_arguments(arguments: str) -> str:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue