Autocomplete APIΒΆ
- async autocomplete_api.autocomplete(question: str, language: str = None, tags: List[str] = None, k: int = 15, db: Session = fastapi.Depends)ΒΆ
If the user input ends with a β?β character, return a set of questions that may be relevant to the user. If there are at lest 5 results from fuzzy matching, they are returned. Otherwise, results of semantic similarity matching are returned alongside the fuzzy matching results.
- Parameters:
question (str) β User input to match database entries
language (str, optional) β Question and results language
tags (List[str], optional) β Tags of the documents to search
k (int, optional) β Number of results to return
db (Session) β Database session
- Return type:
list of dict
- autocomplete_api.exact_match(question: str, language: str = None, tags: str = None, k: int = 10, db: Session = fastapi.Depends)ΒΆ
Return results from Exact matching
- Parameters:
question (str) β User input to match database entries
language (str, optional) β Question and results language
tags (str, optional) β Tags of the documents to search
k (int, optional) β Number of results to return
db (Session) β Database session
- Return type:
list of dict
- autocomplete_api.fuzzy_match(question: str, language: str = None, tags: str = None, k: int = 10, threshold=50, db: Session = fastapi.Depends)ΒΆ
Return results from Fuzzy matching, using Levenshtein distance
- Parameters:
question (str) β User input to match database entries
language (str, optional) β Question and results language
tags (str, optional) β Tags of the documents to search
k (int, optional) β Number of results to return
threshold (int, optional) β Levenshtein threshold
db (Session) β Database session
- Return type:
list of dict
- autocomplete_api.trigram_match(question: str, language: str = None, tags: str = None, k: int = 10, threshold: float = 0.4, db: Session = fastapi.Depends)ΒΆ
Return results from Trigram matching
- Parameters:
question (str) β User input to match database entries
language (str, optional) β Question and results language
tasg (str, optional) β Tags of the documents to search
k (int, optional) β Number of results to return
threshold (float, optional) β Trigram threshold, between 0 and 1
db (Session) β Database session
- Return type:
list of dict
- autocomplete_api.semantic_similarity_match(question: str, language: str = None, tags: str = None, k: int = 10, db: Session = fastapi.Depends)ΒΆ
Return results from Semantic Similarity matching
- Parameters:
question (str) β User input to match database entries
language (str, optional) β Question and results language
tags (str, optional) β Tags of the documents to search
k (int, optional) β Number of results to return
db (Session) β Database session
- Return type:
list of dict