mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
refactor(proxy_server.py): using celery workers instead of rq for concurrency
This commit is contained in:
parent
8c98a2c899
commit
b16646e584
6 changed files with 84 additions and 32 deletions
15
litellm/proxy/queue/celery_task.py
Normal file
15
litellm/proxy/queue/celery_task.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
from dotenv import load_dotenv
|
||||
load_dotenv()
|
||||
|
||||
import sys, os
|
||||
sys.path.insert(
|
||||
0, os.path.abspath("../../..")
|
||||
) # Adds the parent directory to the system path - for litellm local dev
|
||||
import litellm
|
||||
from litellm.proxy.queue.celery_app import celery_app
|
||||
|
||||
# Celery task
|
||||
@celery_app.task(name='process_job')
|
||||
def process_job(*args, **kwargs):
|
||||
llm_router: litellm.Router = litellm.Router(model_list=kwargs.pop("llm_model_list"))
|
||||
return llm_router.completion(*args, **kwargs)
|
Loading…
Add table
Add a link
Reference in a new issue