refac/fix: optional tool param type

This commit is contained in:
Timothy Jaeryang Baek 2025-05-22 12:41:00 +04:00
parent 17ed331a0a
commit 787987d2f0

View File

@ -160,7 +160,7 @@ def get_tools(
# TODO: Fix hack for OpenAI API
# Some times breaks OpenAI but others don't. Leaving the comment
for val in spec.get("parameters", {}).get("properties", {}).values():
if val["type"] == "str":
if val.get("type") == "str":
val["type"] = "string"
# Remove internal reserved parameters (e.g. __id__, __user__)