Browse Source

Add option to blacklist modules in code interpreter

Co-authored-by: KG <kahghi@users.noreply.github.com>
Rodrigo Agundez 4 months ago
parent
commit
6dd969129d
1 changed files with 10 additions and 0 deletions
  1. 10 0
      backend/open_webui/config.py

+ 10 - 0
backend/open_webui/config.py

@@ -1711,6 +1711,16 @@ CODE_INTERPRETER_JUPYTER_TIMEOUT = PersistentConfig(
     ),
 )
 
+CODE_INTERPRETER_BLACKLISTED_MODULES = PersistentConfig(
+    "CODE_INTERPRETER_BLACKLISTED_MODULES",
+    "code_interpreter.blacklisted_modules",
+    [
+        library.strip()
+        for library in os.environ.get("CODE_INTERPRETER_BLACKLISTED_MODULES", "").split(",")
+        if library.strip()
+    ],
+)
+
 
 DEFAULT_CODE_INTERPRETER_PROMPT = """
 #### Tools Available