Skip to content

Commit d31ae5f

Browse files
committed
openaiphp phpunit failure fix
1 parent 3f003f3 commit d31ae5f

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)