File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -73,9 +73,9 @@ public function embed(string $text): array
7373 /**
7474 * @var array{
7575 * error?: string,
76- * embeddings? : array<int, array<int, float>>,
77- * total_duration? : int,
78- * load_duration? : int
76+ * embeddings: array<int, array<int, float>>,
77+ * total_duration: int,
78+ * load_duration: int
7979 * }|null $json
8080 */
8181 $ json = is_string ($ body ) ? json_decode ($ body , true ) : null ;
@@ -85,7 +85,7 @@ public function embed(string $text): array
8585 }
8686
8787 return [
88- 'embedding ' => $ json ['embeddings ' ][ 0 ],
88+ 'embedding ' => $ json ['embeddings ' ] ? $ json [ ' embeddings ' ][ 0 ] : [ ],
8989 'total_duration ' => $ json ['total_duration ' ] ?? null ,
9090 'load_duration ' => $ json ['load_duration ' ] ?? null ,
9191 ];
@@ -173,7 +173,7 @@ public function getName(): string
173173 */
174174 protected function formatErrorMessage ($ json ): string
175175 {
176- if (!is_array ($ json )) {
176+ if (! is_array ($ json )) {
177177 return '(unknown_error) Unknown error ' ;
178178 }
179179
You can’t perform that action at this time.
0 commit comments