openai-php / client

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

Update CreateResponseFixture.php #145

Closed benbjurstrom closed 1 year ago

benbjurstrom commented 1 year ago

Thanks so much for getting the new function stuff added so quickly!

Found this minor issue while trying to write some tests using CreateResponse::fake. Without the function_call key in the fixture the content of functionCall in the faked response will always be null.

Tested with:

    $client = new ClientFake([
        CreateResponse::fake([
            'choices' => [
                [
                    'message' => [
                        'function_call' => [
                            'name' => 'get_current_weather',
                            'arguments' => "{\n  \"location\": \"Boston, MA\"\n}",
                        ],
                    ],
                    'finish_reason' => 'function_call'
                ],
            ],
        ]),
    ]);
gehrisandro commented 1 year ago

Thank you for the PR. 🚀