Skip to content

docs: change query execution to use asyncio.run - #2532

Merged
anistark merged 1 commit into
vibrantlabsai:mainfrom
yangzq50:fix-doc
Dec 22, 2025
Merged

docs: change query execution to use asyncio.run#2532
anistark merged 1 commit into
vibrantlabsai:mainfrom
yangzq50:fix-doc

Conversation

@yangzq50

@yangzq50 yangzq50 commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

Updated the query execution to run asynchronously using asyncio.

Issue Link / Problem Description

The issue on line 49 of the file docs/howtos/applications/evaluate-and-improve-rag.md is that it uses the await keyword at the top level of the script.

Description of the Issue:

In Python, the await keyword is only allowed within an asynchronous function (defined with async def). When the code snippet provided in the documentation is run as a standard Python script (e.g., python script.py), it will fail with the following error:
SyntaxError: 'await' outside function

Context (Lines 33–51):

The code block imports asyncio (line 35) but fails to use it to execute the asynchronous rag.query() method.

Changes Made

To make the script runnable, the asynchronous logic should be executed using asyncio.run():

# Query the system
question = "What architecture is the `tokenizers-linux-x64-musl` binary designed for?"
result = asyncio.run(rag.query(question))
print(f"Answer: {result['answer']}")

Testing

How to Test

  • Manual testing

References

  • Related issues:
  • Documentation:
  • External references:

Screenshots/Examples (if applicable)


Updated the query execution to run asynchronously using asyncio.
@yangzq50 yangzq50 changed the title Change query execution to use asyncio.run docs: change query execution to use asyncio.run Dec 22, 2025

@anistark anistark left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @yangzq50 for the fix. 🙌🏼

@anistark
anistark merged commit c5369fa into vibrantlabsai:main Dec 22, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants