Oracle Public Cloud User 3 months ago
parent
commit
b56dbb26be

+ 17 - 7
backend/open_webui/config.py

@@ -1845,15 +1845,25 @@ PINECONE_DIMENSION = int(os.getenv("PINECONE_DIMENSION", 1536))  # or 3072, 1024
 PINECONE_METRIC = os.getenv("PINECONE_METRIC", "cosine")
 PINECONE_METRIC = os.getenv("PINECONE_METRIC", "cosine")
 PINECONE_CLOUD = os.getenv("PINECONE_CLOUD", "aws")  # or "gcp" or "azure"
 PINECONE_CLOUD = os.getenv("PINECONE_CLOUD", "aws")  # or "gcp" or "azure"
 
 
-# ORACLE23AI (Oracle23ai vector search)
-
-ORACLE_DB_USER = os.environ.get("ORACLE_DB_USER", "DEMOUSER")
-ORACLE_DB_PASSWORD = os.environ.get("ORACLE_DB_PASSWORD", "Welcome123456")
-ORACLE_DB_DSN = os.environ.get("ORACLE_DB_DSN", "medium")
-ORACLE_WALLET_DIR = os.environ.get("ORACLE_WALLET_DIR", "/home/opc/adb_wallet")
-ORACLE_WALLET_PASSWORD = os.environ.get("ORACLE_WALLET_PASSWORD", "Welcome1")
+# ORACLE23AI (Oracle23ai Vector Search)
+
+ORACLE_DB_USE_WALLET = os.environ.get("ORACLE_DB_USE_WALLET", "false").lower() == "true"
+ORACLE_DB_USER = os.environ.get("ORACLE_DB_USER", None)              #
+ORACLE_DB_PASSWORD = os.environ.get("ORACLE_DB_PASSWORD", None) #
+ORACLE_DB_DSN = os.environ.get("ORACLE_DB_DSN", None)                  #
+ORACLE_WALLET_DIR = os.environ.get("ORACLE_WALLET_DIR", None)
+ORACLE_WALLET_PASSWORD = os.environ.get("ORACLE_WALLET_PASSWORD", None)
 ORACLE_VECTOR_LENGTH = os.environ.get("ORACLE_VECTOR_LENGTH", 768)
 ORACLE_VECTOR_LENGTH = os.environ.get("ORACLE_VECTOR_LENGTH", 768)
 
 
+if VECTOR_DB == "oracle23ai" and not ORACLE_DB_USER or not ORACLE_DB_PASSWORD or not ORACLE_DB_DSN:
+    raise ValueError(
+        "Oracle23ai requires setting ORACLE_DB_USER, ORACLE_DB_PASSWORD, and ORACLE_DB_DSN."
+    )
+
+if VECTOR_DB == "oracle23ai" and ORACLE_DB_USE_WALLET and not ORACLE_WALLET_DIR or not ORACLE_WALLET_PASSWORD:
+    raise ValueError(
+        "Oracle23ai requires setting ORACLE_WALLET_DIR and ORACLE_WALLET_PASSWORD when using wallet authentication."
+    )
 
 
 ####################################
 ####################################
 # Information Retrieval (RAG)
 # Information Retrieval (RAG)

+ 3 - 2
backend/open_webui/retrieval/vector/dbs/oracle23ai.py

@@ -12,6 +12,7 @@ from open_webui.retrieval.vector.main import (
 )
 )
 
 
 from open_webui.config import (
 from open_webui.config import (
+    ORACLE_DB_USE_WALLET
     ORACLE_DB_USER,
     ORACLE_DB_USER,
     ORACLE_DB_PASSWORD,
     ORACLE_DB_PASSWORD,
     ORACLE_DB_DSN,
     ORACLE_DB_DSN,
@@ -59,10 +60,10 @@ class Oracle23aiClient(VectorDBBase):
                 wallet_password=ORACLE_WALLET_PASSWORD
                 wallet_password=ORACLE_WALLET_PASSWORD
             )
             )
             
             
-            print(f" >>> Creating Connection Pool [{ORACLE_DB_USER}:**@{ORACLE_DB_DSN}]")
+            log.info(f" >>> Creating Connection Pool [{ORACLE_DB_USER}:**@{ORACLE_DB_DSN}]")
             
             
             with self.get_connection() as connection:
             with self.get_connection() as connection:
-                print("Connection version:", connection.version)
+                log.info("Connection version:", connection.version)
                 self._initialize_database(connection)
                 self._initialize_database(connection)
                 
                 
             print("Oracle Vector Search initialization complete.")
             print("Oracle Vector Search initialization complete.")