Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -57,16 +57,16 @@ def init_vector_search() -> MongoDBAtlasVectorSearch:
|
|
57 |
api_key=HF_TOKEN,
|
58 |
model_name="sentence-transformers/all-mpnet-base-v2"
|
59 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
return MongoDBAtlasVectorSearch.from_connection_string(
|
61 |
connection_string=MONGO_URI,
|
62 |
namespace=f"{db_name}.{collection_name}",
|
63 |
embedding=embedding_model,
|
64 |
-
try:
|
65 |
-
test_vector = embedding_model.embed_query("test query")
|
66 |
-
print("✅ Embedding model test vector:", test_vector[:5])
|
67 |
-
except Exception as e:
|
68 |
-
st.error(f"❌ Failed to embed test query: {e}")
|
69 |
-
raise
|
70 |
index_name=index_name,
|
71 |
)
|
72 |
|
|
|
57 |
api_key=HF_TOKEN,
|
58 |
model_name="sentence-transformers/all-mpnet-base-v2"
|
59 |
)
|
60 |
+
try:
|
61 |
+
test_vector = embedding_model.embed_query("test query")
|
62 |
+
print("✅ Embedding model test vector:", test_vector[:5])
|
63 |
+
except Exception as e:
|
64 |
+
st.error(f"❌ Failed to embed test query: {e}")
|
65 |
+
raise
|
66 |
return MongoDBAtlasVectorSearch.from_connection_string(
|
67 |
connection_string=MONGO_URI,
|
68 |
namespace=f"{db_name}.{collection_name}",
|
69 |
embedding=embedding_model,
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
index_name=index_name,
|
71 |
)
|
72 |
|