When I'm creating a fake chat response via CreateResponse.fake and I attempt to override the system fingerprint field, it is always set to null in the client's response. This means that I'm unable to use the fake method to test code that relies on system_fingerprint. The current workaround is to use CreateResponse.from and provide the full attributes array (including the system fingerprint).
Steps To Reproduce
<?php
use OpenAI\Responses\Chat\CreateResponse;
use OpenAI\Testing\ClientFake;
// Create a fake client and override the `system_fingerprint` field
$client = new ClientFake([
CreateResponse::fake([
'system_fingerprint' => 'abcxyz123'
]),
]);
// Make a call to the fake client
$response = $client->chat()->create([
'model' => 'gpt-4',
'messages' => [
['role' => 'system', 'content' => 'Some system prompt'],
['role' => 'user', 'content' => 'Some user prompt']
]
]);
// The response's system fingerprint property is `null`
var_dump($response->systemFingerprint);
OpenAI PHP Client Version
v0.8.0
PHP Version
8.1.24
Notes
It appears that because the system_fingerprint field isn't specified in the CreateResponseFixture, it can't be overwritten by Fakeable.buildAttributes. It seems that support for system_fingerprint was added in November, but it wasn't included in the fixture.
Description
When I'm creating a fake chat response via
CreateResponse.fake
and I attempt to override the system fingerprint field, it is always set tonull
in the client's response. This means that I'm unable to use thefake
method to test code that relies onsystem_fingerprint
. The current workaround is to useCreateResponse.from
and provide the full attributes array (including the system fingerprint).Steps To Reproduce
OpenAI PHP Client Version
v0.8.0
PHP Version
8.1.24
Notes
It appears that because the
system_fingerprint
field isn't specified in theCreateResponseFixture
, it can't be overwritten byFakeable.buildAttributes
. It seems that support forsystem_fingerprint
was added in November, but it wasn't included in the fixture.