from llama_index.evaluation import FaithfulnessEvaluator
evaluator = FaithfulnessEvaluator(service_context=service_context)
response = flare_query_engine.query("Can you tell me about the author's trajectory in the startup world?")
response_str = response.response
for source_node in response.source_nodes:
eval_result = evaluator.evaluate(response=response_str, contexts=[source_node.get_content()])
print(str(eval_result.passing))
error:
RuntimeError Traceback (most recent call last)
<ipython-input-30-43b304ac96cc> in <cell line: 7>()
6 response_str = response.response
7 for source_node in response.source_nodes:
----> 8 eval_result = evaluator.evaluate(response=response_str, contexts=[source_node.get_content()])
9 print(str(eval_result.passing))
1 frames
/usr/lib/python3.10/asyncio/runners.py in run(main, debug)
31 """
32 if events._get_running_loop() is not None:
---> 33 raise RuntimeError(
34 "asyncio.run() cannot be called from a running event loop")
35
RuntimeError: asyncio.run() cannot be called from a running event loop