Spaces:
Running
Running
Asish Karthikeya Gogineni commited on
Commit ·
e82a017
1
Parent(s): 0954841
fix: Switch to FAISS as default and use /tmp for persist directory
Browse files- FAISS is now the default vector DB (fixes ChromaDB tenants table error)
- Indexer uses /tmp/vector_db by default for Hugging Face compatibility
- Creates persist directory proactively
- app.py +1 -1
- code_chatbot/indexer.py +5 -2
app.py
CHANGED
|
@@ -365,7 +365,7 @@ with st.sidebar:
|
|
| 365 |
os.environ[env_key_name] = api_key
|
| 366 |
|
| 367 |
# Vector Database Selection
|
| 368 |
-
vector_db_type = st.selectbox("Vector Database", ["
|
| 369 |
|
| 370 |
if vector_db_type == "qdrant":
|
| 371 |
st.caption("☁️ connect to a hosted Qdrant cluster")
|
|
|
|
| 365 |
os.environ[env_key_name] = api_key
|
| 366 |
|
| 367 |
# Vector Database Selection
|
| 368 |
+
vector_db_type = st.selectbox("Vector Database", ["faiss", "chroma", "qdrant"])
|
| 369 |
|
| 370 |
if vector_db_type == "qdrant":
|
| 371 |
st.caption("☁️ connect to a hosted Qdrant cluster")
|
code_chatbot/indexer.py
CHANGED
|
@@ -139,8 +139,11 @@ class Indexer:
|
|
| 139 |
Indexes code files into a Vector Database.
|
| 140 |
Now uses StructuralChunker for semantic splitting.
|
| 141 |
"""
|
| 142 |
-
def __init__(self, persist_directory: str =
|
| 143 |
-
|
|
|
|
|
|
|
|
|
|
| 144 |
self.provider = provider
|
| 145 |
|
| 146 |
# Load configuration
|
|
|
|
| 139 |
Indexes code files into a Vector Database.
|
| 140 |
Now uses StructuralChunker for semantic splitting.
|
| 141 |
"""
|
| 142 |
+
def __init__(self, persist_directory: str = None, embedding_function=None, provider: str = "gemini", api_key: str = None):
|
| 143 |
+
# Use /tmp for Hugging Face compatibility (they only allow writes to /tmp)
|
| 144 |
+
import tempfile
|
| 145 |
+
self.persist_directory = persist_directory or os.path.join(tempfile.gettempdir(), "vector_db")
|
| 146 |
+
os.makedirs(self.persist_directory, exist_ok=True)
|
| 147 |
self.provider = provider
|
| 148 |
|
| 149 |
# Load configuration
|