Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Logprobs error #522

Open
wesly1988 opened this issue Feb 6, 2025 · 2 comments
Open

[Bug]: Logprobs error #522

wesly1988 opened this issue Feb 6, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@wesly1988
Copy link

Description

Since like two days I get the following error.

Undefined array key "logprobs" {"userId":3,"exception":"[object] (ErrorException(code: 0): Undefined array key \"logprobs\" at /var/www/html/vendor/openai-php/client/src/Responses/Completions/CreateResponseChoice.php:24)

Steps To Reproduce

OpenAi::completions()->create([ 'model' => 'gpt-3.5-turbo-instruct', 'prompt' => "This is a test", 'max_tokens' => 600, 'temperature' => 0 ]);

OpenAI PHP Client Version

0.10.2

PHP Version

8.2

Notes

No response

@wesly1988 wesly1988 added the bug Something isn't working label Feb 6, 2025
@wesly1988
Copy link
Author

Quick fix

File
vendor\openai-php\client\src\Responses\Completions\CreateResponseChoice.php

line 22
return new self( $attributes['text'], $attributes['index'], $attributes['logprobs'] ?? null ? CreateResponseChoiceLogprobs::from($attributes['logprobs']) : null, $attributes['finish_reason'], );

@tcgunel
Copy link

tcgunel commented Feb 6, 2025

I fixed it by sending logprobs => 0 while creating completions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants