feat: code-interpreter native (#20592)
* code-interpreter native * Update tools.py * Update builtin.py * Update builtin.py * Update tools.py * Update builtin.py * Update builtin.py * Update builtin.py * Update builtin.py * Update builtin.py * Update builtin.py * Update builtin.py * Update builtin.py * Update builtin.py * Update builtin.py
This commit is contained in:
@@ -51,6 +51,7 @@ from open_webui.tools.builtin import (
|
||||
fetch_url,
|
||||
generate_image,
|
||||
edit_image,
|
||||
execute_code,
|
||||
search_memories,
|
||||
add_memory,
|
||||
replace_memory_content,
|
||||
@@ -449,6 +450,14 @@ def get_builtin_tools(
|
||||
) and get_model_capability("image_generation"):
|
||||
builtin_functions.append(edit_image)
|
||||
|
||||
# Add code interpreter tool if enabled globally AND model has code_interpreter capability
|
||||
# Supports both pyodide (via frontend event call) and jupyter engines
|
||||
if (
|
||||
getattr(request.app.state.config, "ENABLE_CODE_INTERPRETER", True)
|
||||
and get_model_capability("code_interpreter")
|
||||
):
|
||||
builtin_functions.append(execute_code)
|
||||
|
||||
# Notes tools - search, view, create, and update user's notes (if notes enabled globally)
|
||||
if getattr(request.app.state.config, "ENABLE_NOTES", False):
|
||||
builtin_functions.extend(
|
||||
@@ -473,6 +482,8 @@ def get_builtin_tools(
|
||||
"__request__": request,
|
||||
"__user__": extra_params.get("__user__", {}),
|
||||
"__event_emitter__": extra_params.get("__event_emitter__"),
|
||||
"__event_call__": extra_params.get("__event_call__"),
|
||||
"__metadata__": extra_params.get("__metadata__"),
|
||||
"__chat_id__": extra_params.get("__chat_id__"),
|
||||
"__message_id__": extra_params.get("__message_id__"),
|
||||
"__model_knowledge__": model_knowledge,
|
||||
|
||||
Reference in New Issue
Block a user