Rerank Handle Null (#2010)

This commit is contained in:
Yuhong Sun 2024-07-31 22:59:02 -07:00 committed by GitHub
parent 1be1959d80
commit ca893f9918
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -36,7 +36,7 @@ POSTGRES_APP_NAME = (
_SYNC_ENGINE: Engine | None = None
_ASYNC_ENGINE: AsyncEngine | None = None
SessionFactory = None
SessionFactory: sessionmaker[Session] | None = None
def get_db_current_time(db_session: Session) -> datetime:

View File

@ -236,6 +236,12 @@ def search_postprocessing(
) -> Iterator[list[InferenceSection] | list[int]]:
post_processing_tasks: list[FunctionCall] = []
if not retrieved_sections:
# Avoids trying to rerank an empty list which throws an error
yield []
yield []
return
rerank_task_id = None
sections_yielded = False
if should_rerank(search_query):