Error while using "await" keyword with generate_async() function #102
Unanswered
Rishab9991
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When trying to reproduce the following snippet as a .py file from the "grounding_rail" sample:
**
from nemoguardrails.rails import LLMRails, RailsConfig
config = RailsConfig.from_path(".")
app = LLMRails(config, verbose=False)
history = [{"role": "user", "content": "What was the last month's unemployment rate?"}]
bot_message = await app.generate_async(messages=history)
print(bot_message['content'])
**
The Error I am getting is this:
"SyntaxError: 'await' outside function"
I have tried to search online but was unable to get a Proper resolution. How do I resolve this Error? Thanks for your support
Beta Was this translation helpful? Give feedback.
All reactions