Hey I am facing same error did you solve the error please let me know
I am using code as
from ragas.llms import LangchainLLMWrapper
from ragas.embeddings import LangchainEmbeddingsWrapper
from langchain_community.embeddings import HuggingFaceEmbeddings
from langchain_community.chat_models.huggingface import ChatHuggingFace
from langchain.llms import HuggingFaceHub
embedding_model = HuggingFaceEmbeddings(model_name=“BAAI/bge-small-en-v1.5”)
hugging_llm = HuggingFaceHub(
repo_id=“HuggingFaceH4/zephyr-7b-beta”,
task=“text-generation”,
model_kwargs={
“max_new_tokens”: 512,
“top_k”: 30,
“temperature”: 0.1,
“repetition_penalty”: 1.03,
},
)
import nest_asyncio
nest_asyncio.apply()
from datasets import Dataset
import os
from ragas import evaluate
from ragas.metrics import faithfulness, answer_correctness
data_samples = {
‘question’: [‘When was the first super bowl?’, ‘Who won the most super bowls?’],
‘answer’: [‘The first superbowl was held on Jan 15, 1967’, ‘The most super bowls have been won by The New England Patriots’],
‘contexts’ : [[‘The First AFL–NFL World Championship Game was an American football game played on January 15, 1967, at the Los Angeles Memorial Coliseum in Los Angeles,’],
[‘The Green Bay Packers…Green Bay, Wisconsin.’,‘The Packers compete…Football Conference’]],
‘ground_truth’: [‘The first superbowl was held on January 15, 1967’, ‘The New England Patriots have won the Super Bowl a record six times’]
}
dataset = Dataset.from_dict(data_samples)
score = evaluate(dataset,metrics=[faithfulness,answer_correctness], llm=hugging_llm, embeddings = embedding_model )
score.to_pandas()
Output:
WARNING:ragas.llms.output_parser:Failed to parse output. Returning None.
WARNING:ragas.llms.output_parser:Failed to parse output. Returning None.
WARNING:ragas.llms.output_parser:Failed to parse output. Returning None.