Spaces:
Running
Running
Se arregla search method
Browse files
app.py
CHANGED
@@ -22,10 +22,11 @@ def embed_query(text):
|
|
22 |
|
23 |
# Semantic search using FAISS
|
24 |
def search(query, k=3):
|
25 |
-
query_vec = embed_query(query)
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
29 |
|
30 |
# Chat modes
|
31 |
def chat_no_rag(question):
|
|
|
22 |
|
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 |
+
index.search(query_vec, k, distances, labels)
|
29 |
+
return [chunks[i] for i in labels[0]]
|
30 |
|
31 |
# Chat modes
|
32 |
def chat_no_rag(question):
|