refactor: replace print statements with logging for better error tracking

This commit is contained in:
Yifang Deng
2025-02-25 15:36:25 +01:00
parent 6fedd72e39
commit 0e5d5ecb81
34 changed files with 171 additions and 103 deletions

7
backend/open_webui/retrieval/vector/dbs/chroma.py Normal file → Executable file
View File

@@ -1,4 +1,5 @@
import chromadb
import logging
from chromadb import Settings
from chromadb.utils.batch_utils import create_batches
@@ -16,6 +17,10 @@ from open_webui.config import (
CHROMA_CLIENT_AUTH_PROVIDER,
CHROMA_CLIENT_AUTH_CREDENTIALS,
)
from open_webui.env import SRC_LOG_LEVELS
log = logging.getLogger(__name__)
log.setLevel(SRC_LOG_LEVELS["RAG"])
class ChromaClient:
@@ -103,7 +108,7 @@ class ChromaClient:
)
return None
except Exception as e:
print(e)
log.exception(f"Error querying collection {collection} with limit {limit}: {e}")
return None
def get(self, collection_name: str) -> Optional[GetResult]: