Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -23,9 +23,12 @@ def embed_query(text):
|
|
23 |
# Semantic search using FAISS
|
24 |
def search(query, k=3):
|
25 |
query_vec = embed_query(query).astype(np.float32)
|
|
|
26 |
distances = np.empty((1, k), dtype=np.float32)
|
27 |
labels = np.empty((1, k), dtype=np.int64)
|
28 |
-
|
|
|
|
|
29 |
return [chunks[i] for i in labels[0]]
|
30 |
|
31 |
# Chat modes
|
|
|
23 |
# Semantic search using FAISS
|
24 |
def search(query, k=3):
|
25 |
query_vec = embed_query(query).astype(np.float32)
|
26 |
+
|
27 |
distances = np.empty((1, k), dtype=np.float32)
|
28 |
labels = np.empty((1, k), dtype=np.int64)
|
29 |
+
|
30 |
+
index.search(query_vec, k, distances, labels) # ✅ now correct
|
31 |
+
|
32 |
return [chunks[i] for i in labels[0]]
|
33 |
|
34 |
# Chat modes
|