From bf08bf8ae4cf5e9611540c4e37354470dad72677 Mon Sep 17 00:00:00 2001 From: Jason Liu Date: Fri, 5 Jan 2024 23:26:21 -0500 Subject: [PATCH] update usage --- docs/concepts/raw_response.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/concepts/raw_response.md b/docs/concepts/raw_response.md index 35afdc8..bc53528 100644 --- a/docs/concepts/raw_response.md +++ b/docs/concepts/raw_response.md @@ -23,6 +23,12 @@ user: UserExtract = client.chat.completions.create( print(user._raw_response) ``` +!!! tip "Accessing tokens usage" + + This is the recommended way to access the tokens usage, since it is a pydantic model you can use any of the pydantic model methods on it. For example, you can access the `total_tokens` by doing `user._raw_response.usage.total_tokens`. + + In the future, we may add additional hooks to the `raw_response` to make it easier to access the tokens usage. + **Output:** ```python