Skip to content

Commit

Permalink
Fix: Don't use mutable datastructures (lists) as default arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
KastanDay committed Apr 1, 2024
1 parent 65b642e commit 217157d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ai_ta_backend/service/retrieval_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def getTopContexts(self,
search_query: str,
course_name: str,
token_limit: int = 4_000,
doc_groups: List[str] = []) -> Union[List[Dict], str]:
doc_groups: List[str] | None = None) -> Union[List[Dict], str]:
"""Here's a summary of the work.
/GET arguments
Expand All @@ -68,6 +68,8 @@ def getTopContexts(self,
or
String: An error message with traceback.
"""
if doc_groups is None:
doc_groups = []
try:
start_time_overall = time.monotonic()

Expand Down Expand Up @@ -345,7 +347,9 @@ def delete_from_nomic_and_supabase(self, course_name: str, identifier_key: str,
print(f"Supabase Error in delete. {identifier_key}: {identifier_value}", e)
self.sentry.capture_exception(e)

def vector_search(self, search_query, course_name, doc_groups: List[str] = []):
def vector_search(self, search_query, course_name, doc_groups: List[str] | None = None):
if doc_groups is None:
doc_groups = []
top_n = 80
# EMBED
openai_start_time = time.monotonic()
Expand Down

0 comments on commit 217157d

Please sign in to comment.