Post Inference Processing - runs analysis of the llm_response and uses statistical token-matching with the source materials to try to identify a smaller 'snippet' that is the most likely source with metadata of file and page number. Returns an updated list of response dicti
(self, response)
| 1139 | return response_out |
| 1140 | |
| 1141 | def evidence_check_sources(self, response): |
| 1142 | |
| 1143 | """ Post Inference Processing - runs analysis of the llm_response and uses statistical token-matching |
| 1144 | with the source materials to try to identify a smaller 'snippet' that is the most likely source with |
| 1145 | metadata of file and page number. |
| 1146 | |
| 1147 | Returns an updated list of response dictionaries, enriched with 'source_review' key. """ |
| 1148 | |
| 1149 | # expect that response is a list of response dictionaries |
| 1150 | if isinstance(response, dict): |
| 1151 | response = [response] |
| 1152 | |
| 1153 | response_out = [] |
| 1154 | for i, response_dict in enumerate(response): |
| 1155 | qc = QualityCheck(self).source_reviewer(response_dict) |
| 1156 | |
| 1157 | response_dict.update({"source_review": qc}) |
| 1158 | response_out.append(response_dict) |
| 1159 | |
| 1160 | return response_out |
| 1161 | |
| 1162 | def evidence_comparison_stats(self, response): |
| 1163 |