test_entity_bfp_recall.py 705 B

12345678910111213141516171819
  1. import json
  2. import asyncio
  3. from foundation.ai.rag.retrieval.retrieval import retrieval_manager
  4. from foundation.observability.monitoring.time_statistics import track_execution_time
  5. entity = "架桥机"
  6. search_keywords = ["提梁机", "架桥设备", "造桥机"]
  7. background = "JQ220t-40m架桥机安装及拆除"
  8. @track_execution_time
  9. def main():
  10. entity_list = asyncio.run(retrieval_manager.entity_recall(entity,search_keywords,top_k=5))
  11. bfp_result = asyncio.run(retrieval_manager.async_bfp_recall(entity_list,background,top_k=10))
  12. with open("temp\entity_bfp_recall\entity_bfp_recall.json", "w", encoding="utf-8") as f:
  13. json.dump(bfp_result, f, ensure_ascii=False, indent=4)
  14. main()