Repository: explodinggradients/ragas
Issue: Cannot import name 'AspectCriticWithReference' from 'ragas.metrics'
Root cause: Documentation Deficiency

[X] I have checked the [documentation](https://docs.ragas.io/) and related resources and couldn't resolve my bug.

**Describe the bug**
I'm getting the error   from ragas.metrics import AspectCriticWithReference

ImportError: cannot import name 'AspectCriticWithReference' from 'ragas.metrics'

Ragas version: 0.2.12
Python version: 3.10

**Code to Reproduce**

`import asyncio  # Import asyncio to run async functions
from ragas.dataset_schema import SingleTurnSample
from ragas.metrics import AspectCriticWithReference
from langchain_openai import ChatOpenAI
from dotenv import load_dotenv

load_dotenv()

sample = SingleTurnSample(
    user_input="Where is the Eiffel Tower located?",
    response="The Eiffel Tower is located in Paris.",
    reference="The Eiffel Tower is located in Paris.",
)

llm = ChatOpenAI(model="gpt-4o-mini")
evaluator_llm = LangchainLLMWrapper(llm)

scorer = AspectCriticWithReference(  # Correct class name
    name="correctness",
    definition="Is the response factually similar to the reference?",
    llm=evaluator_llm
)

async def main():
    score = await scorer.single_turn_ascore(sample)
    print("Correctness Score:", score)
    print("Correctness reasoning:", score.traces[0]["correctness"])

asyncio.run(main())`

**Error trace**

**Expected behavior**
I want to get the reasoning field behind the evaluation score.



<!-- PS: bugs suck but is also part of the process. We sincerely apologies for breaking your flow because of it, but don't worry, we got your back ❤️. We will get this fixed as fast as we can and thanks for helping us out by reporting it 🙏. -->


Hi @laurafbec,

It looks like you're using the wrong class for import. Please use `AspectCritic` instead of `AspectCriticWithReference`. To understand the reason for this, you can refer to the Ragas app setup guide [here](https://docs.ragas.io/en/stable/getstarted/evals/#analyzing-results) and the code reference below.

```py
from ragas.dataset_schema import SingleTurnSample
from ragas.metrics import AspectCritic
from ragas import evaluate
from ragas.dataset_schema import EvaluationDataset

sample = SingleTurnSample(
    user_input="Where is the Eiffel Tower located?",
    response="The Eiffel Tower is located in Paris.",
)

scorer = AspectCritic(  # Correct class name
    name="correctness",
    definition="Is the response factually similar to the reference?",
    llm=evaluator_llm
)

result = evaluate(dataset=EvaluationDataset([sample]), metrics=[scorer])

result.upload()
```

It will look something like this

<img width="1440" alt="Image" src="https://github.com/user-attachments/assets/55ad6c71-4093-4367-a184-b84d1842e1b1" />

Thanks @sahusiddharth!! It works perfect now! I was following the example included [here](https://docs.ragas.io/en/latest/howtos/applications/_metrics_llm_calls/#evaluation)! thanks again!

Thank you, @laurafbec, for pointing that out. I’ll raise a PR to fix it right away.

Excuse me @sahusiddharth, is there any problem to evaluate with the GPT-4 model instead of gpt-4o-mini? I'm getting some output parsing failures when trying with the first. Thanks again!

Hi @laurafbec,

I looked into it, and it worked perfectly fine for me. Could you please share the error trace so I can better understand the issue?

```py
from ragas.dataset_schema import SingleTurnSample
from ragas.metrics import AspectCritic
from ragas import evaluate
from ragas.dataset_schema import EvaluationDataset

sample = SingleTurnSample(
    user_input="Where is the Eiffel Tower located?",
    response="The Eiffel Tower is located in Paris.",
)

scorer = AspectCritic(  # Correct class name
    name="correctness",
    definition="Is the response factually similar to the reference?",
    llm=LangchainLLMWrapper(ChatOpenAI(model="gpt-4o"))
)

result = evaluate(dataset=EvaluationDataset([sample]), metrics=[scorer])
result
```
Output
```
Evaluating: 100%|██████████| 1/1 [00:02<00:00,  2.04s/it]
{'correctness': 1.0000}
```

you are right @sahusiddharth! I have some problems with RubricsScore evaluation with GPT-4, but I can use GPT4-o instead.
Thanks!