ragas icon indicating copy to clipboard operation
ragas copied to clipboard

why await no support from demo

Open landhu opened this issue 10 months ago • 2 comments

[ ] I have checked the documentation and related resources and couldn't resolve my bug.

Describe the bug run demo in https://docs.ragas.io/en/latest/getstarted/evals/#evaluating-using-a-llm-based-metric

Ragas version: Python version: 3.10 Ragas Version: ragas 0.2.13

Code to Reproduce same as demo

Error trace File "D:\PyInvo\ragas_demo.py", line 271 await metric.single_turn_ascore(SingleTurnSample(**test_data)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: 'await' outside function

And in my pycharm, also have error:

Image

Expected behavior A clear and concise description of what you expected to happen.

Additional context Add any other context about the problem here.

landhu avatar Feb 26 '25 12:02 landhu

Hi @landhu,

I tried reproducing the error with the same Python and Ragas versions, but I wasn't able to replicate the issue. Could you please share the full error trace or any additional context that might help identify the root cause?

sahusiddharth avatar Feb 27 '25 03:02 sahusiddharth

The code needs to be in inside aasync def function. See this pull request for an example https://github.com/explodinggradients/ragas/pull/1983

yesidc avatar Mar 27 '25 15:03 yesidc

thanks again @yesidc for raising this - we are closing this now

jjmachan avatar Sep 17 '25 15:09 jjmachan