Skip to content

Commit cb029e5

Browse files
committed
genapi js
1 parent f60a76e commit cb029e5

File tree

2 files changed

+71
-5
lines changed

2 files changed

+71
-5
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/new-js/packages/chromadb/src/api/types.gen.ts

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export type GetUserIdentityResponse = {
195195
};
196196

197197
export type HashMap = {
198-
[key: string]: boolean | number | string | SparseVector | null;
198+
[key: string]: boolean | number | string | SparseVector | null;
199199
};
200200

201201
export type HeartbeatResponse = {
@@ -244,6 +244,72 @@ export type IntValueType = {
244244
int_inverted_index?: null | IntInvertedIndexType;
245245
};
246246

247+
/**
248+
* Represents a field key in search queries.
249+
*
250+
* Used for both selecting fields to return and building filter expressions.
251+
* Predefined keys access special fields, while custom keys access metadata.
252+
*
253+
* # Predefined Keys
254+
*
255+
* - `Key::Document` - Document text content (`#document`)
256+
* - `Key::Embedding` - Vector embeddings (`#embedding`)
257+
* - `Key::Metadata` - All metadata fields (`#metadata`)
258+
* - `Key::Score` - Search scores (`#score`)
259+
*
260+
* # Custom Keys
261+
*
262+
* Use `Key::field()` or `Key::from()` to reference metadata fields:
263+
*
264+
* ```
265+
* use chroma_types::operator::Key;
266+
*
267+
* let key = Key::field("author");
268+
* let key = Key::from("title");
269+
* ```
270+
*
271+
* # Examples
272+
*
273+
* ## Building filters
274+
*
275+
* ```
276+
* use chroma_types::operator::Key;
277+
*
278+
* // Equality
279+
* let filter = Key::field("status").eq("published");
280+
*
281+
* // Comparisons
282+
* let filter = Key::field("year").gte(2020);
283+
* let filter = Key::field("score").lt(0.9);
284+
*
285+
* // Set operations
286+
* let filter = Key::field("category").is_in(vec!["tech", "science"]);
287+
* let filter = Key::field("status").not_in(vec!["deleted", "archived"]);
288+
*
289+
* // Document content
290+
* let filter = Key::Document.contains("machine learning");
291+
* let filter = Key::Document.regex(r"\bAPI\b");
292+
*
293+
* // Combining filters
294+
* let filter = Key::field("status").eq("published")
295+
* & Key::field("year").gte(2020);
296+
* ```
297+
*
298+
* ## Selecting fields
299+
*
300+
* ```
301+
* use chroma_types::plan::SearchPayload;
302+
* use chroma_types::operator::Key;
303+
*
304+
* let search = SearchPayload::default()
305+
* .select([
306+
* Key::Document,
307+
* Key::Score,
308+
* Key::field("title"),
309+
* Key::field("author"),
310+
* ]);
311+
* ```
312+
*/
247313
export type Key = 'Document' | 'Embedding' | 'Metadata' | 'Score' | {
248314
MetadataField: string;
249315
};

0 commit comments

Comments
 (0)