openai-php / client

⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.
MIT License
4.98k stars 519 forks source link

[Bug]: Logprobs property is missing in Chat\CreateResponseChoice #455

Open GubaEvgeniy opened 4 months ago

GubaEvgeniy commented 4 months ago

Description

As you can see in the legacy Completion method, support for logprobs is included: https://github.com/openai-php/client/blob/e9ca2886aa9c0bf60fb3b8df00ad9e5b876a0916/src/Responses/Completions/CreateResponseChoice.php#L12

However, in the current Chat method, support for logprobs is completely missing: https://github.com/openai-php/client/blob/e9ca2886aa9c0bf60fb3b8df00ad9e5b876a0916/src/Responses/Chat/CreateResponseChoice.php#L7

Please rectify this situation and add support for logprobs to Chat. Thank you.

Steps To Reproduce

  1. Define a chat request as documented, specifying support for logprobs:

    $response = $client->chat()->create([
    'model' => 'gpt-3.5-turbo',
    'messages' => [
        ['role' => 'user', 'content' => 'Hello!'],
    ],
    'logprobs' => true,
    ]);
  2. Receive a response from the API that includes a logprobs array in choices.

    Снимок экрана 2024-07-22 в 14 52 40
  3. This attribute is missing from the CreateResponseChoice object - https://github.com/openai-php/client/blob/e9ca2886aa9c0bf60fb3b8df00ad9e5b876a0916/src/Responses/Chat/CreateResponseChoice.php#L7

OpenAI PHP Client Version

0.10.1

PHP Version

8.2

Notes

No response