Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with await for language adapt #1925

Open
shawn-maxiao opened this issue Feb 14, 2025 · 1 comment
Open

Issues with await for language adapt #1925

shawn-maxiao opened this issue Feb 14, 2025 · 1 comment
Labels
bug Something isn't working module-testsetgen Module testset generation

Comments

@shawn-maxiao
Copy link

shawn-maxiao commented Feb 14, 2025

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

Describe the bug

I run the code flow with the help documents bellow,but one error happened.
https://docs.ragas.io/en/latest/howtos/customizations/testgenerator/_language_adaptation/

from ragas.testset.synthesizers.single_hop.specific import (
    SingleHopSpecificQuerySynthesizer,
)

distribution = [
    (SingleHopSpecificQuerySynthesizer(llm=generator_llm), 1.0),
]

for query, _ in distribution:
    prompts = await query.adapt_prompts("spanish", llm=generator_llm)
    query.set_prompts(**prompts)

Output

==========================
results:

    prompts = await query.adapt_prompts("spanish", llm=generator_llm)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: 'await' outside function



Ragas version: 0.2.13
Python version: 3.10.12

**Code to Reproduce**
from ragas.testset.synthesizers.single_hop.specific import (
    SingleHopSpecificQuerySynthesizer,
)

distribution = [
    (SingleHopSpecificQuerySynthesizer(llm=generator_llm), 1.0),
]

for query, _ in distribution:
    prompts = await query.adapt_prompts("spanish", llm=generator_llm)
    query.set_prompts(**prompts)


**Error trace**

    prompts = await query.adapt_prompts("spanish", llm=generator_llm)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: 'await' outside function
@shawn-maxiao shawn-maxiao added the bug Something isn't working label Feb 14, 2025
@dosubot dosubot bot added the module-testsetgen Module testset generation label Feb 14, 2025
@sahusiddharth
Copy link
Collaborator

Hi @shawn-maxiao,

I couldn't reproduce the error on my end. I'm using Python 3.10.14 and Ragas 0.2.13. Could you try reinstalling the Ragas package and see if that helps?

from ragas.testset.synthesizers.single_hop.specific import (
    SingleHopSpecificQuerySynthesizer,
)

distribution = [
    (SingleHopSpecificQuerySynthesizer(llm=generator_llm), 1.0),
]

for query, _ in distribution:
    prompts = await query.adapt_prompts("spanish", llm=generator_llm)
    query.set_prompts(**prompts)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working module-testsetgen Module testset generation
Projects
None yet
Development

No branches or pull requests

2 participants