From aee32d6a4bdfa2f377434fe8ba29232fa236648d Mon Sep 17 00:00:00 2001 From: allantra Date: Mon, 7 Apr 2025 08:59:33 -0600 Subject: [PATCH] Update CreateResponse.php --- src/Responses/Chat/CreateResponse.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Responses/Chat/CreateResponse.php b/src/Responses/Chat/CreateResponse.php index 87aa8fba..6d94dbbd 100644 --- a/src/Responses/Chat/CreateResponse.php +++ b/src/Responses/Chat/CreateResponse.php @@ -47,16 +47,16 @@ public static function from(array $attributes, MetaInformation $meta): self { $choices = array_map(fn (array $result): CreateResponseChoice => CreateResponseChoice::from( $result - ), $attributes['choices']); + ), $attributes['choices'] ?? []); return new self( $attributes['id'] ?? null, - $attributes['object'], - $attributes['created'], - $attributes['model'], + $attributes['object'] ?? '', + $attributes['created'] ?? 0, + $attributes['model'] ?? '', $attributes['system_fingerprint'] ?? null, $choices, - CreateResponseUsage::from($attributes['usage']), + CreateResponseUsage::from($attributes['usage'] ?? []), $meta, ); }