Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -95,18 +95,6 @@ def init_vector_search() -> MongoDBAtlasVectorSearch:
|
|
95 |
st.error("❌ Failed to connect to MongoDB Atlas Vector Search")
|
96 |
st.error(f"Error: {e}")
|
97 |
raise e
|
98 |
-
✅ Optional: Clean Up init_embedding_model() Too
|
99 |
-
Just to be safe, you can explicitly name the model inside init_embedding_model():
|
100 |
-
|
101 |
-
python
|
102 |
-
Copy
|
103 |
-
Edit
|
104 |
-
@st.cache_resource
|
105 |
-
def init_embedding_model():
|
106 |
-
model_name = "sentence-transformers/all-mpnet-base-v2"
|
107 |
-
st.write(f"📦 Loading local embedding model: `{model_name}`")
|
108 |
-
return HuggingFaceEmbeddings(model_name=model_name)
|
109 |
-
|
110 |
# =================== Format Retrieved Chunks ===================
|
111 |
def format_docs(docs: List[Document]) -> str:
|
112 |
return "\n\n".join(doc.page_content or doc.metadata.get("content", "") for doc in docs)
|
|
|
95 |
st.error("❌ Failed to connect to MongoDB Atlas Vector Search")
|
96 |
st.error(f"Error: {e}")
|
97 |
raise e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
# =================== Format Retrieved Chunks ===================
|
99 |
def format_docs(docs: List[Document]) -> str:
|
100 |
return "\n\n".join(doc.page_content or doc.metadata.get("content", "") for doc in docs)
|