The Text to Code lambda function uses both a Retriever model and a Reranker model to select the best candidate out of the results returned by OpenSearch. The correct behavior of the lambda is that the OpenSearch results are re-scored and re-sorted by our Reranker before the highest scoring re-ranker selection is appended to the TTC Output. However, this is not happening in our codebase. Currently, we are choosing the highest scoring LOINC code from the Retriever step, which operates only the query results returned by OpenSearch. The scope of this ticket is to correct this bug.
Acceptance Criteria:
- In
text-to-code-lambda/src/text-to-code-lambda/lambda_function.py, the code in the function process_schematron_errors is updated to use the reranker results rather than the retriever results. The function begins approximately on line 235, and the block of code in which the particular code is appended to TTC output is on approximately line 310. The values passed in to the _build_nonstandard_code_instance function call on approximately line 312 should use the code strings and values from the ranked_results list, not the results_list.
- Any applicable tests are updated to reflect this change
The Text to Code lambda function uses both a Retriever model and a Reranker model to select the best candidate out of the results returned by OpenSearch. The correct behavior of the lambda is that the OpenSearch results are re-scored and re-sorted by our Reranker before the highest scoring re-ranker selection is appended to the TTC Output. However, this is not happening in our codebase. Currently, we are choosing the highest scoring LOINC code from the Retriever step, which operates only the query results returned by OpenSearch. The scope of this ticket is to correct this bug.
Acceptance Criteria:
text-to-code-lambda/src/text-to-code-lambda/lambda_function.py, the code in the functionprocess_schematron_errorsis updated to use the reranker results rather than the retriever results. The function begins approximately on line 235, and the block of code in which the particular code is appended to TTC output is on approximately line 310. The values passed in to the_build_nonstandard_code_instancefunction call on approximately line 312 should use the code strings and values from theranked_resultslist, not theresults_list.