Spaces:
Sleeping
Sleeping
fix topk type bug
Browse files- app.py +1 -0
- backend/semantic_search.py +4 -4
app.py
CHANGED
@@ -35,6 +35,7 @@ def add_text(history, text):
|
|
35 |
|
36 |
|
37 |
def bot(history, api_kind, chunk_table, embedding_model, llm_model, eross_encoder, top_k_param):
|
|
|
38 |
query = history[-1][0]
|
39 |
|
40 |
if not query:
|
|
|
35 |
|
36 |
|
37 |
def bot(history, api_kind, chunk_table, embedding_model, llm_model, eross_encoder, top_k_param):
|
38 |
+
top_k_param = int(top_k_param)
|
39 |
query = history[-1][0]
|
40 |
|
41 |
if not query:
|
backend/semantic_search.py
CHANGED
@@ -15,10 +15,10 @@ retriever = SentenceTransformer(os.getenv("EMB_MODEL"))
|
|
15 |
|
16 |
|
17 |
def retrieve(query, k, table_name, emb_name):
|
18 |
-
print(table_name)
|
19 |
-
print(emb_name)
|
20 |
-
|
21 |
-
|
22 |
query_vec = retriever.encode(query)
|
23 |
try:
|
24 |
documents = TABLE.search(query_vec, vector_column_name=VECTOR_COLUMN).limit(k).to_list()
|
|
|
15 |
|
16 |
|
17 |
def retrieve(query, k, table_name, emb_name):
|
18 |
+
#print(table_name)
|
19 |
+
#print(emb_name)
|
20 |
+
TABLE = db.open_table(table_name)
|
21 |
+
retriever = SentenceTransformer(emb_name)
|
22 |
query_vec = retriever.encode(query)
|
23 |
try:
|
24 |
documents = TABLE.search(query_vec, vector_column_name=VECTOR_COLUMN).limit(k).to_list()
|