feat(utils.py): json logs for raw request sent by litellm

make it easier to view verbose logs in datadog
This commit is contained in:
Krrish Dholakia 2024-04-29 19:21:19 -07:00
parent f0e48cdd53
commit b46db8b891
5 changed files with 18 additions and 7 deletions

View file

@ -23,6 +23,14 @@ response = completion(model="gpt-3.5-turbo", messages=messages)
response = completion("command-nightly", messages)
```
## JSON Logs
If you need to store the logs as JSON, just set the `litellm.json_logs = True`.
We currently just log the raw POST request from litellm as a JSON - [**See Code**].
[Share feedback here](https://github.com/BerriAI/litellm/issues)
## Logger Function
But sometimes all you care about is seeing exactly what's getting sent to your api call and what's being returned - e.g. if the api call is failing, why is that happening? what are the exact params being set?