From 9b9594170056685d2a05eed3d73009dcf3cb4c3f Mon Sep 17 00:00:00 2001 From: star-nox Date: Mon, 18 Mar 2024 17:24:33 -0500 Subject: [PATCH] moved sql db object inside supabase padding fn --- ai_ta_backend/utils/context_parent_doc_padding.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ai_ta_backend/utils/context_parent_doc_padding.py b/ai_ta_backend/utils/context_parent_doc_padding.py index ed1d4988..163dab51 100644 --- a/ai_ta_backend/utils/context_parent_doc_padding.py +++ b/ai_ta_backend/utils/context_parent_doc_padding.py @@ -1,6 +1,6 @@ -import os +#import os import time -from concurrent.futures import ProcessPoolExecutor +#from concurrent.futures import ProcessPoolExecutor from functools import partial from multiprocessing import Manager from ai_ta_backend.database.sql import SQLDatabase @@ -11,8 +11,6 @@ # SUPABASE_CLIENT = supabase.create_client(supabase_url=os.environ['SUPABASE_URL'], # supabase_key=os.environ['SUPABASE_API_KEY']) # type: ignore -SQL_DB = SQLDatabase() - def context_parent_doc_padding(found_docs, search_query, course_name): """ @@ -77,8 +75,9 @@ def qdrant_context_processing(doc, course_name, result_contexts): def supabase_context_padding(doc, course_name, result_docs): """ Does context padding for given doc. - """ - + """ + SQL_DB = SQLDatabase() + # query by url or s3_path if 'url' in doc.metadata.keys() and doc.metadata['url']: parent_doc_id = doc.metadata['url']