endee 1.7.1 → 1.8.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +556 -381
- package/dist/collection.d.ts +88 -0
- package/dist/collection.d.ts.map +1 -0
- package/dist/collection.js +755 -0
- package/dist/collection.js.map +1 -0
- package/dist/constants.d.ts +53 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +53 -0
- package/dist/constants.js.map +1 -0
- package/dist/endee.d.ts +93 -0
- package/dist/endee.d.ts.map +1 -0
- package/dist/endee.js +316 -0
- package/dist/endee.js.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/reranker.d.ts +21 -0
- package/dist/reranker.d.ts.map +1 -0
- package/dist/reranker.js +68 -0
- package/dist/reranker.js.map +1 -0
- package/dist/types/index.d.ts +133 -82
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/endee.class.d.ts +0 -18
- package/dist/endee.class.d.ts.map +0 -1
- package/dist/endee.class.js +0 -279
- package/dist/endee.class.js.map +0 -1
- package/dist/index.class.d.ts +0 -32
- package/dist/index.class.d.ts.map +0 -1
- package/dist/index.class.js +0 -391
- package/dist/index.class.js.map +0 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection client for Endee-DB (v2 Collections API).
|
|
3
|
+
*
|
|
4
|
+
* A collection holds objects, each carrying values for one or more named, typed
|
|
5
|
+
* fields (dense `vector`, `sparse`, or `multi_vector`). Obtain a Collection via
|
|
6
|
+
* `Endee.getCollection()` (or after `Endee.createCollection()`).
|
|
7
|
+
*/
|
|
8
|
+
import { type AxiosInstance } from 'axios';
|
|
9
|
+
import { type CollectionMetadata, type FieldDefinition, type FullObject, type ObjectInput, type RebuildOptions, type SearchOptions, type SearchResponse, type UpdateFilterEntry } from './types/index.js';
|
|
10
|
+
export declare class Collection {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
private token;
|
|
13
|
+
private v2Url;
|
|
14
|
+
fields: FieldDefinition[];
|
|
15
|
+
createdAt?: number | string;
|
|
16
|
+
layoutVersion: number;
|
|
17
|
+
private http;
|
|
18
|
+
constructor(name: string, token: string, v2Url: string, metadata: CollectionMetadata, http?: AxiosInstance);
|
|
19
|
+
toString(): string;
|
|
20
|
+
/** name → { type, space_type, dimension } from the collection metadata. */
|
|
21
|
+
private fieldIndex;
|
|
22
|
+
private authHeaders;
|
|
23
|
+
/**
|
|
24
|
+
* Insert or update objects. Cosine `vector`/`multi_vector` values are
|
|
25
|
+
* L2-normalized client-side; the batch is serialized as msgpack into the
|
|
26
|
+
* server ObjectBatch layout and POSTed as `application/msgpack`.
|
|
27
|
+
*
|
|
28
|
+
* Wire layout (maps keyed by field name):
|
|
29
|
+
* ObjectBatch = [ objects ]
|
|
30
|
+
* Object = [ id, meta, filter, vectors, sparses, multi_vectors ]
|
|
31
|
+
* vectors = { fieldName: [float, ...] }
|
|
32
|
+
* sparses = { fieldName: [indices, values] }
|
|
33
|
+
* multi_vectors = { fieldName: [[float, ...], ...] }
|
|
34
|
+
*
|
|
35
|
+
* Returns `{ upserted: <count> }`.
|
|
36
|
+
*/
|
|
37
|
+
upsert(objects: ObjectInput[]): Promise<Record<string, unknown>>;
|
|
38
|
+
/**
|
|
39
|
+
* Search the collection across one or more fields in a single request.
|
|
40
|
+
*
|
|
41
|
+
* Each field is queried with the unified config `{ query, limit?, ef_search? }`,
|
|
42
|
+
* where `limit` is the max number of hits to return for that field (defaults
|
|
43
|
+
* to `DEFAULT_TOP_K`). The result is always one ranked list per field:
|
|
44
|
+
* `{ results: { [field]: SearchHit[] } }`. Use `rerank()` to fuse these into a
|
|
45
|
+
* single ranked list.
|
|
46
|
+
*
|
|
47
|
+
* For filtered searches, `prefilterCardinalityThreshold` and
|
|
48
|
+
* `filterBoostPercentage` tune the speed/recall trade-off; when either is
|
|
49
|
+
* set they're sent to the server as `filter_params`.
|
|
50
|
+
*/
|
|
51
|
+
search(options: SearchOptions): Promise<SearchResponse>;
|
|
52
|
+
/** Delete a single object by id. Returns `{ deleted: "<id>" }`. */
|
|
53
|
+
deleteObject(id: string): Promise<Record<string, unknown>>;
|
|
54
|
+
/**
|
|
55
|
+
* Fetch full objects (meta, filter, and stored vectors) by id. Ids that don't
|
|
56
|
+
* exist are skipped by the server.
|
|
57
|
+
*/
|
|
58
|
+
getObjects(ids: string[]): Promise<FullObject[]>;
|
|
59
|
+
/**
|
|
60
|
+
* Delete all objects matching a filter. Returns `{ deleted: <count> }`.
|
|
61
|
+
* `filter` uses the array format, e.g. `[{ category: { $eq: 'news' } }]`.
|
|
62
|
+
*/
|
|
63
|
+
deleteByFilter(filter: Array<Record<string, unknown>>): Promise<Record<string, unknown>>;
|
|
64
|
+
/**
|
|
65
|
+
* Update filter tags on existing objects (no re-upsert of vectors).
|
|
66
|
+
* Returns `{ updated: <count> }`. `updates` is a list of `{ id, filter }`.
|
|
67
|
+
*/
|
|
68
|
+
updateFilters(updates: UpdateFilterEntry[]): Promise<Record<string, unknown>>;
|
|
69
|
+
/** Return collection metadata: `{ name, fields, created_at, layout_version }`. */
|
|
70
|
+
describe(): Promise<CollectionMetadata>;
|
|
71
|
+
/**
|
|
72
|
+
* Rebuild a vector field's HNSW graph with new M / ef_con (async).
|
|
73
|
+
* Only M/ef_con may change; dimension/space_type/precision are immutable.
|
|
74
|
+
* Poll progress with `rebuildStatus()`.
|
|
75
|
+
*/
|
|
76
|
+
rebuild(options: RebuildOptions): Promise<Record<string, unknown>>;
|
|
77
|
+
/** Poll rebuild progress. */
|
|
78
|
+
rebuildStatus(): Promise<Record<string, unknown>>;
|
|
79
|
+
/** Defragment the collection's storage in place. */
|
|
80
|
+
shrink(): Promise<Record<string, unknown>>;
|
|
81
|
+
/**
|
|
82
|
+
* Start an async backup of this collection. Returns
|
|
83
|
+
* `{ backup_name, status: "in_progress" }`. Poll `Endee.activeBackup()` /
|
|
84
|
+
* `Endee.listBackups()` for completion.
|
|
85
|
+
*/
|
|
86
|
+
createBackup(name: string): Promise<Record<string, unknown>>;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=collection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAc,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAoBlD,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EAEpB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,cAAc,EAEnB,KAAK,aAAa,EAClB,KAAK,cAAc,EAEnB,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC;AAkT1B,qBAAa,UAAU;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAS;IACtB,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,IAAI,CAAgB;gBAG1B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,kBAAkB,EAC5B,IAAI,CAAC,EAAE,aAAa;IAWtB,QAAQ,IAAI,MAAM;IAIlB,2EAA2E;IAC3E,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,WAAW;IAMnB;;;;;;;;;;;;;OAaG;IACG,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IA6GtE;;;;;;;;;;;;OAYG;IACG,MAAM,CAAC,OAAO,E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