Spaces:
Sleeping
Sleeping
Update agent_langchain.py
Browse files- agent_langchain.py +6 -5
agent_langchain.py
CHANGED
|
@@ -49,12 +49,13 @@ clf_model = AutoModelForSequenceClassification.from_pretrained(clf_model_name)
|
|
| 49 |
# -------------------------------
|
| 50 |
# Initialize ChromaDB Client for KB
|
| 51 |
# -------------------------------
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
persist_directory="/data/chroma_db"
|
| 55 |
-
))
|
| 56 |
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
| 58 |
try:
|
| 59 |
kb_collection = chroma_client.get_collection(COLLECTION_NAME)
|
| 60 |
except:
|
|
|
|
| 49 |
# -------------------------------
|
| 50 |
# Initialize ChromaDB Client for KB
|
| 51 |
# -------------------------------
|
| 52 |
+
# ✅ Use new API — persistent on Hugging Face writable directory
|
| 53 |
+
chroma_client = chromadb.PersistentClient(path="/tmp/chroma")
|
|
|
|
|
|
|
| 54 |
|
| 55 |
+
# ✅ Create or get your KB collection
|
| 56 |
+
kb_collection = chroma_client.get_or_create_collection("KB")
|
| 57 |
+
|
| 58 |
+
COLLECTION_NAME = "KB"
|
| 59 |
try:
|
| 60 |
kb_collection = chroma_client.get_collection(COLLECTION_NAME)
|
| 61 |
except:
|