Update app.py
Browse files
app.py
CHANGED
@@ -337,7 +337,7 @@ def optimize_query(
|
|
337 |
vector_store_type: str, # Added to match your signature
|
338 |
search_type: str, # Added to match your signature
|
339 |
top_k: int = 3,
|
340 |
-
use_gpu: bool =
|
341 |
) -> str:
|
342 |
"""
|
343 |
CPU-optimized version of query expansion using a small language model.
|
@@ -439,11 +439,11 @@ def optimize_query(
|
|
439 |
if device == "cuda":
|
440 |
torch.cuda.empty_cache()
|
441 |
|
442 |
-
return expanded_query.strip()
|
443 |
|
444 |
except Exception as e:
|
445 |
print(f"Query optimization failed: {str(e)}")
|
446 |
-
return query # Return original query if optimization fails
|
447 |
|
448 |
|
449 |
|
|
|
337 |
vector_store_type: str, # Added to match your signature
|
338 |
search_type: str, # Added to match your signature
|
339 |
top_k: int = 3,
|
340 |
+
use_gpu: bool = True
|
341 |
) -> str:
|
342 |
"""
|
343 |
CPU-optimized version of query expansion using a small language model.
|
|
|
439 |
if device == "cuda":
|
440 |
torch.cuda.empty_cache()
|
441 |
|
442 |
+
return [Document(page_content=expanded_query.strip())]
|
443 |
|
444 |
except Exception as e:
|
445 |
print(f"Query optimization failed: {str(e)}")
|
446 |
+
return [Document(page_content=query)] # Return original query if optimization fails
|
447 |
|
448 |
|
449 |
|