-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
[ ] I have checked the documentation and related resources and couldn't resolve my bug.
Describe the bug
I am using langchain for my agent. I have been able to implement the system that I get the answers and contexts for my inputs which I have added to the ground truths to create a whole dataframe. I have created an eval set using the from_pandas method which works fine. But when I run the evaluate method, I get the error:
ValidationError: 1 validation error for SingleTurnSample
retrieved_contexts
value is not a valid list (type=type_error.list)
Ragas version: 0.1.18
Python version: 3.10.12
Code to Reproduce
from datasets import Dataset
eval_dataset = Dataset.from_pandas(df)
eval_dataset
error side
scores = evaluate(
eval_dataset,
metrics=[context_recall, context_precision, faithfulness, answer_correctness],
llm = llm,
embeddings=GoogleGenerativeAIEmbeddings(google_api_key="changedtoprotectmyapiFcQZJa-E-QJOxyjK_X8rpBkIQ", model="models/embedding-001"),
)
scores
Error trace
339 values, fields_set, validation_error = validate_model(pydantic_self.class, data)
340 if validation_error:
--> 341 raise validation_error
342 try:
343 object_setattr(pydantic_self, 'dict', values)
ValidationError: 1 validation error for SingleTurnSample
retrieved_contexts
value is not a valid list (type=type_error.list)
Expected behavior
I wanted it run smoothly, performing the evaluation for me.
Additional context
So yeah, every side of my code runs, making me create a Dataset({
features: ['question', 'contexts', 'answer', 'reference'],
num_rows: 4
But running the evaluate method brings the issues up there
})