File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
src/store/src/Bridge/ChromaDb Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -57,13 +57,22 @@ public function add(VectorDocument ...$documents): void
5757 */
5858 public function query (Vector $ vector , array $ options = []): iterable
5959 {
60+ $ include ??= ['embeddings ' , 'metadatas ' , 'distances ' ];
61+ if ([] !== ($ options ['include ' ] ?? [])) {
62+ $ include = array_values (
63+ array_unique (
64+ array_merge ($ include , $ options ['include ' ])
65+ )
66+ );
67+ }
68+
6069 $ collection = $ this ->client ->getOrCreateCollection ($ this ->collectionName );
6170 $ queryResponse = $ collection ->query (
6271 queryEmbeddings: [$ vector ->getData ()],
6372 nResults: 4 ,
6473 where: $ options ['where ' ] ?? null ,
6574 whereDocument: $ options ['whereDocument ' ] ?? null ,
66- include : $ options [ ' include ' ] ?? null ,
75+ include : $ include ,
6776 );
6877
6978 $ metaCount = \count ($ queryResponse ->metadatas [0 ]);
You can’t perform that action at this time.
0 commit comments