Skip to content

Commit

Permalink
added ray.init() before calling filter function
Browse files Browse the repository at this point in the history
  • Loading branch information
star-nox committed Dec 8, 2023
1 parent 7d27551 commit 815dbee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ai_ta_backend/vector_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)}")

Expand Down

0 comments on commit 815dbee

Please sign in to comment.