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

Upgrade openai-php/client #9

Closed
wants to merge 1 commit into from
Closed

Conversation

OskarStark
Copy link

No description provided.

Copy link
Collaborator

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @OskarStark

Copy link
Collaborator

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved too fast. There is a failing test.

@OskarStark
Copy link
Author

As the last commits from 11.08.2023, not sure it's failing due to the PR. I need to investigate.

@hmoreau
Copy link
Contributor

hmoreau commented Nov 14, 2023

It looks like that since version v0.7.0 of openai-php/client there is a new class for meta information that systematically gets the header x-request-id

/* file : Responses/Meta/MetaInformation.php */
     **
     * @param  array{x-request-id: string[], openai-model: string[], openai-organization: string[], openai-version: string[], openai-processing-ms: string[], x-ratelimit-limit-requests: string[], x-ratelimit-remaining-requests: string[], x-ratelimit-reset-requests: string[], x-ratelimit-limit-tokens: string[], x-ratelimit-remaining-tokens: string[], x-ratelimit-reset-tokens: string[]}  $headers
     */
    public static function from(array $headers): self
    {
        $requestId = $headers['x-request-id'][0];

I guess the fix would be to update the file tests/DependencyInjection/OpenAIExtensionTest.php adding a new x-request-id header to the MockResponse :

            return new MockResponse('{"id":"file.txt","object":"file","deleted":true}', [
                'http_code' => 200,
                'response_headers' => [
                    'content-type' => 'application/json',
                    'x-request-id' => '0123456789abcdef0123456789abcdef'
                ],
            ]);

It's just a wild guess, I have not tested it so far

@hmoreau hmoreau mentioned this pull request Nov 14, 2023
2 tasks
@OskarStark
Copy link
Author

Closing in favor of #10

@OskarStark OskarStark closed this Nov 14, 2023
@OskarStark OskarStark deleted the patch-1 branch November 14, 2023 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants