fix:bool和boolean问题

pull/1359/head
SengokuCola 2025-11-13 23:43:35 +08:00
parent e816a4ab4c
commit ebe224b0a1
2 changed files with 12 additions and 2 deletions

View File

@ -143,8 +143,13 @@ def _convert_tool_options(tool_options: list[ToolOption]) -> list[FunctionDeclar
:param tool_option_param: 工具参数对象
:return: 转换后的工具参数字典
"""
# JSON Schema要求使用"boolean"而不是"bool"
param_type_value = tool_option_param.param_type.value
if param_type_value == "bool":
param_type_value = "boolean"
return_dict: dict[str, Any] = {
"type": tool_option_param.param_type.value,
"type": param_type_value,
"description": tool_option_param.description,
}
if tool_option_param.enum_values:

View File

@ -118,8 +118,13 @@ def _convert_tool_options(tool_options: list[ToolOption]) -> list[dict[str, Any]
:param tool_option_param: 工具参数对象
:return: 转换后的工具参数字典
"""
# JSON Schema要求使用"boolean"而不是"bool"
param_type_value = tool_option_param.param_type.value
if param_type_value == "bool":
param_type_value = "boolean"
return_dict: dict[str, Any] = {
"type": tool_option_param.param_type.value,
"type": param_type_value,
"description": tool_option_param.description,
}
if tool_option_param.enum_values: