aws-genai-llm-chatbot
aws-genai-llm-chatbot copied to clipboard
Vector scores are getting incorrectly sorted in descending order when metric is "L2" during Aurora Semantic Query.
To handle the case where the metric is "L2" and ensure that scores are sorted in ascending order, we can add a new condition into the this if clause below to handle this use case. This code only gets invoked when retrieved documents is less than specified limit.
https://github.com/aws-samples/aws-genai-llm-chatbot/blob/372710ae19ec7f8331f3190590185db711094b73/lib/shared/layers/python-sdk/python/genai_core/aurora/query.py#L226