Skip to content

Commit 082d535

Browse files
authored
openaiphp phpunit failure fix (#375)
1 parent 9392573 commit 082d535

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Instrumentation/OpenAIPHP/src/OpenAIPHPInstrumentation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ private static function hookApi(CachedInstrumentation $instrumentation, $class,
193193

194194
private static function recordUsage(SpanInterface $span, object $response, ContextInterface $context)
195195
{
196-
if (!property_exists($response, 'usage') || !method_exists($response->usage, 'toArray')) {
196+
if (!property_exists($response, 'usage') || !isset($response->usage) || !method_exists($response->usage, 'toArray')) {
197197
return;
198198
}
199199

0 commit comments

Comments
 (0)