-
Notifications
You must be signed in to change notification settings - Fork 1
/
search.py
22 lines (19 loc) · 815 Bytes
/
search.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from ..search.azure_search_handler import AzureSearchHandler
from ..search.integrated_vectorization_search_handler import (
IntegratedVectorizationSearchHandler,
)
from ..search.search_handler_base import SearchHandlerBase
from ..common.source_document import SourceDocument
from ..helpers.env_helper import EnvHelper
class Search:
@staticmethod
def get_search_handler(env_helper: EnvHelper) -> SearchHandlerBase:
if env_helper.AZURE_SEARCH_USE_INTEGRATED_VECTORIZATION:
return IntegratedVectorizationSearchHandler(env_helper)
else:
return AzureSearchHandler(env_helper)
@staticmethod
def get_source_documents(
search_handler: SearchHandlerBase, question: str
) -> list[SourceDocument]:
return search_handler.query_search(question)