@convex-dev/rag 0.3.0 → 0.3.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 +463 -121
- package/dist/client/defaultChunker.d.ts.map +1 -1
- package/dist/client/defaultChunker.js +47 -16
- package/dist/client/defaultChunker.js.map +1 -1
- package/dist/client/fileUtils.d.ts +4 -2
- package/dist/client/fileUtils.d.ts.map +1 -1
- package/dist/client/fileUtils.js +5 -3
- package/dist/client/fileUtils.js.map +1 -1
- package/dist/client/index.d.ts +19 -15
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +15 -11
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/api.d.ts +11 -4
- package/dist/component/chunks.d.ts +1 -0
- package/dist/component/chunks.d.ts.map +1 -1
- package/dist/component/chunks.js +2 -1
- package/dist/component/chunks.js.map +1 -1
- package/dist/component/entries.d.ts +8 -8
- package/dist/component/entries.d.ts.map +1 -1
- package/dist/component/entries.js +30 -17
- package/dist/component/entries.js.map +1 -1
- package/dist/component/namespaces.d.ts +3 -3
- package/dist/component/namespaces.js +4 -4
- package/dist/component/namespaces.js.map +1 -1
- package/dist/component/schema.d.ts +31 -31
- package/dist/shared.d.ts +28 -11
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +2 -1
- package/dist/shared.js.map +1 -1
- package/package.json +1 -6
- package/src/client/defaultChunker.test.ts +1 -1
- package/src/client/defaultChunker.ts +73 -17
- package/src/client/fileUtils.ts +8 -4
- package/src/client/index.test.ts +28 -24
- package/src/client/index.ts +30 -24
- package/src/component/_generated/api.d.ts +11 -4
- package/src/component/chunks.test.ts +2 -0
- package/src/component/chunks.ts +2 -1
- package/src/component/entries.test.ts +16 -16
- package/src/component/entries.ts +31 -19
- package/src/component/namespaces.ts +4 -4
- package/src/shared.ts +15 -7
|
@@ -5,8 +5,8 @@ export declare const vStatusWithOnComplete: import("convex/values").VUnion<{
|
|
|
5
5
|
} | {
|
|
6
6
|
kind: "ready";
|
|
7
7
|
} | {
|
|
8
|
-
kind: "replaced";
|
|
9
8
|
replacedAt: number;
|
|
9
|
+
kind: "replaced";
|
|
10
10
|
}, [import("convex/values").VObject<{
|
|
11
11
|
onComplete?: string | undefined;
|
|
12
12
|
kind: "pending";
|
|
@@ -18,12 +18,12 @@ export declare const vStatusWithOnComplete: import("convex/values").VUnion<{
|
|
|
18
18
|
}, {
|
|
19
19
|
kind: import("convex/values").VLiteral<"ready", "required">;
|
|
20
20
|
}, "required", "kind">, import("convex/values").VObject<{
|
|
21
|
-
kind: "replaced";
|
|
22
21
|
replacedAt: number;
|
|
22
|
+
kind: "replaced";
|
|
23
23
|
}, {
|
|
24
24
|
kind: import("convex/values").VLiteral<"replaced", "required">;
|
|
25
25
|
replacedAt: import("convex/values").VFloat64<number, "required">;
|
|
26
|
-
}, "required", "
|
|
26
|
+
}, "required", "replacedAt" | "kind">], "required", "replacedAt" | "kind" | "onComplete">;
|
|
27
27
|
export type StatusWithOnComplete = Infer<typeof vStatusWithOnComplete>;
|
|
28
28
|
export declare const schema: import("convex/server").SchemaDefinition<{
|
|
29
29
|
vectors_4096: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
@@ -264,8 +264,8 @@ export declare const schema: import("convex/server").SchemaDefinition<{
|
|
|
264
264
|
} | {
|
|
265
265
|
kind: "ready";
|
|
266
266
|
} | {
|
|
267
|
-
kind: "replaced";
|
|
268
267
|
replacedAt: number;
|
|
268
|
+
kind: "replaced";
|
|
269
269
|
};
|
|
270
270
|
filterNames: string[];
|
|
271
271
|
dimension: number;
|
|
@@ -283,8 +283,8 @@ export declare const schema: import("convex/server").SchemaDefinition<{
|
|
|
283
283
|
} | {
|
|
284
284
|
kind: "ready";
|
|
285
285
|
} | {
|
|
286
|
-
kind: "replaced";
|
|
287
286
|
replacedAt: number;
|
|
287
|
+
kind: "replaced";
|
|
288
288
|
}, [import("convex/values").VObject<{
|
|
289
289
|
onComplete?: string | undefined;
|
|
290
290
|
kind: "pending";
|
|
@@ -296,13 +296,13 @@ export declare const schema: import("convex/server").SchemaDefinition<{
|
|
|
296
296
|
}, {
|
|
297
297
|
kind: import("convex/values").VLiteral<"ready", "required">;
|
|
298
298
|
}, "required", "kind">, import("convex/values").VObject<{
|
|
299
|
-
kind: "replaced";
|
|
300
299
|
replacedAt: number;
|
|
300
|
+
kind: "replaced";
|
|
301
301
|
}, {
|
|
302
302
|
kind: import("convex/values").VLiteral<"replaced", "required">;
|
|
303
303
|
replacedAt: import("convex/values").VFloat64<number, "required">;
|
|
304
|
-
}, "required", "
|
|
305
|
-
}, "required", "namespace" | "status" | "filterNames" | "dimension" | "modelId" | "version" | "status.
|
|
304
|
+
}, "required", "replacedAt" | "kind">], "required", "replacedAt" | "kind" | "onComplete">;
|
|
305
|
+
}, "required", "namespace" | "status" | "filterNames" | "dimension" | "modelId" | "version" | "status.replacedAt" | "status.kind" | "status.onComplete">, {
|
|
306
306
|
status_namespace_version: ["status.kind", "namespace", "version", "_creationTime"];
|
|
307
307
|
}, {}, {}>;
|
|
308
308
|
entries: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
@@ -317,8 +317,8 @@ export declare const schema: import("convex/server").SchemaDefinition<{
|
|
|
317
317
|
} | {
|
|
318
318
|
kind: "ready";
|
|
319
319
|
} | {
|
|
320
|
-
kind: "replaced";
|
|
321
320
|
replacedAt: number;
|
|
321
|
+
kind: "replaced";
|
|
322
322
|
};
|
|
323
323
|
version: number;
|
|
324
324
|
importance: number;
|
|
@@ -350,8 +350,8 @@ export declare const schema: import("convex/server").SchemaDefinition<{
|
|
|
350
350
|
} | {
|
|
351
351
|
kind: "ready";
|
|
352
352
|
} | {
|
|
353
|
-
kind: "replaced";
|
|
354
353
|
replacedAt: number;
|
|
354
|
+
kind: "replaced";
|
|
355
355
|
}, [import("convex/values").VObject<{
|
|
356
356
|
onComplete?: string | undefined;
|
|
357
357
|
kind: "pending";
|
|
@@ -363,13 +363,13 @@ export declare const schema: import("convex/server").SchemaDefinition<{
|
|
|
363
363
|
}, {
|
|
364
364
|
kind: import("convex/values").VLiteral<"ready", "required">;
|
|
365
365
|
}, "required", "kind">, import("convex/values").VObject<{
|
|
366
|
-
kind: "replaced";
|
|
367
366
|
replacedAt: number;
|
|
367
|
+
kind: "replaced";
|
|
368
368
|
}, {
|
|
369
369
|
kind: import("convex/values").VLiteral<"replaced", "required">;
|
|
370
370
|
replacedAt: import("convex/values").VFloat64<number, "required">;
|
|
371
|
-
}, "required", "
|
|
372
|
-
}, "required", "namespaceId" | "metadata" | `metadata.${string}` | "status" | "version" | "key" | "title" | "importance" | "filterValues" | "contentHash" | "status.
|
|
371
|
+
}, "required", "replacedAt" | "kind">], "required", "replacedAt" | "kind" | "onComplete">;
|
|
372
|
+
}, "required", "namespaceId" | "metadata" | `metadata.${string}` | "status" | "version" | "key" | "title" | "importance" | "filterValues" | "contentHash" | "status.replacedAt" | "status.kind" | "status.onComplete">, {
|
|
373
373
|
namespaceId_status_key_version: ["namespaceId", "status.kind", "key", "version", "_creationTime"];
|
|
374
374
|
status_namespaceId: ["status.kind", "namespaceId", "_creationTime"];
|
|
375
375
|
}, {}, {}>;
|
|
@@ -479,15 +479,15 @@ export declare const vv: {
|
|
|
479
479
|
} | {
|
|
480
480
|
kind: "ready";
|
|
481
481
|
} | {
|
|
482
|
-
kind: "replaced";
|
|
483
482
|
replacedAt: number;
|
|
483
|
+
kind: "replaced";
|
|
484
484
|
};
|
|
485
485
|
filterNames: string[];
|
|
486
486
|
dimension: number;
|
|
487
487
|
modelId: string;
|
|
488
488
|
version: number;
|
|
489
489
|
};
|
|
490
|
-
fieldPaths: "_id" | ("_creationTime" | "namespace" | "status" | "filterNames" | "dimension" | "modelId" | "version" | "status.
|
|
490
|
+
fieldPaths: "_id" | ("_creationTime" | "namespace" | "status" | "filterNames" | "dimension" | "modelId" | "version" | "status.replacedAt" | "status.kind" | "status.onComplete");
|
|
491
491
|
indexes: {
|
|
492
492
|
status_namespace_version: ["status.kind", "namespace", "version", "_creationTime"];
|
|
493
493
|
by_id: ["_id"];
|
|
@@ -511,8 +511,8 @@ export declare const vv: {
|
|
|
511
511
|
} | {
|
|
512
512
|
kind: "ready";
|
|
513
513
|
} | {
|
|
514
|
-
kind: "replaced";
|
|
515
514
|
replacedAt: number;
|
|
515
|
+
kind: "replaced";
|
|
516
516
|
};
|
|
517
517
|
version: number;
|
|
518
518
|
importance: number;
|
|
@@ -521,7 +521,7 @@ export declare const vv: {
|
|
|
521
521
|
value: any;
|
|
522
522
|
}[];
|
|
523
523
|
};
|
|
524
|
-
fieldPaths: "_id" | ("namespaceId" | "_creationTime" | "metadata" | `metadata.${string}` | "status" | "version" | "key" | "title" | "importance" | "filterValues" | "contentHash" | "status.
|
|
524
|
+
fieldPaths: "_id" | ("namespaceId" | "_creationTime" | "metadata" | `metadata.${string}` | "status" | "version" | "key" | "title" | "importance" | "filterValues" | "contentHash" | "status.replacedAt" | "status.kind" | "status.onComplete");
|
|
525
525
|
indexes: {
|
|
526
526
|
namespaceId_status_key_version: ["namespaceId", "status.kind", "key", "version", "_creationTime"];
|
|
527
527
|
status_namespaceId: ["status.kind", "namespaceId", "_creationTime"];
|
|
@@ -862,15 +862,15 @@ export declare const vv: {
|
|
|
862
862
|
} | {
|
|
863
863
|
kind: "ready";
|
|
864
864
|
} | {
|
|
865
|
-
kind: "replaced";
|
|
866
865
|
replacedAt: number;
|
|
866
|
+
kind: "replaced";
|
|
867
867
|
};
|
|
868
868
|
filterNames: string[];
|
|
869
869
|
dimension: number;
|
|
870
870
|
modelId: string;
|
|
871
871
|
version: number;
|
|
872
872
|
};
|
|
873
|
-
fieldPaths: "_id" | ("_creationTime" | "namespace" | "status" | "filterNames" | "dimension" | "modelId" | "version" | "status.
|
|
873
|
+
fieldPaths: "_id" | ("_creationTime" | "namespace" | "status" | "filterNames" | "dimension" | "modelId" | "version" | "status.replacedAt" | "status.kind" | "status.onComplete");
|
|
874
874
|
indexes: {
|
|
875
875
|
status_namespace_version: ["status.kind", "namespace", "version", "_creationTime"];
|
|
876
876
|
by_id: ["_id"];
|
|
@@ -894,8 +894,8 @@ export declare const vv: {
|
|
|
894
894
|
} | {
|
|
895
895
|
kind: "ready";
|
|
896
896
|
} | {
|
|
897
|
-
kind: "replaced";
|
|
898
897
|
replacedAt: number;
|
|
898
|
+
kind: "replaced";
|
|
899
899
|
};
|
|
900
900
|
version: number;
|
|
901
901
|
importance: number;
|
|
@@ -904,7 +904,7 @@ export declare const vv: {
|
|
|
904
904
|
value: any;
|
|
905
905
|
}[];
|
|
906
906
|
};
|
|
907
|
-
fieldPaths: "_id" | ("namespaceId" | "_creationTime" | "metadata" | `metadata.${string}` | "status" | "version" | "key" | "title" | "importance" | "filterValues" | "contentHash" | "status.
|
|
907
|
+
fieldPaths: "_id" | ("namespaceId" | "_creationTime" | "metadata" | `metadata.${string}` | "status" | "version" | "key" | "title" | "importance" | "filterValues" | "contentHash" | "status.replacedAt" | "status.kind" | "status.onComplete");
|
|
908
908
|
indexes: {
|
|
909
909
|
namespaceId_status_key_version: ["namespaceId", "status.kind", "key", "version", "_creationTime"];
|
|
910
910
|
status_namespaceId: ["status.kind", "namespaceId", "_creationTime"];
|
|
@@ -1471,8 +1471,8 @@ export declare const vv: {
|
|
|
1471
1471
|
} | {
|
|
1472
1472
|
kind: "ready";
|
|
1473
1473
|
} | {
|
|
1474
|
-
kind: "replaced";
|
|
1475
1474
|
replacedAt: number;
|
|
1475
|
+
kind: "replaced";
|
|
1476
1476
|
};
|
|
1477
1477
|
filterNames: string[];
|
|
1478
1478
|
dimension: number;
|
|
@@ -1490,8 +1490,8 @@ export declare const vv: {
|
|
|
1490
1490
|
} | {
|
|
1491
1491
|
kind: "ready";
|
|
1492
1492
|
} | {
|
|
1493
|
-
kind: "replaced";
|
|
1494
1493
|
replacedAt: number;
|
|
1494
|
+
kind: "replaced";
|
|
1495
1495
|
}, [import("convex/values").VObject<{
|
|
1496
1496
|
onComplete?: string | undefined;
|
|
1497
1497
|
kind: "pending";
|
|
@@ -1503,13 +1503,13 @@ export declare const vv: {
|
|
|
1503
1503
|
}, {
|
|
1504
1504
|
kind: import("convex/values").VLiteral<"ready", "required">;
|
|
1505
1505
|
}, "required", "kind">, import("convex/values").VObject<{
|
|
1506
|
-
kind: "replaced";
|
|
1507
1506
|
replacedAt: number;
|
|
1507
|
+
kind: "replaced";
|
|
1508
1508
|
}, {
|
|
1509
1509
|
kind: import("convex/values").VLiteral<"replaced", "required">;
|
|
1510
1510
|
replacedAt: import("convex/values").VFloat64<number, "required">;
|
|
1511
|
-
}, "required", "
|
|
1512
|
-
}, "required", "namespace" | "status" | "filterNames" | "dimension" | "modelId" | "version" | "status.
|
|
1511
|
+
}, "required", "replacedAt" | "kind">], "required", "replacedAt" | "kind" | "onComplete">;
|
|
1512
|
+
}, "required", "namespace" | "status" | "filterNames" | "dimension" | "modelId" | "version" | "status.replacedAt" | "status.kind" | "status.onComplete">, {
|
|
1513
1513
|
status_namespace_version: ["status.kind", "namespace", "version", "_creationTime"];
|
|
1514
1514
|
}, {}, {}>;
|
|
1515
1515
|
entries: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
@@ -1524,8 +1524,8 @@ export declare const vv: {
|
|
|
1524
1524
|
} | {
|
|
1525
1525
|
kind: "ready";
|
|
1526
1526
|
} | {
|
|
1527
|
-
kind: "replaced";
|
|
1528
1527
|
replacedAt: number;
|
|
1528
|
+
kind: "replaced";
|
|
1529
1529
|
};
|
|
1530
1530
|
version: number;
|
|
1531
1531
|
importance: number;
|
|
@@ -1557,8 +1557,8 @@ export declare const vv: {
|
|
|
1557
1557
|
} | {
|
|
1558
1558
|
kind: "ready";
|
|
1559
1559
|
} | {
|
|
1560
|
-
kind: "replaced";
|
|
1561
1560
|
replacedAt: number;
|
|
1561
|
+
kind: "replaced";
|
|
1562
1562
|
}, [import("convex/values").VObject<{
|
|
1563
1563
|
onComplete?: string | undefined;
|
|
1564
1564
|
kind: "pending";
|
|
@@ -1570,13 +1570,13 @@ export declare const vv: {
|
|
|
1570
1570
|
}, {
|
|
1571
1571
|
kind: import("convex/values").VLiteral<"ready", "required">;
|
|
1572
1572
|
}, "required", "kind">, import("convex/values").VObject<{
|
|
1573
|
-
kind: "replaced";
|
|
1574
1573
|
replacedAt: number;
|
|
1574
|
+
kind: "replaced";
|
|
1575
1575
|
}, {
|
|
1576
1576
|
kind: import("convex/values").VLiteral<"replaced", "required">;
|
|
1577
1577
|
replacedAt: import("convex/values").VFloat64<number, "required">;
|
|
1578
|
-
}, "required", "
|
|
1579
|
-
}, "required", "namespaceId" | "metadata" | `metadata.${string}` | "status" | "version" | "key" | "title" | "importance" | "filterValues" | "contentHash" | "status.
|
|
1578
|
+
}, "required", "replacedAt" | "kind">], "required", "replacedAt" | "kind" | "onComplete">;
|
|
1579
|
+
}, "required", "namespaceId" | "metadata" | `metadata.${string}` | "status" | "version" | "key" | "title" | "importance" | "filterValues" | "contentHash" | "status.replacedAt" | "status.kind" | "status.onComplete">, {
|
|
1580
1580
|
namespaceId_status_key_version: ["namespaceId", "status.kind", "key", "version", "_creationTime"];
|
|
1581
1581
|
status_namespaceId: ["status.kind", "namespaceId", "_creationTime"];
|
|
1582
1582
|
}, {}, {}>;
|
package/dist/shared.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ export declare const vEntry: VObject<{
|
|
|
73
73
|
key?: string | undefined;
|
|
74
74
|
title?: string | undefined;
|
|
75
75
|
contentHash?: string | undefined;
|
|
76
|
+
replacedAt?: number | undefined;
|
|
76
77
|
entryId: string & {
|
|
77
78
|
_: "EntryId";
|
|
78
79
|
};
|
|
@@ -102,13 +103,15 @@ export declare const vEntry: VObject<{
|
|
|
102
103
|
}, "required", "name" | "value" | `value.${string}`>, "required">;
|
|
103
104
|
contentHash: import("convex/values").VString<string | undefined, "optional">;
|
|
104
105
|
status: import("convex/values").VUnion<"pending" | "ready" | "replaced", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"ready", "required">, import("convex/values").VLiteral<"replaced", "required">], "required", never>;
|
|
105
|
-
|
|
106
|
+
replacedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
107
|
+
}, "required", "entryId" | "metadata" | `metadata.${string}` | "status" | "key" | "title" | "importance" | "filterValues" | "contentHash" | "replacedAt">;
|
|
106
108
|
export type VEntry<Filters extends Record<string, Value>, Metadata extends Record<string, Value>> = VObject<Entry<Filters, Metadata>, typeof vEntry.fields, "required", typeof vEntry.fieldPaths>;
|
|
107
109
|
export declare const vSearchEntry: VObject<{
|
|
108
110
|
metadata?: Record<string, any> | undefined;
|
|
109
111
|
key?: string | undefined;
|
|
110
112
|
title?: string | undefined;
|
|
111
113
|
contentHash?: string | undefined;
|
|
114
|
+
replacedAt?: number | undefined;
|
|
112
115
|
entryId: string & {
|
|
113
116
|
_: "EntryId";
|
|
114
117
|
};
|
|
@@ -140,12 +143,13 @@ export declare const vSearchEntry: VObject<{
|
|
|
140
143
|
}, "required", "name" | "value" | `value.${string}`>, "required">;
|
|
141
144
|
contentHash: import("convex/values").VString<string | undefined, "optional">;
|
|
142
145
|
status: import("convex/values").VUnion<"pending" | "ready" | "replaced", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"ready", "required">, import("convex/values").VLiteral<"replaced", "required">], "required", never>;
|
|
143
|
-
|
|
146
|
+
replacedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
147
|
+
}, "required", "entryId" | "text" | "metadata" | `metadata.${string}` | "status" | "key" | "title" | "importance" | "filterValues" | "contentHash" | "replacedAt">;
|
|
144
148
|
export type VSearchEntry<Filters extends Record<string, Value>, Metadata extends Record<string, Value>> = VObject<SearchEntry<Filters, Metadata>, typeof vSearchEntry.fields, "required", typeof vSearchEntry.fieldPaths>;
|
|
145
149
|
export type SearchEntry<Filters extends Record<string, Value>, Metadata extends Record<string, Value>> = Entry<Filters, Metadata> & {
|
|
146
150
|
text: string;
|
|
147
151
|
};
|
|
148
|
-
export type
|
|
152
|
+
export type EntryFilter<Filters extends Record<string, Value> = Record<string, Value>> = {
|
|
149
153
|
[K in keyof Filters & string]: NamedFilter<K, Filters[K]>;
|
|
150
154
|
}[keyof Filters & string];
|
|
151
155
|
export type Entry<Filters extends Record<string, Value> = any, Metadata extends Record<string, Value> = any> = {
|
|
@@ -164,14 +168,18 @@ export type Entry<Filters extends Record<string, Value> = any, Metadata extends
|
|
|
164
168
|
/** Filters that can be used to search for this entry.
|
|
165
169
|
* Up to 4 filters are supported, of any type.
|
|
166
170
|
*/
|
|
167
|
-
filterValues:
|
|
171
|
+
filterValues: EntryFilter<Filters>[];
|
|
168
172
|
/** Hash of the entry contents.
|
|
169
173
|
* If supplied, it will avoid adding if the hash is the same.
|
|
170
174
|
*/
|
|
171
175
|
contentHash?: string | undefined;
|
|
176
|
+
} & ({
|
|
172
177
|
/** Whether this entry's contents have all been inserted and indexed. */
|
|
173
|
-
status:
|
|
174
|
-
}
|
|
178
|
+
status: "pending" | "ready";
|
|
179
|
+
} | {
|
|
180
|
+
status: "replaced";
|
|
181
|
+
replacedAt: number;
|
|
182
|
+
});
|
|
175
183
|
export declare const vChunk: VObject<{
|
|
176
184
|
metadata?: Record<string, any> | undefined;
|
|
177
185
|
order: number;
|
|
@@ -226,6 +234,7 @@ export declare const vOnCompleteArgs: VObject<{
|
|
|
226
234
|
key?: string | undefined;
|
|
227
235
|
title?: string | undefined;
|
|
228
236
|
contentHash?: string | undefined;
|
|
237
|
+
replacedAt?: number | undefined;
|
|
229
238
|
entryId: string & {
|
|
230
239
|
_: "EntryId";
|
|
231
240
|
};
|
|
@@ -254,6 +263,7 @@ export declare const vOnCompleteArgs: VObject<{
|
|
|
254
263
|
key?: string | undefined;
|
|
255
264
|
title?: string | undefined;
|
|
256
265
|
contentHash?: string | undefined;
|
|
266
|
+
replacedAt?: number | undefined;
|
|
257
267
|
entryId: string & {
|
|
258
268
|
_: "EntryId";
|
|
259
269
|
};
|
|
@@ -293,6 +303,7 @@ export declare const vOnCompleteArgs: VObject<{
|
|
|
293
303
|
key?: string | undefined;
|
|
294
304
|
title?: string | undefined;
|
|
295
305
|
contentHash?: string | undefined;
|
|
306
|
+
replacedAt?: number | undefined;
|
|
296
307
|
entryId: string & {
|
|
297
308
|
_: "EntryId";
|
|
298
309
|
};
|
|
@@ -322,12 +333,14 @@ export declare const vOnCompleteArgs: VObject<{
|
|
|
322
333
|
}, "required", "name" | "value" | `value.${string}`>, "required">;
|
|
323
334
|
contentHash: import("convex/values").VString<string | undefined, "optional">;
|
|
324
335
|
status: import("convex/values").VUnion<"pending" | "ready" | "replaced", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"ready", "required">, import("convex/values").VLiteral<"replaced", "required">], "required", never>;
|
|
325
|
-
|
|
336
|
+
replacedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
337
|
+
}, "required", "entryId" | "metadata" | `metadata.${string}` | "status" | "key" | "title" | "importance" | "filterValues" | "contentHash" | "replacedAt">;
|
|
326
338
|
replacedEntry: VObject<{
|
|
327
339
|
metadata?: Record<string, any> | undefined;
|
|
328
340
|
key?: string | undefined;
|
|
329
341
|
title?: string | undefined;
|
|
330
342
|
contentHash?: string | undefined;
|
|
343
|
+
replacedAt?: number | undefined;
|
|
331
344
|
entryId: string & {
|
|
332
345
|
_: "EntryId";
|
|
333
346
|
};
|
|
@@ -357,9 +370,10 @@ export declare const vOnCompleteArgs: VObject<{
|
|
|
357
370
|
}, "required", "name" | "value" | `value.${string}`>, "required">;
|
|
358
371
|
contentHash: import("convex/values").VString<string | undefined, "optional">;
|
|
359
372
|
status: import("convex/values").VUnion<"pending" | "ready" | "replaced", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"ready", "required">, import("convex/values").VLiteral<"replaced", "required">], "required", never>;
|
|
360
|
-
|
|
373
|
+
replacedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
374
|
+
}, "optional", "entryId" | "metadata" | `metadata.${string}` | "status" | "key" | "title" | "importance" | "filterValues" | "contentHash" | "replacedAt">;
|
|
361
375
|
error: import("convex/values").VString<string | undefined, "optional">;
|
|
362
|
-
}, "required", "namespace" | "entry" | "replacedEntry" | "error" | "namespace.namespaceId" | "namespace.createdAt" | "namespace.namespace" | "namespace.status" | "namespace.filterNames" | "namespace.dimension" | "namespace.modelId" | "namespace.version" | "entry.entryId" | "entry.metadata" | `entry.metadata.${string}` | "entry.status" | "entry.key" | "entry.title" | "entry.importance" | "entry.filterValues" | "entry.contentHash" | "replacedEntry.entryId" | "replacedEntry.metadata" | `replacedEntry.metadata.${string}` | "replacedEntry.status" | "replacedEntry.key" | "replacedEntry.title" | "replacedEntry.importance" | "replacedEntry.filterValues" | "replacedEntry.contentHash">;
|
|
376
|
+
}, "required", "namespace" | "entry" | "replacedEntry" | "error" | "namespace.namespaceId" | "namespace.createdAt" | "namespace.namespace" | "namespace.status" | "namespace.filterNames" | "namespace.dimension" | "namespace.modelId" | "namespace.version" | "entry.entryId" | "entry.metadata" | `entry.metadata.${string}` | "entry.status" | "entry.key" | "entry.title" | "entry.importance" | "entry.filterValues" | "entry.contentHash" | "entry.replacedAt" | "replacedEntry.entryId" | "replacedEntry.metadata" | `replacedEntry.metadata.${string}` | "replacedEntry.status" | "replacedEntry.key" | "replacedEntry.title" | "replacedEntry.importance" | "replacedEntry.filterValues" | "replacedEntry.contentHash" | "replacedEntry.replacedAt">;
|
|
363
377
|
export type OnComplete<Filters extends Record<string, Value> = any, EntryMetadata extends Record<string, Value> = any> = FunctionReference<"mutation", "internal", {
|
|
364
378
|
/**
|
|
365
379
|
* The namespace that the entry belongs to.
|
|
@@ -396,6 +410,7 @@ export declare const vChunkerArgs: VObject<{
|
|
|
396
410
|
key?: string | undefined;
|
|
397
411
|
title?: string | undefined;
|
|
398
412
|
contentHash?: string | undefined;
|
|
413
|
+
replacedAt?: number | undefined;
|
|
399
414
|
entryId: string & {
|
|
400
415
|
_: "EntryId";
|
|
401
416
|
};
|
|
@@ -436,6 +451,7 @@ export declare const vChunkerArgs: VObject<{
|
|
|
436
451
|
key?: string | undefined;
|
|
437
452
|
title?: string | undefined;
|
|
438
453
|
contentHash?: string | undefined;
|
|
454
|
+
replacedAt?: number | undefined;
|
|
439
455
|
entryId: string & {
|
|
440
456
|
_: "EntryId";
|
|
441
457
|
};
|
|
@@ -465,9 +481,10 @@ export declare const vChunkerArgs: VObject<{
|
|
|
465
481
|
}, "required", "name" | "value" | `value.${string}`>, "required">;
|
|
466
482
|
contentHash: import("convex/values").VString<string | undefined, "optional">;
|
|
467
483
|
status: import("convex/values").VUnion<"pending" | "ready" | "replaced", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"ready", "required">, import("convex/values").VLiteral<"replaced", "required">], "required", never>;
|
|
468
|
-
|
|
484
|
+
replacedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
485
|
+
}, "required", "entryId" | "metadata" | `metadata.${string}` | "status" | "key" | "title" | "importance" | "filterValues" | "contentHash" | "replacedAt">;
|
|
469
486
|
insertChunks: import("convex/values").VString<string, "required">;
|
|
470
|
-
}, "required", "namespace" | "entry" | "namespace.namespaceId" | "namespace.createdAt" | "namespace.namespace" | "namespace.status" | "namespace.filterNames" | "namespace.dimension" | "namespace.modelId" | "namespace.version" | "entry.entryId" | "entry.metadata" | `entry.metadata.${string}` | "entry.status" | "entry.key" | "entry.title" | "entry.importance" | "entry.filterValues" | "entry.contentHash" | "insertChunks">;
|
|
487
|
+
}, "required", "namespace" | "entry" | "namespace.namespaceId" | "namespace.createdAt" | "namespace.namespace" | "namespace.status" | "namespace.filterNames" | "namespace.dimension" | "namespace.modelId" | "namespace.version" | "entry.entryId" | "entry.metadata" | `entry.metadata.${string}` | "entry.status" | "entry.key" | "entry.title" | "entry.importance" | "entry.filterValues" | "entry.contentHash" | "entry.replacedAt" | "insertChunks">;
|
|
471
488
|
export type ChunkerAction = FunctionReference<"action", "internal", Infer<typeof vChunkerArgs>, null>;
|
|
472
489
|
/**
|
|
473
490
|
* Check if the args filter names are compatible with the existing filter names.
|
package/dist/shared.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIvD,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAGpC,eAAO,MAAM,YAAY;;cAA+B,CAAC;AACzD,eAAO,MAAM,QAAQ;;cAA2B,CAAC;AACjD,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACrD,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE7C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;wEAWxB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEvD,eAAO,MAAM,OAAO,iQAInB,CAAC;AACF,eAAO,MAAM,aAAa,0LAAoD,CAAC;AAC/E,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAC3C,eAAO,MAAM,QAAQ,sCAAsC,CAAC;AAE5D,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;0HASrB,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEjD,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACtE,O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IAC/C,iBAAiB,CACnB,UAAU,EACV,UAAU,EACV;IACE;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IACrC;;OAEG;IACH,aAAa,EAAE,KAAK,CAAC,OAAO,EAAE,aAAa,CAAC,GAAG,SAAS,CAAC;IACzD;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,EACD,IAAI,CACL,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2bAIvB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAC3C,QAAQ,EACR,UAAU,EACV,KAAK,CAAC,OAAO,YAAY,CAAC,EAC1B,IAAI,CACL,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,WAOpE"}
|
package/dist/shared.js
CHANGED
|
@@ -39,8 +39,9 @@ export const vEntry = v.object({
|
|
|
39
39
|
filterValues: v.array(vNamedFilter),
|
|
40
40
|
contentHash: v.optional(v.string()),
|
|
41
41
|
status: vStatus,
|
|
42
|
+
replacedAt: v.optional(v.number()),
|
|
42
43
|
});
|
|
43
|
-
// Type assertion to keep us honest
|
|
44
|
+
// Type assertion to keep us honest (modulo the replacedAt field)
|
|
44
45
|
const _1 = {};
|
|
45
46
|
const _2 = {};
|
|
46
47
|
export const vSearchEntry = v.object({
|
package/dist/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,OAAO,EAAE,YAAY,EAAo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L,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAC7B,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,EAC1B,CAAC,CAAC,IAAI,EAAE,CACT,CACF;KACF,CAAC,CAAC;AACL,CAAC;AAaD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,SAAS,EAAE,UAAU;IACrB,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;IACjC,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC9B,CAAC,CAAC;AA+BH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,SAAS,EAAE,UAAU;IACrB,KAAK,EAAE,MAAM;IACb,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;CACzB,CAAC,CAAC;AASH;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAkB,EAAE,IAAc;IACnE,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;QACxB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7B,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"email": "support@convex.dev",
|
|
8
8
|
"url": "https://github.com/get-convex/rag/issues"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.3.
|
|
10
|
+
"version": "0.3.2",
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"keywords": [
|
|
13
13
|
"convex",
|
|
@@ -51,11 +51,6 @@
|
|
|
51
51
|
"types": "./dist/client/index.d.ts",
|
|
52
52
|
"default": "./dist/client/index.js"
|
|
53
53
|
},
|
|
54
|
-
"./react": {
|
|
55
|
-
"@convex-dev/component-source": "./src/react/index.ts",
|
|
56
|
-
"types": "./dist/react/index.d.ts",
|
|
57
|
-
"default": "./dist/react/index.js"
|
|
58
|
-
},
|
|
59
54
|
"./convex.config": {
|
|
60
55
|
"@convex-dev/component-source": "./src/component/convex.config.ts",
|
|
61
56
|
"types": "./dist/component/convex.config.d.ts",
|
|
@@ -4,7 +4,7 @@ import { describe, test, expect } from "vitest";
|
|
|
4
4
|
describe("defaultChunker", () => {
|
|
5
5
|
test("handles empty text", () => {
|
|
6
6
|
expect(defaultChunker("")).toEqual([]);
|
|
7
|
-
expect(defaultChunker(" ")).toEqual([
|
|
7
|
+
expect(defaultChunker(" ")).toEqual([]);
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
test("chunks paragraphs that fit within limits", () => {
|
|
@@ -8,8 +8,8 @@ export function defaultChunker(
|
|
|
8
8
|
text: string,
|
|
9
9
|
{
|
|
10
10
|
minLines = 1,
|
|
11
|
-
minCharsSoftLimit =
|
|
12
|
-
maxCharsSoftLimit =
|
|
11
|
+
minCharsSoftLimit = 100,
|
|
12
|
+
maxCharsSoftLimit = 1000,
|
|
13
13
|
maxCharsHardLimit = 10000,
|
|
14
14
|
delimiter = "\n\n",
|
|
15
15
|
}: {
|
|
@@ -39,14 +39,22 @@ export function defaultChunker(
|
|
|
39
39
|
|
|
40
40
|
// If adding this line would exceed max chars, finalize current chunk first
|
|
41
41
|
if (potentialChunk.length > maxCharsSoftLimit && currentChunk.length > 0) {
|
|
42
|
-
const
|
|
43
|
-
|
|
42
|
+
const processedChunk = processChunkForOutput(
|
|
43
|
+
currentChunk,
|
|
44
|
+
lines,
|
|
45
|
+
i - currentChunk.length
|
|
46
|
+
);
|
|
47
|
+
if (processedChunk.trim()) {
|
|
48
|
+
chunks.push(processedChunk);
|
|
49
|
+
}
|
|
44
50
|
|
|
45
51
|
// Split the line if it exceeds hard limit
|
|
46
52
|
const splitLines = maybeSplitLine(line, maxCharsHardLimit);
|
|
47
53
|
// Add all but the last split piece as separate chunks
|
|
48
54
|
for (let j = 0; j < splitLines.length - 1; j++) {
|
|
49
|
-
|
|
55
|
+
if (splitLines[j].trim()) {
|
|
56
|
+
chunks.push(splitLines[j]);
|
|
57
|
+
}
|
|
50
58
|
}
|
|
51
59
|
// Keep the last piece for potential combination with next lines
|
|
52
60
|
currentChunk = [splitLines[splitLines.length - 1]];
|
|
@@ -61,8 +69,15 @@ export function defaultChunker(
|
|
|
61
69
|
) {
|
|
62
70
|
// Simple logic: only split if potential chunk would exceed the soft max limit
|
|
63
71
|
if (potentialChunk.length > maxCharsSoftLimit) {
|
|
64
|
-
// When splitting at delimiter boundary, preserve natural empty lines
|
|
65
|
-
|
|
72
|
+
// When splitting at delimiter boundary, preserve natural empty lines and trailing newlines
|
|
73
|
+
const processedChunk = processChunkForOutput(
|
|
74
|
+
currentChunk,
|
|
75
|
+
lines,
|
|
76
|
+
i - currentChunk.length
|
|
77
|
+
);
|
|
78
|
+
if (processedChunk.trim()) {
|
|
79
|
+
chunks.push(processedChunk);
|
|
80
|
+
}
|
|
66
81
|
currentChunk = [line];
|
|
67
82
|
continue;
|
|
68
83
|
}
|
|
@@ -79,20 +94,30 @@ export function defaultChunker(
|
|
|
79
94
|
if (splitLines.length > 1) {
|
|
80
95
|
// Line was split - add all but the last piece as separate chunks
|
|
81
96
|
for (let j = 0; j < splitLines.length - 1; j++) {
|
|
82
|
-
|
|
97
|
+
if (splitLines[j].trim()) {
|
|
98
|
+
chunks.push(splitLines[j]);
|
|
99
|
+
}
|
|
83
100
|
}
|
|
84
101
|
// Keep the last piece for potential combination with next lines
|
|
85
102
|
currentChunk = [splitLines[splitLines.length - 1]];
|
|
86
103
|
} else {
|
|
87
104
|
// Line doesn't exceed hard limit, keep it as is
|
|
88
|
-
|
|
105
|
+
if (line.trim()) {
|
|
106
|
+
chunks.push(line);
|
|
107
|
+
}
|
|
89
108
|
currentChunk = [];
|
|
90
109
|
}
|
|
91
110
|
} else {
|
|
92
111
|
// Remove last line and finalize chunk
|
|
93
112
|
const lastLine = currentChunk.pop()!;
|
|
94
|
-
const
|
|
95
|
-
|
|
113
|
+
const processedChunk = processChunkForOutput(
|
|
114
|
+
currentChunk,
|
|
115
|
+
lines,
|
|
116
|
+
i - currentChunk.length
|
|
117
|
+
);
|
|
118
|
+
if (processedChunk.trim()) {
|
|
119
|
+
chunks.push(processedChunk);
|
|
120
|
+
}
|
|
96
121
|
currentChunk = [lastLine];
|
|
97
122
|
}
|
|
98
123
|
}
|
|
@@ -104,14 +129,45 @@ export function defaultChunker(
|
|
|
104
129
|
if (remainingText.length > maxCharsHardLimit) {
|
|
105
130
|
// Split the remaining chunk if it exceeds hard limit
|
|
106
131
|
const splitLines = maybeSplitLine(remainingText, maxCharsHardLimit);
|
|
107
|
-
chunks.push(...splitLines);
|
|
132
|
+
chunks.push(...splitLines.filter((chunk) => chunk.trim()));
|
|
108
133
|
} else {
|
|
109
|
-
const
|
|
110
|
-
|
|
134
|
+
const processedChunk = processChunkForOutput(
|
|
135
|
+
currentChunk,
|
|
136
|
+
lines,
|
|
137
|
+
lines.length - currentChunk.length
|
|
138
|
+
);
|
|
139
|
+
if (processedChunk.trim()) {
|
|
140
|
+
chunks.push(processedChunk);
|
|
141
|
+
}
|
|
111
142
|
}
|
|
112
143
|
}
|
|
113
144
|
|
|
114
|
-
|
|
145
|
+
// Filter out any empty chunks that might have slipped through
|
|
146
|
+
return chunks.filter((chunk) => chunk.trim().length > 0);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function processChunkForOutput(
|
|
150
|
+
chunkLines: string[],
|
|
151
|
+
allLines: string[],
|
|
152
|
+
startIndex: number
|
|
153
|
+
): string {
|
|
154
|
+
if (chunkLines.length === 0) return "";
|
|
155
|
+
|
|
156
|
+
// Remove trailing empty lines but preserve meaningful structure
|
|
157
|
+
const trimmedLines = removeTrailingEmptyLines(chunkLines);
|
|
158
|
+
|
|
159
|
+
// Check if we should preserve some trailing newlines by looking at the original context
|
|
160
|
+
const endIndex = startIndex + chunkLines.length - 1;
|
|
161
|
+
const hasTrailingNewlines =
|
|
162
|
+
endIndex < allLines.length - 1 && chunkLines.length > trimmedLines.length;
|
|
163
|
+
|
|
164
|
+
// If we removed empty lines but there are more lines after this chunk,
|
|
165
|
+
// preserve one trailing newline to maintain paragraph separation
|
|
166
|
+
if (hasTrailingNewlines && trimmedLines.length > 0) {
|
|
167
|
+
return trimmedLines.join("\n") + "\n";
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return trimmedLines.join("\n");
|
|
115
171
|
}
|
|
116
172
|
|
|
117
173
|
function maybeSplitLine(line: string, maxCharsHardLimit: number): string[] {
|
|
@@ -176,8 +232,8 @@ function removeTrailingEmptyLines(lines: string[]): string[] {
|
|
|
176
232
|
}
|
|
177
233
|
}
|
|
178
234
|
|
|
179
|
-
// If all lines are empty,
|
|
180
|
-
return
|
|
235
|
+
// If all lines are empty, return empty array instead of keeping empty strings
|
|
236
|
+
return [];
|
|
181
237
|
}
|
|
182
238
|
|
|
183
239
|
export default defaultChunker;
|