diff --git a/ai_ta_backend/vector_database.py b/ai_ta_backend/vector_database.py index 752a6f8c..ada3898c 100644 --- a/ai_ta_backend/vector_database.py +++ b/ai_ta_backend/vector_database.py @@ -13,7 +13,7 @@ from tempfile import NamedTemporaryFile from typing import Any, Callable, Dict, List, Optional, Tuple, Union - +import ray import boto3 import fitz import openai @@ -1164,6 +1164,7 @@ def getTopContextsWithMQR(self, search_query: str, course_name: str, token_limit # count tokens at start and end, then also count each context. token_counter, _ = count_tokens_and_cost(pre_prompt + '\n\nNow please respond to my query: ' + search_query) # type: ignore + ray.init() filtered_docs = list(run(contexts=final_docs, user_query=search_query, max_time_before_return=45, max_concurrency=100)) print(f"Number of docs after context filtering: {len(filtered_docs)}")