@memvid/sdk 2.0.113
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/LICENSE +190 -0
- package/README.md +244 -0
- package/dist/__tests__/basic.test.d.ts +1 -0
- package/dist/__tests__/basic.test.js +41 -0
- package/dist/adapters/autogen.d.ts +23 -0
- package/dist/adapters/autogen.js +163 -0
- package/dist/adapters/basic.d.ts +1 -0
- package/dist/adapters/basic.js +11 -0
- package/dist/adapters/crewai.d.ts +23 -0
- package/dist/adapters/crewai.js +160 -0
- package/dist/adapters/google_adk.d.ts +25 -0
- package/dist/adapters/google_adk.js +158 -0
- package/dist/adapters/haystack.d.ts +1 -0
- package/dist/adapters/haystack.js +11 -0
- package/dist/adapters/langchain.d.ts +28 -0
- package/dist/adapters/langchain.js +156 -0
- package/dist/adapters/langgraph.d.ts +1 -0
- package/dist/adapters/langgraph.js +11 -0
- package/dist/adapters/llamaindex.d.ts +33 -0
- package/dist/adapters/llamaindex.js +195 -0
- package/dist/adapters/mcp.d.ts +1 -0
- package/dist/adapters/mcp.js +11 -0
- package/dist/adapters/openai.d.ts +26 -0
- package/dist/adapters/openai.js +169 -0
- package/dist/adapters/semantic_kernel.d.ts +1 -0
- package/dist/adapters/semantic_kernel.js +11 -0
- package/dist/adapters/vercel_ai.d.ts +27 -0
- package/dist/adapters/vercel_ai.js +148 -0
- package/dist/clip.d.ts +182 -0
- package/dist/clip.js +371 -0
- package/dist/embeddings.d.ts +156 -0
- package/dist/embeddings.js +289 -0
- package/dist/entities.d.ts +251 -0
- package/dist/entities.js +489 -0
- package/dist/error.d.ts +91 -0
- package/dist/error.js +203 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +458 -0
- package/dist/noop.d.ts +2 -0
- package/dist/noop.js +55 -0
- package/dist/registry.d.ts +5 -0
- package/dist/registry.js +53 -0
- package/dist/types.d.ts +275 -0
- package/dist/types.js +2 -0
- package/index.node +0 -0
- package/package.json +81 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
export type Kind = "basic" | "langchain" | "llamaindex" | "crewai" | "vercel-ai" | "openai" | "autogen" | "haystack" | "langgraph" | "semantic-kernel" | "google-adk" | "mcp";
|
|
2
|
+
export type ApiKey = string | {
|
|
3
|
+
provider: string;
|
|
4
|
+
key: string;
|
|
5
|
+
} | Record<string, string>;
|
|
6
|
+
export type ApiKeyMap = Record<string, string>;
|
|
7
|
+
export type MemvidErrorCode = "MV001" | "MV002" | "MV003" | "MV004" | "MV005" | "MV006" | "MV007" | "MV008" | "MV009" | "MV010" | "MV011" | "MV012" | "MV999";
|
|
8
|
+
export interface MemvidErrorDetails {
|
|
9
|
+
code: MemvidErrorCode;
|
|
10
|
+
message: string;
|
|
11
|
+
details?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface AdapterBundle {
|
|
14
|
+
tools: unknown;
|
|
15
|
+
functions: unknown;
|
|
16
|
+
nodes: unknown;
|
|
17
|
+
asQueryEngine?: (() => unknown) | null;
|
|
18
|
+
}
|
|
19
|
+
export interface PutInput {
|
|
20
|
+
title: string;
|
|
21
|
+
label: string;
|
|
22
|
+
metadata?: Record<string, unknown>;
|
|
23
|
+
text?: string;
|
|
24
|
+
file?: string;
|
|
25
|
+
uri?: string;
|
|
26
|
+
tags?: string[];
|
|
27
|
+
labels?: string[];
|
|
28
|
+
kind?: string;
|
|
29
|
+
track?: string;
|
|
30
|
+
searchText?: string;
|
|
31
|
+
enableEmbedding?: boolean;
|
|
32
|
+
autoTag?: boolean;
|
|
33
|
+
extractDates?: boolean;
|
|
34
|
+
vectorCompression?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface FindInput {
|
|
37
|
+
k?: number;
|
|
38
|
+
snippetChars?: number;
|
|
39
|
+
scope?: string;
|
|
40
|
+
cursor?: string;
|
|
41
|
+
asOfFrame?: number;
|
|
42
|
+
asOfTs?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface AskInput {
|
|
45
|
+
k?: number;
|
|
46
|
+
mode?: string;
|
|
47
|
+
snippetChars?: number;
|
|
48
|
+
scope?: string;
|
|
49
|
+
since?: number;
|
|
50
|
+
until?: number;
|
|
51
|
+
contextOnly?: boolean;
|
|
52
|
+
model?: string;
|
|
53
|
+
llmContextChars?: number;
|
|
54
|
+
modelApiKey?: string;
|
|
55
|
+
maskPii?: boolean;
|
|
56
|
+
asOfFrame?: number;
|
|
57
|
+
asOfTs?: number;
|
|
58
|
+
}
|
|
59
|
+
export interface TimelineInput {
|
|
60
|
+
limit?: number;
|
|
61
|
+
since?: number;
|
|
62
|
+
until?: number;
|
|
63
|
+
reverse?: boolean;
|
|
64
|
+
asOfFrame?: number;
|
|
65
|
+
asOfTs?: number;
|
|
66
|
+
}
|
|
67
|
+
/** A single document for batch ingestion via putMany */
|
|
68
|
+
export interface PutManyInput {
|
|
69
|
+
/** Document title (required) */
|
|
70
|
+
title: string;
|
|
71
|
+
/** Document text content (required) */
|
|
72
|
+
text: string;
|
|
73
|
+
/** Optional URI for the document */
|
|
74
|
+
uri?: string;
|
|
75
|
+
/** Optional labels for classification */
|
|
76
|
+
labels?: string[];
|
|
77
|
+
/** Optional tags for tagging */
|
|
78
|
+
tags?: string[];
|
|
79
|
+
/** Optional metadata */
|
|
80
|
+
metadata?: Record<string, unknown>;
|
|
81
|
+
/** Optional pre-computed embedding vector */
|
|
82
|
+
embedding?: number[];
|
|
83
|
+
}
|
|
84
|
+
/** Options for putMany batch ingestion */
|
|
85
|
+
export interface PutManyOptions {
|
|
86
|
+
/** Zstd compression level (0-11, default: 3) */
|
|
87
|
+
compressionLevel?: number;
|
|
88
|
+
}
|
|
89
|
+
/** Native putMany request format */
|
|
90
|
+
export interface NativePutManyRequest {
|
|
91
|
+
title: string;
|
|
92
|
+
text: string;
|
|
93
|
+
uri?: string;
|
|
94
|
+
labels?: string[];
|
|
95
|
+
tags?: string[];
|
|
96
|
+
metadata?: Record<string, unknown>;
|
|
97
|
+
embedding?: number[];
|
|
98
|
+
}
|
|
99
|
+
/** Native putMany options format */
|
|
100
|
+
export interface NativePutManyOptions {
|
|
101
|
+
compression_level?: number;
|
|
102
|
+
}
|
|
103
|
+
export interface NativePutArgs {
|
|
104
|
+
title: string;
|
|
105
|
+
label: string;
|
|
106
|
+
metadata?: unknown;
|
|
107
|
+
text?: string;
|
|
108
|
+
file?: string;
|
|
109
|
+
uri?: string;
|
|
110
|
+
tags?: string[];
|
|
111
|
+
labels?: string[];
|
|
112
|
+
kind?: string;
|
|
113
|
+
track?: string;
|
|
114
|
+
search_text?: string;
|
|
115
|
+
enable_embedding?: boolean;
|
|
116
|
+
auto_tag?: boolean;
|
|
117
|
+
extract_dates?: boolean;
|
|
118
|
+
vector_compression?: boolean;
|
|
119
|
+
}
|
|
120
|
+
export interface NativeFindOptions {
|
|
121
|
+
k?: number;
|
|
122
|
+
snippetChars?: number;
|
|
123
|
+
scope?: string;
|
|
124
|
+
cursor?: string;
|
|
125
|
+
asOfFrame?: number;
|
|
126
|
+
asOfTs?: number;
|
|
127
|
+
}
|
|
128
|
+
export interface NativeAskOptions {
|
|
129
|
+
k?: number;
|
|
130
|
+
mode?: string;
|
|
131
|
+
snippetChars?: number;
|
|
132
|
+
scope?: string;
|
|
133
|
+
since?: number;
|
|
134
|
+
until?: number;
|
|
135
|
+
contextOnly?: boolean;
|
|
136
|
+
model?: string;
|
|
137
|
+
llmContextChars?: number;
|
|
138
|
+
modelApiKey?: string;
|
|
139
|
+
asOfFrame?: number;
|
|
140
|
+
asOfTs?: number;
|
|
141
|
+
}
|
|
142
|
+
export interface NativeTimelineOptions {
|
|
143
|
+
limit?: number;
|
|
144
|
+
since?: number;
|
|
145
|
+
until?: number;
|
|
146
|
+
reverse?: boolean;
|
|
147
|
+
asOfFrame?: number;
|
|
148
|
+
asOfTs?: number;
|
|
149
|
+
}
|
|
150
|
+
export interface TableInfo {
|
|
151
|
+
table_id: string;
|
|
152
|
+
n_rows: number;
|
|
153
|
+
n_cols: number;
|
|
154
|
+
headers?: string[];
|
|
155
|
+
detection_mode?: string;
|
|
156
|
+
quality?: string;
|
|
157
|
+
page_start?: number;
|
|
158
|
+
page_end?: number;
|
|
159
|
+
source_file?: string;
|
|
160
|
+
}
|
|
161
|
+
export interface TableExtractionResult {
|
|
162
|
+
tables_count: number;
|
|
163
|
+
tables: TableInfo[];
|
|
164
|
+
}
|
|
165
|
+
export interface TableData {
|
|
166
|
+
headers?: string[];
|
|
167
|
+
rows?: unknown[][];
|
|
168
|
+
}
|
|
169
|
+
export interface NativeMemvid {
|
|
170
|
+
put(args: NativePutArgs): Promise<string>;
|
|
171
|
+
putMany(requests: NativePutManyRequest[], options?: NativePutManyOptions): Promise<string[]>;
|
|
172
|
+
find(query: string, options?: NativeFindOptions): Promise<unknown>;
|
|
173
|
+
ask(question: string, options?: NativeAskOptions): Promise<unknown>;
|
|
174
|
+
stats(): Promise<Record<string, unknown>>;
|
|
175
|
+
timeline(options?: NativeTimelineOptions): Promise<unknown>;
|
|
176
|
+
seal(): Promise<void>;
|
|
177
|
+
enableLex(): Promise<void>;
|
|
178
|
+
setVectorCompression(enabled: boolean): Promise<void>;
|
|
179
|
+
applyTicket(ticket: string): Promise<void>;
|
|
180
|
+
getMemoryBinding(): Promise<MemoryBinding | null>;
|
|
181
|
+
unbindMemory(): Promise<void>;
|
|
182
|
+
getCapacity(): Promise<number>;
|
|
183
|
+
currentTicket(): Promise<TicketInfo>;
|
|
184
|
+
syncTickets(memoryId: string, apiKey: string, apiUrl?: string): Promise<SyncTicketResult>;
|
|
185
|
+
putPdfTables(pdfPath: string, embedRows?: boolean): Promise<TableExtractionResult>;
|
|
186
|
+
listTables(): Promise<TableInfo[]>;
|
|
187
|
+
getTable(tableId: string, format?: string): Promise<TableData | string>;
|
|
188
|
+
}
|
|
189
|
+
export interface MemoryBinding {
|
|
190
|
+
memory_id: string;
|
|
191
|
+
memory_name: string;
|
|
192
|
+
bound_at: string;
|
|
193
|
+
api_url: string;
|
|
194
|
+
}
|
|
195
|
+
export interface TicketInfo {
|
|
196
|
+
issuer: string;
|
|
197
|
+
seq_no: number;
|
|
198
|
+
expires_in_secs: number;
|
|
199
|
+
capacity_bytes: number;
|
|
200
|
+
}
|
|
201
|
+
export interface SyncTicketResult {
|
|
202
|
+
already_bound: boolean;
|
|
203
|
+
memory_id: string;
|
|
204
|
+
issuer: string;
|
|
205
|
+
seq_no: number;
|
|
206
|
+
capacity_bytes: number;
|
|
207
|
+
}
|
|
208
|
+
export interface HeatmapEntry {
|
|
209
|
+
frame_id: number;
|
|
210
|
+
hit_count: number;
|
|
211
|
+
preview?: string;
|
|
212
|
+
}
|
|
213
|
+
export interface HeatmapResponse {
|
|
214
|
+
total_frames: number;
|
|
215
|
+
total_accesses: number;
|
|
216
|
+
entries: HeatmapEntry[];
|
|
217
|
+
}
|
|
218
|
+
export interface Memvid {
|
|
219
|
+
put(data: PutInput): Promise<string>;
|
|
220
|
+
/**
|
|
221
|
+
* Batch ingest multiple documents using parallel segment building.
|
|
222
|
+
* Much more efficient than calling put() multiple times.
|
|
223
|
+
* Returns an array of frame IDs for the ingested documents.
|
|
224
|
+
*/
|
|
225
|
+
putMany(requests: PutManyInput[], options?: PutManyOptions): Promise<string[]>;
|
|
226
|
+
find(query: string, opts?: FindInput): Promise<any>;
|
|
227
|
+
ask(question: string, opts?: AskInput): Promise<any>;
|
|
228
|
+
timeline(opts?: TimelineInput): Promise<any>;
|
|
229
|
+
stats(): Promise<Record<string, unknown>>;
|
|
230
|
+
seal(): Promise<void>;
|
|
231
|
+
enableLex(): Promise<void>;
|
|
232
|
+
setVectorCompression(enabled: boolean): Promise<void>;
|
|
233
|
+
applyTicket(ticket: string): Promise<void>;
|
|
234
|
+
getMemoryBinding(): Promise<MemoryBinding | null>;
|
|
235
|
+
unbindMemory(): Promise<void>;
|
|
236
|
+
getCapacity(): Promise<number>;
|
|
237
|
+
currentTicket(): Promise<TicketInfo>;
|
|
238
|
+
syncTickets(memoryId: string, apiKey: string, apiUrl?: string): Promise<SyncTicketResult>;
|
|
239
|
+
putPdfTables(pdfPath: string, embedRows?: boolean): Promise<TableExtractionResult>;
|
|
240
|
+
listTables(): Promise<TableInfo[]>;
|
|
241
|
+
getTable(tableId: string, format?: string): Promise<TableData | string>;
|
|
242
|
+
tools: unknown;
|
|
243
|
+
functions: unknown;
|
|
244
|
+
nodes: unknown;
|
|
245
|
+
asQueryEngine?: (() => unknown) | null;
|
|
246
|
+
}
|
|
247
|
+
export interface UseVerifyOptions {
|
|
248
|
+
deep?: boolean;
|
|
249
|
+
}
|
|
250
|
+
export interface UseDoctorOptions {
|
|
251
|
+
rebuildTimeIndex?: boolean;
|
|
252
|
+
rebuildLexIndex?: boolean;
|
|
253
|
+
rebuildVecIndex?: boolean;
|
|
254
|
+
vacuum?: boolean;
|
|
255
|
+
dryRun?: boolean;
|
|
256
|
+
}
|
|
257
|
+
export interface UseOptions {
|
|
258
|
+
mode?: "open" | "create" | "auto";
|
|
259
|
+
}
|
|
260
|
+
export type NativeVerifyOptions = {
|
|
261
|
+
deep?: boolean;
|
|
262
|
+
};
|
|
263
|
+
export type NativeDoctorOptions = {
|
|
264
|
+
rebuild_time_index?: boolean;
|
|
265
|
+
rebuild_lex_index?: boolean;
|
|
266
|
+
rebuild_vec_index?: boolean;
|
|
267
|
+
vacuum?: boolean;
|
|
268
|
+
dry_run?: boolean;
|
|
269
|
+
};
|
|
270
|
+
export interface NativeAddon {
|
|
271
|
+
openMemvid(path: string, mode?: string, enableLex?: boolean, enableVec?: boolean, apiKey?: string): NativeMemvid;
|
|
272
|
+
verifyMemvid(path: string, options?: NativeVerifyOptions): Promise<unknown>;
|
|
273
|
+
doctorMemvid(path: string, options?: NativeDoctorOptions): Promise<unknown>;
|
|
274
|
+
maskPii(text: string): string;
|
|
275
|
+
}
|
package/dist/types.js
ADDED
package/index.node
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@memvid/sdk",
|
|
3
|
+
"version": "2.0.113",
|
|
4
|
+
"description": "Single-file AI memory system for Node.js. Store, search, and query documents with built-in RAG.",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"require": "./dist/index.js",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/**/*",
|
|
15
|
+
"index.node"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc -p tsconfig.json",
|
|
19
|
+
"lint": "tsc -p tsconfig.json --noEmit"
|
|
20
|
+
},
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/memvid-ai/memvid"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://memvid.com",
|
|
27
|
+
"keywords": [
|
|
28
|
+
"ai",
|
|
29
|
+
"memory",
|
|
30
|
+
"rag",
|
|
31
|
+
"vector-search",
|
|
32
|
+
"semantic-search",
|
|
33
|
+
"langchain",
|
|
34
|
+
"llamaindex",
|
|
35
|
+
"openai",
|
|
36
|
+
"embeddings"
|
|
37
|
+
],
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=18"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@langchain/core": ">=0.3.0",
|
|
43
|
+
"ai": ">=4.0.0",
|
|
44
|
+
"llamaindex": ">=0.12.0",
|
|
45
|
+
"openai": ">=1.0.0",
|
|
46
|
+
"zod": "^3.0.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependenciesMeta": {
|
|
49
|
+
"@langchain/core": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
52
|
+
"ai": {
|
|
53
|
+
"optional": true
|
|
54
|
+
},
|
|
55
|
+
"llamaindex": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"openai": {
|
|
59
|
+
"optional": true
|
|
60
|
+
},
|
|
61
|
+
"zod": {
|
|
62
|
+
"optional": true
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@types/node": "^20.12.7",
|
|
67
|
+
"ts-node": "^10.9.0",
|
|
68
|
+
"typescript": "^5.4.0"
|
|
69
|
+
},
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"@ai-sdk/openai": "^1.0.0",
|
|
72
|
+
"@google/generative-ai": "^0.24.0",
|
|
73
|
+
"@langchain/langgraph": ">=0.2.0",
|
|
74
|
+
"@langchain/openai": ">=0.3.0",
|
|
75
|
+
"@llamaindex/core": ">=0.4.0",
|
|
76
|
+
"@llamaindex/openai": ">=0.2.0",
|
|
77
|
+
"ai": ">=4.0.0",
|
|
78
|
+
"langchain": ">=0.3.0",
|
|
79
|
+
"llamaindex": ">=0.12.0"
|
|
80
|
+
}
|
|
81
|
+
}
|