updates to logging

This commit is contained in:
Krrish Dholakia 2023-09-01 14:38:50 -07:00
parent 58c15d11cc
commit 34ed4cc23c
5 changed files with 56 additions and 40 deletions

View file

@ -184,21 +184,22 @@ class LiteDebugger:
data=json.dumps(litellm_data_obj),
)
elif call_type == "completion" and stream == True:
litellm_data_obj = {
"response_time": response_time,
"total_cost": total_cost,
"response": "streamed response",
"litellm_call_id": litellm_call_id,
"status": "success",
}
print_verbose(
f"LiteDebugger: Logging - final data object: {litellm_data_obj}"
)
response = requests.post(
url=self.api_url,
headers={"content-type": "application/json"},
data=json.dumps(litellm_data_obj),
)
if len(response_obj["content"]) > 0: # don't log the empty strings
litellm_data_obj = {
"response_time": response_time,
"total_cost": total_cost,
"response": response_obj["content"],
"litellm_call_id": litellm_call_id,
"status": "success",
}
print_verbose(
f"LiteDebugger: Logging - final data object: {litellm_data_obj}"
)
response = requests.post(
url=self.api_url,
headers={"content-type": "application/json"},
data=json.dumps(litellm_data_obj),
)
elif "error" in response_obj:
if "Unable to map your input to a model." in response_obj["error"]:
total_cost = 0