Search

Functions

_text_search(
    search_term: str,
    domain: List[str] | None,
    vocabulary: List[str] | None,
    standard_concept: bool,
    valid_concept: bool,
    top_k: int,
) -> List[ConceptSuggestion]:

Run a lexical search for a search term with specified parameters

ParameterTypeDescription
search_termstrThe string to search for
domainList[str]None
vocabularyList[str]None = None
standard_conceptbool = True,If true, only standard concepts returned. Otherwise, non-standard concepts will be included.
valid_conceptbool = TrueIf true, only concepts without invalid_reason returned. Otherwise, all concepts will be included.
top_kintThe number of results to return

Returns List[ConceptSuggestion]

The top_k results from the lexical search

_vector_search(
    search_term: str,
    domain: List[str] | None,
    vocabulary: List[str] | None,
    standard_concept:bool,
    valid_concept: bool,
    embeddings_model_name: str,
    top_k: int,
) -> List[ConceptSuggestion]:

Run a vector search for a search term with specified parameters

ParameterTypeDescription
search_termstrThe string to search for
domainList[str]None
vocabularyList[str]None = None
standard_conceptbool = True,If true, only standard concepts returned. Otherwise, non-standard concepts will be included.
valid_conceptbool = TrueIf true, only concepts without invalid_reason returned. Otherwise, all concepts will be included.
embeddings_model_namestr,The short name for an embeddings model to match on the EmbeddingModelName enum
top_kintThe number of results to return

Returns List[ConceptSuggestion]

The top_k results from the vector search

_ai_search(
   search_term: str,
   domain: List[str] | None,
   vocabulary: List[str] | None,
   standard_concept: bool,
   valid_concept: bool,
   embeddings_model_name: str,
   top_k: int,
   llm_name: str,
   llm_url: str,
   logger: Logger,
) -> List[ConceptSuggestion]:

Run an LLM-powered search for a search term with specified parameters

ParameterTypeDescription
search_termstrThe string to search for
domainList[str]None
vocabularyList[str]None = None
standard_conceptbool = True,If true, only standard concepts returned. Otherwise, non-standard concepts will be included.
valid_conceptbool = TrueIf true, only concepts without invalid_reason returned. Otherwise, all concepts will be included.
embeddings_model_namestr,The short name for an embeddings model to match on the EmbeddingModelName enum
top_kintThe number of results to return
llm_namestrThe short name for an LLM to match either a recognised name on a server or the locally saved models
llm_urlstrThe URL for an LLM server
loggerLoggerlog your problems

Returns List[ConceptSuggestion]

The top_k results from the LLM-powered search

search(
   search_term: str,
   domain: List[str] | None,
   vocabulary: List[str] | None,
   standard_concept: bool,
   valid_concept: bool,
   top_k: int,
   search_mode: Literal["text-search", "vector-search", "ai-search"],
   embeddings_model_name: str,
   llm_name: str,
   llm_url: str,
   logger: Logger,
) -> List[ConceptSuggestion]:

Run search for a search term with specified parameters

ParameterTypeDescription
search_termstrThe string to search for
domainList[str]None
vocabularyList[str]None = None
standard_conceptbool = True,If true, only standard concepts returned. Otherwise, non-standard concepts will be included.
valid_conceptbool = TrueIf true, only concepts without invalid_reason returned. Otherwise, all concepts will be included.
embeddings_model_namestr,The short name for an embeddings model to match on the EmbeddingModelName enum
llm_namestrThe short name for an LLM to match either a recognised name on a server or the locally saved models
llm_urlstrThe URL for an LLM server
loggerLoggerlog your problems

Returns List[ConceptSuggestion]

The top_k results from the search

search_and_store

search_and_store(
    search_term: str,
    domain: List[str],
    vocabulary: List[str],
    standard_concept: bool,
    valid_concept: bool,
    top_k: int,
    search_mode: Literal["text-search", "vector-search", "ai-search"],
    embeddings_model_name: str,
    llm_name: str,
    llm_url: str,
    logger: Logger,
    result_storer: Callable,
) -> None:

Run a search for a search term with the provided parameters, then store the result

ParameterTypeDescription
search_termstrThe string to search for
domainList[str]None
vocabularyList[str]None = None
standard_conceptbool = True,If true, only standard concepts returned. Otherwise, non-standard concepts will be included.
valid_conceptbool = TrueIf true, only concepts without invalid_reason returned. Otherwise, all concepts will be included.
top_kintThe number of results to return
search_modeLiteral["text-search", "vector-search", "ai-search"]Which search function to use
embeddings_model_namestr,The short name for an embeddings model to match on the EmbeddingModelName enum
llm_namestrThe short name for an LLM to match either a recognised name on a server or the locally saved models
llm_urlstrThe URL for an LLM server
loggerLoggerlog your problems
result_storerCallableA function to store results