加上tools的enum属性
This commit is contained in:
@@ -192,17 +192,6 @@ def _build_stream_api_resp(
|
||||
return resp
|
||||
|
||||
|
||||
async def _to_async_iterable(iterable: Iterable[T]) -> AsyncIterator[T]:
|
||||
"""
|
||||
将迭代器转换为异步迭代器
|
||||
:param iterable: 迭代器对象
|
||||
:return: 异步迭代器对象
|
||||
"""
|
||||
for item in iterable:
|
||||
await asyncio.sleep(0)
|
||||
yield item
|
||||
|
||||
|
||||
async def _default_stream_response_handler(
|
||||
resp_stream: AsyncIterator[GenerateContentResponse],
|
||||
interrupt_flag: asyncio.Event | None,
|
||||
|
||||
@@ -94,16 +94,19 @@ def _convert_tool_options(tool_options: list[ToolOption]) -> list[dict[str, Any]
|
||||
:return: 转换后的工具选项列表
|
||||
"""
|
||||
|
||||
def _convert_tool_param(tool_option_param: ToolParam) -> dict[str, str]:
|
||||
def _convert_tool_param(tool_option_param: ToolParam) -> dict[str, Any]:
|
||||
"""
|
||||
转换单个工具参数格式
|
||||
:param tool_option_param: 工具参数对象
|
||||
:return: 转换后的工具参数字典
|
||||
"""
|
||||
return {
|
||||
return_dict: dict[str, Any] = {
|
||||
"type": tool_option_param.param_type.value,
|
||||
"description": tool_option_param.description,
|
||||
}
|
||||
if tool_option_param.enum_values:
|
||||
return_dict["enum"] = tool_option_param.enum_values
|
||||
return return_dict
|
||||
|
||||
def _convert_tool_option_item(tool_option: ToolOption) -> dict[str, Any]:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user