mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
fix: guard against empty choices and message=None in load test proxy
This commit is contained in:
parent
cf9b5e4fa7
commit
f3ff56ca2b
1 changed files with 2 additions and 0 deletions
|
|
@ -97,6 +97,8 @@ def make_openai_completion(question):
|
|||
end_time = time.time()
|
||||
|
||||
# Log the request details
|
||||
if not response.choices or response.choices[0].message is None:
|
||||
raise ValueError("LLM returned empty or filtered response")
|
||||
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"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue