mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 10:14:26 +00:00
(test) load test proxy
This commit is contained in:
parent
331fe86c8f
commit
b2c35bbd50
4 changed files with 1019 additions and 3 deletions
1004
cookbook/litellm_router/error_log.txt
Normal file
1004
cookbook/litellm_router/error_log.txt
Normal file
File diff suppressed because it is too large
Load diff
|
@ -82,14 +82,26 @@ def make_openai_completion(question):
|
|||
],
|
||||
}
|
||||
response = requests.post("http://0.0.0.0:8000/queue/request", json=data)
|
||||
print(response)
|
||||
response = response.json()
|
||||
end_time = time.time()
|
||||
|
||||
# Log the request details
|
||||
with open("request_log.txt", "a") as log_file:
|
||||
log_file.write(
|
||||
f"Question: {question[:100]}\nResponse ID:{response.id} Content:{response.choices[0].message.content[:10]}\nTime: {end_time - start_time:.2f} seconds\n\n"
|
||||
f"Question: {question[:100]}\nResponse ID: {response.get('id', 'N/A')} Url: {response.get('url', 'N/A')}\nTime: {end_time - start_time:.2f} seconds\n\n"
|
||||
)
|
||||
|
||||
# polling the url
|
||||
url = response["url"]
|
||||
polling_url = f"http://0.0.0.0:8000{url}"
|
||||
print(f"POLLING JOB{polling_url}")
|
||||
response = requests.get(polling_url)
|
||||
response = response.json()
|
||||
status = response["status"]
|
||||
print(f"POLLING JOB{polling_url}\nSTATUS: {status}, \n Response {response}")
|
||||
# if status == "finished":
|
||||
# print()
|
||||
|
||||
|
||||
|
||||
return response
|
||||
except Exception as e:
|
||||
|
|
0
cookbook/litellm_router/request_log.txt
Normal file
0
cookbook/litellm_router/request_log.txt
Normal file
0
cookbook/litellm_router/response_log.txt
Normal file
0
cookbook/litellm_router/response_log.txt
Normal file
Loading…
Add table
Add a link
Reference in a new issue