(topn_relations, topn_scores, entity_id, head_relations)
| 90 | |
| 91 | |
| 92 | def clean_relations_bm25_sent(topn_relations, topn_scores, entity_id, head_relations): |
| 93 | relations = [] |
| 94 | if if_all_zero(topn_scores): |
| 95 | topn_scores = [float(1/len(topn_scores))] * len(topn_scores) |
| 96 | i=0 |
| 97 | for relation in topn_relations: |
| 98 | if relation in head_relations: |
| 99 | relations.append({"entity": entity_id, "relation": relation, "score": topn_scores[i], "head": True}) |
| 100 | else: |
| 101 | relations.append({"entity": entity_id, "relation": relation, "score": topn_scores[i], "head": False}) |
| 102 | i+=1 |
| 103 | return True, relations |
| 104 | |
| 105 | |
| 106 | def run_llm(prompt, temperature, max_tokens, opeani_api_keys, engine="gpt-3.5-turbo"): |
nothing calls this directly
no test coverage detected