@@ -67,30 +67,26 @@ public function toArray(): array
6767 * @param number[][]|null $embeddings The embeddings of the items to add (optional).
6868 * @param array<string, array<string, mixed>>|null $metadatas The metadatas of the items to add (optional).
6969 * @param string[]|null $documents The documents of the items to add (optional).
70- * @param string[]|null $images The base64 encoded images of the items to add (optional).
7170 * @return void
7271 */
7372 public function add (
7473 array $ ids ,
7574 ?array $ embeddings = null ,
7675 ?array $ metadatas = null ,
7776 ?array $ documents = null ,
78- ?array $ images = null
7977 ): void {
8078 if (!empty ($ ids ) && $ ids [0 ] instanceof Record) {
8179 $ records = $ ids ;
8280 $ ids = [];
8381 $ embeddings = [];
8482 $ metadatas = [];
8583 $ documents = [];
86- $ images = [];
8784
8885 foreach ($ records as $ record ) {
8986 $ ids [] = $ record ->id ;
9087 $ embeddings [] = $ record ->embedding ;
9188 $ metadatas [] = $ record ->metadata ;
9289 $ documents [] = $ record ->document ;
93- $ images [] = $ record ->image ;
9490 }
9591 }
9692
@@ -99,7 +95,6 @@ public function add(
9995 embeddings: $ embeddings ,
10096 metadatas: $ metadatas ,
10197 documents: $ documents ,
102- images: $ images ,
10398 requireEmbeddingsOrDocuments: true ,
10499 );
105100
@@ -108,7 +103,6 @@ public function add(
108103 metadatas: $ validated ['metadatas ' ],
109104 ids: $ validated ['ids ' ],
110105 documents: $ validated ['documents ' ],
111- images: $ validated ['images ' ],
112106 );
113107
114108 $ this ->api ->addCollectionItems ($ this ->id , $ this ->database , $ this ->tenant , $ request );
@@ -121,30 +115,26 @@ public function add(
121115 * @param number[][]|null $embeddings The embeddings of the items to update (optional).
122116 * @param array<string, array<string, mixed>>|null $metadatas The metadatas of the items to update (optional).
123117 * @param string[]|null $documents The documents of the items to update (optional).
124- * @param string[]|null $images The base64 encoded images of the items to update (optional).
125118 *
126119 */
127120 public function update (
128121 array $ ids ,
129122 ?array $ embeddings = null ,
130123 ?array $ metadatas = null ,
131124 ?array $ documents = null ,
132- ?array $ images = null
133125 ) {
134126 if (!empty ($ ids ) && $ ids [0 ] instanceof Record) {
135127 $ records = $ ids ;
136128 $ ids = [];
137129 $ embeddings = [];
138130 $ metadatas = [];
139131 $ documents = [];
140- $ images = [];
141132
142133 foreach ($ records as $ record ) {
143134 $ ids [] = $ record ->id ;
144135 $ embeddings [] = $ record ->embedding ;
145136 $ metadatas [] = $ record ->metadata ;
146137 $ documents [] = $ record ->document ;
147- $ images [] = $ record ->image ;
148138 }
149139 }
150140
@@ -153,7 +143,6 @@ public function update(
153143 embeddings: $ embeddings ,
154144 metadatas: $ metadatas ,
155145 documents: $ documents ,
156- images: $ images ,
157146 requireEmbeddingsOrDocuments: false ,
158147 );
159148
@@ -162,7 +151,6 @@ public function update(
162151 ids: $ validated ['ids ' ],
163152 metadatas: $ validated ['metadatas ' ],
164153 documents: $ validated ['documents ' ],
165- images: $ validated ['images ' ],
166154 );
167155
168156 $ this ->api ->updateCollectionItems ($ this ->id , $ this ->database , $ this ->tenant , $ request );
@@ -175,30 +163,26 @@ public function update(
175163 * @param number[][]|null $embeddings The embeddings of the items to upsert (optional).
176164 * @param array<string, array<string, mixed>>|null $metadatas The metadatas of the items to upsert (optional).
177165 * @param string[]|null $documents The documents of the items to upsert (optional).
178- * @param string[]|null $images The base64 encoded images of the items to upsert (optional).
179166 *
180167 */
181168 public function upsert (
182169 array $ ids ,
183170 ?array $ embeddings = null ,
184171 ?array $ metadatas = null ,
185172 ?array $ documents = null ,
186- ?array $ images = null
187173 ): void {
188174 if (!empty ($ ids ) && $ ids [0 ] instanceof Record) {
189175 $ records = $ ids ;
190176 $ ids = [];
191177 $ embeddings = [];
192178 $ metadatas = [];
193179 $ documents = [];
194- $ images = [];
195180
196181 foreach ($ records as $ record ) {
197182 $ ids [] = $ record ->id ;
198183 $ embeddings [] = $ record ->embedding ;
199184 $ metadatas [] = $ record ->metadata ;
200185 $ documents [] = $ record ->document ;
201- $ images [] = $ record ->image ;
202186 }
203187 }
204188
@@ -207,7 +191,6 @@ public function upsert(
207191 embeddings: $ embeddings ,
208192 metadatas: $ metadatas ,
209193 documents: $ documents ,
210- images: $ images ,
211194 requireEmbeddingsOrDocuments: true ,
212195 );
213196
@@ -216,7 +199,6 @@ public function upsert(
216199 metadatas: $ validated ['metadatas ' ],
217200 ids: $ validated ['ids ' ],
218201 documents: $ validated ['documents ' ],
219- images: $ validated ['images ' ],
220202 );
221203
222204 $ this ->api ->upsertCollectionItems ($ this ->id , $ this ->database , $ this ->tenant , $ request );
@@ -307,7 +289,6 @@ public function delete(?array $ids = null, ?array $where = null, ?array $whereDo
307289 *
308290 * @param number[][]|null $queryEmbeddings The embeddings of the query (optional).
309291 * @param string[]|null $queryTexts The texts of the query (optional).
310- * @param string[]|null $queryImages The images of the query (optional).
311292 * @param int $nResults The number of results to return (optional).
312293 * @param ?array $where The where clause to filter items to search based on metadata values (optional).
313294 * @param ?array $whereDocument The where clause to filter to search based on document content (optional).
@@ -316,7 +297,6 @@ public function delete(?array $ids = null, ?array $where = null, ?array $whereDo
316297 public function query (
317298 ?array $ queryEmbeddings = null ,
318299 ?array $ queryTexts = null ,
319- ?array $ queryImages = null ,
320300 int $ nResults = 10 ,
321301 ?array $ where = null ,
322302 ?array $ whereDocument = null ,
@@ -331,10 +311,10 @@ public function query(
331311 }
332312
333313 if (
334- !(($ queryEmbeddings != null xor $ queryTexts != null xor $ queryImages != null ))
314+ !(($ queryEmbeddings != null xor $ queryTexts != null ))
335315 ) {
336316 throw new InvalidArgumentException (
337- 'You must provide only one of queryEmbeddings, queryTexts, queryImages, or queryUris '
317+ 'You must provide only one of queryEmbeddings or queryTexts '
338318 );
339319 }
340320
@@ -347,11 +327,9 @@ public function query(
347327 );
348328 } elseif ($ queryTexts != null ) {
349329 $ finalEmbeddings = $ this ->embeddingFunction ->generate ($ queryTexts );
350- } elseif ($ queryImages != null ) {
351- $ finalEmbeddings = $ this ->embeddingFunction ->generate ($ queryImages );
352330 } else {
353331 throw new InvalidArgumentException (
354- 'If you did not provide embeddings , you must provide documents or images '
332+ 'If you did not provide queryEmbeddings , you must provide queryTexts '
355333 );
356334 }
357335 } else {
@@ -408,21 +386,20 @@ public function setEmbeddingFunction(EmbeddingFunction $embeddingFunction): void
408386 /**
409387 * Validates the inputs to the add, upsert, and update methods.
410388 *
411- * @return array{ids: string[], embeddings: int[][], metadatas: array[], documents: string[], images: string[], uris: string[] }
389+ * @return array{ids: string[], embeddings: int[][], metadatas: array[], documents: string[]}
412390 */
413391 protected function validate (
414392 array $ ids ,
415393 ?array $ embeddings ,
416394 ?array $ metadatas ,
417395 ?array $ documents ,
418- ?array $ images ,
419396 bool $ requireEmbeddingsOrDocuments
420397 ): array {
421398
422399 if ($ requireEmbeddingsOrDocuments ) {
423- if ($ embeddings === null && $ documents === null && $ images === null ) {
400+ if ($ embeddings === null && $ documents === null ) {
424401 throw new InvalidArgumentException (
425- 'You must provide embeddings, documents, or images '
402+ 'You must provide embeddings or documents '
426403 );
427404 }
428405 }
@@ -431,10 +408,9 @@ protected function validate(
431408 $ embeddings != null && count ($ embeddings ) != count ($ ids )
432409 || $ metadatas != null && count ($ metadatas ) != count ($ ids )
433410 || $ documents != null && count ($ documents ) != count ($ ids )
434- || $ images != null && count ($ images ) != count ($ ids )
435411 ) {
436412 throw new InvalidArgumentException (
437- 'The number of ids, embeddings, metadatas, documents, and images must be the same '
413+ 'The number of ids, embeddings, metadatas, and documents must be the same '
438414 );
439415 }
440416
@@ -459,11 +435,9 @@ protected function validate(
459435 );
460436 } elseif ($ documents != null ) {
461437 $ finalEmbeddings = $ this ->embeddingFunction ->generate ($ documents );
462- } elseif ($ images != null ) {
463- $ finalEmbeddings = $ this ->embeddingFunction ->generate ($ images );
464438 } else {
465439 throw new InvalidArgumentException (
466- 'If you did not provide embeddings, you must provide documents or images '
440+ 'If you did not provide embeddings, you must provide documents '
467441 );
468442 }
469443 } else {
@@ -517,7 +491,6 @@ protected function validate(
517491 'embeddings ' => $ finalEmbeddings ,
518492 'metadatas ' => $ metadatas ,
519493 'documents ' => $ documents ,
520- 'images ' => $ images ,
521494 ];
522495 }
523496}
0 commit comments