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

improve autocomplete behaviour #177

Open K-Schubert opened 1 month ago

K-Schubert commented 1 month ago

Description

Bug in autosuggest: the behaviour defined in the /autocomplete/ facade doesn't return suggestions when exact match and fuzzy match "fail", and last query character is not a " " or a "?". With the current implementation, when writing new characters that are not a " " or a "?", the autosuggest list disappears when exact match and fuzzy search are not called.

With the current autocomplete behaviour (exact match + fuzzy match in parallel (async)), if there are less than 5 autosuggest suggestions, AND the last query character is a " " (space) OR a "?", THEN run semantic similarity match.

Eg. "Que signifie " will return a list of autosuggestions, whereas "Que signifie a" will not return a list.

Steps to Reproduce

# navigate to eak-copilot root
git checkout main
docker-compose up --build
# navigate to localhost:8010/docs and run /init_faq_vectordb
# navigate to localhost:3000
# enter a prompt such as "Que signifie " and compare with "Que signifie a"

Expected Behavior

The autosuggest list is still displayed.

Actual Behavior

The autosuggest list disappears.

Possible Solution

Possibly cache the autosuggestions and only update when a new " " or "?" character is present at the end of the query string.

@tabee