File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ services:
1010 - ./src:/usr/src/code/src
1111 - ./tests:/usr/src/code/tests
1212 - ./phpunit.xml:/usr/src/code/phpunit.xml
13- - ./vendor:/usr/src/code/vendor
1413 environment :
1514 - TESTING=true
1615 - LLM_KEY_ANTHROPIC=${LLM_KEY_ANTHROPIC}
Original file line number Diff line number Diff line change @@ -104,7 +104,11 @@ abstract public function getSupportForEmbeddings(): bool;
104104 * Generate embedding for input text (must be implemented if getSupportForEmbeddings is true)
105105 *
106106 * @param string $text
107- * @return array
107+ * @return array{
108+ * embedding: array<int, float>,
109+ * total_duration: int|null,
110+ * load_duration: int|null
111+ * }
108112 */
109113 abstract public function embed (string $ text ): array ;
110114
Original file line number Diff line number Diff line change @@ -463,6 +463,14 @@ public function getSupportForEmbeddings(): bool
463463 return false ;
464464 }
465465
466+ /**
467+ * @param string $text
468+ * @return array{
469+ * embedding: array<int, float>,
470+ * total_duration: int|null,
471+ * load_duration: int|null
472+ * }
473+ */
466474 public function embed (string $ text ): array
467475 {
468476 throw new \Exception ('Embeddings are not supported for this adapter. ' );
Original file line number Diff line number Diff line change @@ -323,6 +323,14 @@ public function getSupportForEmbeddings(): bool
323323 return false ;
324324 }
325325
326+ /**
327+ * @param string $text
328+ * @return array{
329+ * embedding: array<int, float>,
330+ * total_duration: int|null,
331+ * load_duration: int|null
332+ * }
333+ */
326334 public function embed (string $ text ): array
327335 {
328336 throw new \Exception ('Embeddings are not supported for this adapter. ' );
Original file line number Diff line number Diff line change @@ -354,6 +354,14 @@ public function getSupportForEmbeddings(): bool
354354 return false ;
355355 }
356356
357+ /**
358+ * @param string $text
359+ * @return array{
360+ * embedding: array<int, float>,
361+ * total_duration: int|null,
362+ * load_duration: int|null
363+ * }
364+ */
357365 public function embed (string $ text ): array
358366 {
359367 throw new \Exception ('Embeddings are not supported for this adapter. ' );
Original file line number Diff line number Diff line change @@ -52,12 +52,11 @@ public function __construct(
5252 * Embedding generation (Ollama only supports embeddings, not chat)
5353 *
5454 * @param string $text
55- * @return array
56- * [
57- * 'embedding' => array<float>,
58- * 'total_duration' => int,
59- * 'load_duration' => int
60- * ]
55+ * @return array{
56+ * embedding: array<int, float>,
57+ * total_duration: int|null,
58+ * load_duration: int|null
59+ * }
6160 *
6261 * @throws \Exception
6362 */
@@ -132,7 +131,7 @@ public function setModel(string $model): self
132131 /**
133132 * Not applicable for embedding-only adapters.
134133 *
135- * @param array $messages
134+ * @param array<\Utopia\Agents\Message> $messages
136135 * @param callable|null $listener
137136 *
138137 * @throws \Exception
Original file line number Diff line number Diff line change @@ -420,6 +420,14 @@ public function getSupportForEmbeddings(): bool
420420 return false ;
421421 }
422422
423+ /**
424+ * @param string $text
425+ * @return array{
426+ * embedding: array<int, float>,
427+ * total_duration: int|null,
428+ * load_duration: int|null
429+ * }
430+ */
423431 public function embed (string $ text ): array
424432 {
425433 throw new \Exception ('Embeddings are not supported for this adapter. ' );
Original file line number Diff line number Diff line change @@ -214,6 +214,14 @@ protected function sanitizeHtmlError(string $html): string
214214 return '(html_error) Received HTML error response from API ' ;
215215 }
216216
217+ /**
218+ * @param string $text
219+ * @return array{
220+ * embedding: array<int, float>,
221+ * total_duration: int|null,
222+ * load_duration: int|null
223+ * }
224+ */
217225 public function embed (string $ text ): array
218226 {
219227 throw new \Exception ('Embeddings are not supported for this adapter. ' );
Original file line number Diff line number Diff line change @@ -164,6 +164,14 @@ protected function formatErrorMessage($json): string
164164 return '( ' .$ errorType .') ' .$ errorMessage ;
165165 }
166166
167+ /**
168+ * @param string $text
169+ * @return array{
170+ * embedding: array<int, float>,
171+ * total_duration: int|null,
172+ * load_duration: int|null
173+ * }
174+ */
167175 public function embed (string $ text ): array
168176 {
169177 throw new \Exception ('Embeddings are not supported for this adapter. ' );
Original file line number Diff line number Diff line change @@ -141,7 +141,11 @@ public function setSchema(Schema $schema): self
141141 * Get embedding for input text using underlying adapter (if supported)
142142 *
143143 * @param string $text
144- * @return array
144+ * @return array{
145+ * embedding: array<int, float>,
146+ * total_duration: int|null,
147+ * load_duration: int|null
148+ * }
145149 *
146150 * @throws \Exception
147151 */
@@ -150,8 +154,7 @@ public function embed(string $text): array
150154 if (! $ this ->adapter ->getSupportForEmbeddings ()) {
151155 throw new \Exception ('This adapter does not support embedding/embedding API. ' );
152156 }
153- // Delegates to adapter embed; guaranteed to exist for supporting adapters.
154- // @phpstan-ignore-next-line: mixed adapter return
157+
155158 return $ this ->adapter ->embed ($ text );
156159 }
157160}
You can’t perform that action at this time.
0 commit comments