from llama_index.llms.ollama import Ollama from llama_index.core import Settings Settings.llm = Ollama(model="llama2", request_timeout=60.0)
# gpt-4 || CHANGE it to your llm gpt4 = OpenAI(temperature=0, model="gpt-4") # PASS YOUR llm object here evaluator_gpt4 = FaithfulnessEvaluator(llm=gpt4)
# attach to the same event-loop
import nest_asyncio
nest_asyncio.apply()
from llama_index.core.evaluation import FaithfulnessEvaluator
evaluator = FaithfulnessEvaluator(llm=llm)
evaluator.evaluate_response(response=response)