Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why:
Introduces asynchronous client capabilities to handle OpenAPI interactions for improved performance and scalability. This enhancement addresses the need for async operations when working with APIs in a non-blocking fashion.
What:
AsyncOpenAPIClient
: A new asynchronous client class to perform OpenAPI operations.README.md
: Included documentation and examples for the newly introduced async client patterns.pyproject.toml
to includeaiohttp
for async HTTP client support.How can it be used:
The async client can be used in three main ways, as shown in the examples below:
Using async context manager:
Using setup/cleanup explicitly:
With a shared
aiohttp
session:How did you test it:
Unit and integration tests have been added, such as
test/test_openapi_client_live_openai_async.py
, which validate the async client's ability to handle API interactions under various scenarios, ensuring correct functionality and error handling.Notes for the reviewer:
Ensure environment variables like
OPENAI_API_KEY
andSERPERDEV_API_KEY
are set for the tests. Focus on the proper handling of async context management and the sessions' lifecycle within theAsyncOpenAPIClient
class.