mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-08 22:42:05 +00:00
@@ -2161,16 +2161,18 @@ def _create_usage_metadata(oai_token_usage: dict) -> UsageMetadata:
|
||||
output_tokens = oai_token_usage.get("completion_tokens", 0)
|
||||
total_tokens = oai_token_usage.get("total_tokens", input_tokens + output_tokens)
|
||||
input_token_details: dict = {
|
||||
"audio": oai_token_usage.get("prompt_tokens_details", {}).get("audio_tokens"),
|
||||
"cache_read": oai_token_usage.get("prompt_tokens_details", {}).get(
|
||||
"audio": (oai_token_usage.get("prompt_tokens_details") or {}).get(
|
||||
"audio_tokens"
|
||||
),
|
||||
"cache_read": (oai_token_usage.get("prompt_tokens_details") or {}).get(
|
||||
"cached_tokens"
|
||||
),
|
||||
}
|
||||
output_token_details: dict = {
|
||||
"audio": oai_token_usage.get("completion_tokens_details", {}).get(
|
||||
"audio": (oai_token_usage.get("completion_tokens_details") or {}).get(
|
||||
"audio_tokens"
|
||||
),
|
||||
"reasoning": oai_token_usage.get("completion_tokens_details", {}).get(
|
||||
"reasoning": (oai_token_usage.get("completion_tokens_details") or {}).get(
|
||||
"reasoning_tokens"
|
||||
),
|
||||
}
|
||||
|
Reference in New Issue
Block a user