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

Questions about using this project in a Flask app #3

Open
F1mc opened this issue Jul 15, 2023 · 1 comment
Open

Questions about using this project in a Flask app #3

F1mc opened this issue Jul 15, 2023 · 1 comment

Comments

@F1mc
Copy link

F1mc commented Jul 15, 2023

I am thrilled to have discovered this project - it has been tremendously helpful in dealing with the high volume of access requirements. However, it seems that the serving mode in the openai-manager project does not currently implement the ChatCompletion feature? This is my primary expected method of invocation.

In addition, I have built a simple Flask reverse proxy app for user access control and user-level usage control of API calls. Therefore, I'd like to modify my code to directly use the openai-manager within this Flask app to realize load-balancing for multiple APIs.

Being not very familiar with asynchronous programming in Python, I have a couple of questions I'd like to ask:

  1. In serving.py, does the GLOBAL_MANAGER only control the list of tasks submitted in a single submission, or all requests submitted over multiple submissions? In other words, can the current serving implementation properly handle multiple concurrent requests from a single source?

  2. Is it feasible to use asyncio.run() to call the submission function directly within a Flask app enabled for multi-threading?

Thank you in advance for your time and help.

@F1mc F1mc changed the title Questions about use this project in a Flask app Questions about using this project in a Flask app Jul 15, 2023
@MrZilinXiao
Copy link
Owner

Thanks for your interest! And yes, ChatCompletion is now only available for python package usage.

For your question:

  1. I would recommend you use a message queue backed with Redis for your specific usage, as this project only considers requests from ONE source.
  2. I am not sure the current Flask design allows calling external async functions. But yes, the most simple (but not elegant) way to work around it is to start a separate process for openai-manager.

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

No branches or pull requests

2 participants