mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
fix(proxy/utils.py): batch writing updates to db
This commit is contained in:
parent
1618751824
commit
1b10123f07
3 changed files with 141 additions and 217 deletions
|
@ -7,6 +7,7 @@ from dotenv import load_dotenv
|
|||
|
||||
litellm_client = AsyncOpenAI(base_url="http://0.0.0.0:4000", api_key="sk-1234")
|
||||
|
||||
|
||||
async def litellm_completion():
|
||||
# Your existing code for litellm_completion goes here
|
||||
try:
|
||||
|
@ -18,6 +19,7 @@ async def litellm_completion():
|
|||
"content": f"{text}. Who was alexander the great? {uuid.uuid4()}",
|
||||
}
|
||||
],
|
||||
user="my-new-end-user-1",
|
||||
)
|
||||
return response
|
||||
|
||||
|
@ -29,9 +31,9 @@ async def litellm_completion():
|
|||
|
||||
|
||||
async def main():
|
||||
for i in range(6):
|
||||
for i in range(3):
|
||||
start = time.time()
|
||||
n = 20 # Number of concurrent tasks
|
||||
n = 10 # Number of concurrent tasks
|
||||
tasks = [litellm_completion() for _ in range(n)]
|
||||
|
||||
chat_completions = await asyncio.gather(*tasks)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue