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

Introduce Asynchronous Test for ApiManager Class #4033

Closed

Conversation

AndresCdo
Copy link
Contributor

@AndresCdo AndresCdo commented May 8, 2023

Background

In our current test suite for the ApiManager class, we have a test that checks if debug mode logs the response correctly. However, this test is synchronous, and we need to update it to be asynchronous to better align with our future plans of implementing an asynchronous response from the core. Although the asynchronous response is not implemented yet, it is important to prepare our test suite for the upcoming change.

Changes Made

  • Converted the existing test to be asynchronous using async def and the pytest-asyncio library.
  • Added the @pytest.mark.asyncio decorator to the test class.
  • Imported AsyncMock from unittest.mock and used it for the mock openai.ChatCompletion.create method.
  • Updated the test function to use await when calling api_manager_debug.create_chat_completion().

Documentation

There is no documentation added, but is probably will be needed an update.

Test Plan

A modification of the api_manager.py script, changing the chat_completition function to asynchronous, is needed.

PR Quality Checklist

  • My pull request is atomic and focuses on a single change.
  • I have thoroughly tested my changes with multiple different prompts.
  • I have considered potential risks and mitigations for my changes.
  • I have documented my changes clearly and comprehensively.
  • I have not snuck in any "extra" small tweaks changes

@vercel
Copy link

vercel bot commented May 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) May 8, 2023 9:50pm

@github-actions github-actions bot added the size/m label May 8, 2023
@AndresCdo
Copy link
Contributor Author

#3900

@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label May 12, 2023
@github-actions
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@AndresCdo AndresCdo closed this Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conflicts Automatically applied to PRs with merge conflicts size/m
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant