client icon indicating copy to clipboard operation
client copied to clipboard

[Bug]: CreateResponseUsage is missing support for Prompt Caching

Open CyntaxDotDev opened this issue 2 years ago • 1 comments

Description

\OpenAI\Responses\Chat\CreateResponseUsage doesn't honor the Prompt Caching return which causes confusion that ChatGPT isn't 'activating' Prompt Caching (perhaps due to a unsupportive model).

{"prompt_tokens":1669,"completion_tokens":526,"total_tokens":2195,"prompt_tokens_details":{"cached_tokens":1152},"completion_tokens_details":{"reasoning_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}}

Steps To Reproduce

Simply produce a request to chat/completions (chat()->create([])).

OpenAI PHP Client Version

v0.10.2

PHP Version

8.3.10

Notes

No response

CyntaxDotDev avatar Nov 05 '24 08:11 CyntaxDotDev

Implemented in https://github.com/openai-php/client/pull/494

gehrisandro avatar Nov 12 '24 20:11 gehrisandro