refac: explicit toggle builtin tools
This commit is contained in:
@@ -471,6 +471,7 @@ def get_builtin_tools(
|
|||||||
is_builtin_tool_enabled("web_search")
|
is_builtin_tool_enabled("web_search")
|
||||||
and getattr(request.app.state.config, "ENABLE_WEB_SEARCH", False)
|
and getattr(request.app.state.config, "ENABLE_WEB_SEARCH", False)
|
||||||
and get_model_capability("web_search")
|
and get_model_capability("web_search")
|
||||||
|
and features.get("web_search")
|
||||||
):
|
):
|
||||||
builtin_functions.extend([search_web, fetch_url])
|
builtin_functions.extend([search_web, fetch_url])
|
||||||
|
|
||||||
@@ -479,12 +480,14 @@ def get_builtin_tools(
|
|||||||
is_builtin_tool_enabled("image_generation")
|
is_builtin_tool_enabled("image_generation")
|
||||||
and getattr(request.app.state.config, "ENABLE_IMAGE_GENERATION", False)
|
and getattr(request.app.state.config, "ENABLE_IMAGE_GENERATION", False)
|
||||||
and get_model_capability("image_generation")
|
and get_model_capability("image_generation")
|
||||||
|
and features.get("image_generation")
|
||||||
):
|
):
|
||||||
builtin_functions.append(generate_image)
|
builtin_functions.append(generate_image)
|
||||||
if (
|
if (
|
||||||
is_builtin_tool_enabled("image_generation")
|
is_builtin_tool_enabled("image_generation")
|
||||||
and getattr(request.app.state.config, "ENABLE_IMAGE_EDIT", False)
|
and getattr(request.app.state.config, "ENABLE_IMAGE_EDIT", False)
|
||||||
and get_model_capability("image_generation")
|
and get_model_capability("image_generation")
|
||||||
|
and features.get("image_generation")
|
||||||
):
|
):
|
||||||
builtin_functions.append(edit_image)
|
builtin_functions.append(edit_image)
|
||||||
|
|
||||||
@@ -493,6 +496,7 @@ def get_builtin_tools(
|
|||||||
is_builtin_tool_enabled("code_interpreter")
|
is_builtin_tool_enabled("code_interpreter")
|
||||||
and getattr(request.app.state.config, "ENABLE_CODE_INTERPRETER", True)
|
and getattr(request.app.state.config, "ENABLE_CODE_INTERPRETER", True)
|
||||||
and get_model_capability("code_interpreter")
|
and get_model_capability("code_interpreter")
|
||||||
|
and features.get("code_interpreter")
|
||||||
):
|
):
|
||||||
builtin_functions.append(execute_code)
|
builtin_functions.append(execute_code)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user