-
-
Save KyMidd/7a7d68f109011a8ea45f57789a42c777 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Iterate through the rank response and reorder the kb_responses and add relevance_score | |
| # We're also filtering just for the most relevant results according to rerank_number_of_results | |
| ranked_kb_responses = [ | |
| { | |
| # Use the index value in rank_response to find the correct kb_response | |
| "text": kb_responses[rank_response['index']]["text"], | |
| "url": kb_responses[rank_response['index']]["url"], | |
| "relevance_score": rank_response['relevance_score'] | |
| } for rank_response in rank_response_body['results'] | |
| ] | |
| return ranked_kb_responses |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment