CdC-SI / eak-copilot

The official repository of the EAK-Copilot project as part of the Innovation Fellowship 2024.
https://cdc-si.github.io/eak-copilot/
GNU General Public License v3.0
4 stars 0 forks source link

implement semantic search for autocomplete #150

Closed K-Schubert closed 1 month ago

K-Schubert commented 2 months ago

Description

Semantic Similarity search (cosine similarity) for autocomplete is implemented.

A user query is embedded through the /embed endpoint and top 5 suggestions are retrieved from the faq_embeddings table (NOTE: top_k suggestion retrieval will be implemented next). The associated text is returned as a suggestion.

The get_semantic_similarity_match() is only called if combined results of get_exact_match() and get_fuzzy_match() return less than 5 results AND after every new "space" character in the question (user query) is added OR when a "?" character is added at the end of the question in the /autocomplete facade.

Implemented in autocomplete/app/main.py through get_semantic_similarity_match() and deployed through the /autocomplete/semantic_similarity_match/ endpoint.