Repository: explodinggradients/ragas
Issue: ragas v0.1.17 raise Original column names {'contexts'} not in the dataset. 
Root cause: Configuration Error

[ ] I have checked the [documentation](https://docs.ragas.io/en/stable/howtos/applications/data_preparation.html) and related resources and couldn't resolve my bug.

**Only evaluate answer_correctness, answer_similarity. and datasets not include contexts, only  ['question', 'answer', 'ground_truth'],  it can work before 0.1.16**


Ragas version: v0.1.17
Python version: python10

**Code to Reproduce**
data_samples = {'question': ['When did Einstein born?',]'answer': ['Einstein was born in Germany.'],'ground_truth': ['Einstein was born in 1879 in Germany.']}
dataset = Dataset.from_dict(data_samples)
score = evaluate(dataset, metrics=[answer_correctness, answer_similarity])

**Error trace**
  File "D:\Program Files\Python310\lib\site-packages\datasets\arrow_dataset.py", line 2329, in rename_columns
    raise ValueError(
ValueError: Original column names {'contexts'} not in the dataset. Current columns in the dataset: ['question', 'answer', 'ground_truth']

**Expected behavior**
answer_correctness, answer_similarity not use contexts. why needs contexts
and it's work before v0.1.16






<!-- Answer -->
I found a similar open issue that might be relevant to your problem: [Recalculation of Answers and Contexts in evaluate Function](https://github.com/explodinggradients/ragas/issues/1211). The recalculation of answers and contexts in the `evaluate` function ensures that the evaluation is based on the most current and accurate responses generated by the query engine <sup>[[1]](https://github.com/explodinggradients/ragas/issues/1211)</sup>.

In Ragas v0.1.17, the `evaluate` function requires the 'contexts' column when using `answer_correctness` and `answer_similarity` metrics because these metrics depend on the context to score the RAG pipeline. This requirement is enforced by the `validate_required_columns` function, which ensures that all necessary columns are present in the dataset <sup>[[2]](https://github.com/explodinggradients/ragas/blob/main/src/ragas/evaluation.py)</sup><sup>[[3]](https://github.com/explodinggradients/ragas/blob/main/src/ragas/metrics/_answer_correctness.py)</sup>.

However, you can bypass this requirement by using the `column_map` parameter in the `evaluate` function to map the column names of your dataset to the expected column names. Here is an example:

```python
from ragas import evaluate
from datasets import Dataset

# Example dataset without 'contexts' column
data_samples = {
    'question': ['When did Einstein born?'],
    'answer': ['Einstein was born in Germany.'],
    'ground_truth': ['Einstein was born in 1879 in Germany.']
}
dataset = Dataset.from_dict(data_samples)

# Column mapping
column_map = {'contexts': 'ground_truth'}

# Evaluate the dataset
score = evaluate(dataset, metrics=[answer_correctness, answer_similarity], column_map=column_map)
print(score)
```

This way, you can map the 'contexts' column to 'ground_truth' and proceed with the evaluation <sup>[[2]](https://github.com/explodinggradients/ragas/blob/main/src/ragas/evaluation.py)</sup>.


<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*


@dosu it's not work. when I added
` column_map = {'contexts': 'ground_truth'}
score = evaluate(dataset, metrics=[answer_correctness, answer_similarity], column_map=column_map)
`
it's shows 
`  File "D:\Program Files\Python310\lib\site-packages\datasets\arrow_dataset.py", line 2329, in rename_columns
    raise ValueError(
ValueError: Original column names {'ground_truth'} not in the dataset. Current columns in the dataset: ['question', 'answer', 'contexts']`

<!-- Answer -->
The issue you're encountering is due to the `evaluate` function in Ragas v0.1.17 calling the `remap_column_names` function twice, which causes the column names to be overwritten and results in the `ValueError` you're seeing.

Here's a workaround to avoid this issue:

1. **Create a new dataset with the required columns:**
   Ensure that your dataset includes the columns expected by the `evaluate` function, such as `contexts`.

2. **Use the `column_map` parameter correctly:**
   Map your existing columns to the required columns.

Here is an example of how you can modify your code:

```python
from ragas import evaluate
from ragas.metrics import answer_correctness, answer_similarity
from datasets import Dataset

# Example dataset with the required columns
data_samples = {
    'question': ['When did Einstein born?'],
    'answer': ['Einstein was born in Germany.'],
    'ground_truth': ['Einstein was born in 1879 in Germany.']
}
dataset = Dataset.from_dict(data_samples)

# Column mapping
column_map = {
    'question': 'question',
    'answer': 'answer',
    'contexts': 'ground_truth',  # Map 'contexts' to 'ground_truth'
    'ground_truth': 'ground_truth'
}

# Evaluate the dataset
score = evaluate(dataset, metrics=[answer_correctness, answer_similarity], column_map=column_map)
print(score)
```

This should resolve the issue by ensuring that the `contexts` column is correctly mapped and included in the dataset. If the problem persists, it might be necessary to check if there are any additional constraints or requirements for the `evaluate` function in the latest version of Ragas <sup>[[1]](https://github.com/explodinggradients/ragas/blob/main/src/ragas/evaluation.py)</sup>.


<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*


Hey @landhu We are moving to a new data representation format to add support to metrics beyond RAG as per #1009 . We have to make sure that this transformation doesn't break any existing usage. But this should be a bug, I'll check it out and raise a fix soon. 

@landhu Just merged. Please install ragas from source for now to use changes from main