@rcrsr/rill-ext-pinecone 0.11.0 → 0.16.0
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/dist/index.d.ts +3 -2
- package/dist/index.js +63 -42
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
-
import { ExtensionConfigSchema, ExtensionResult } from '@rcrsr/rill';
|
|
3
|
+
import { ExtensionConfigSchema, ExtensionManifest, ExtensionResult } from '@rcrsr/rill';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Type definitions for Pinecone extension.
|
|
@@ -83,7 +83,8 @@ export type PineconeExtensionConfig = PineconeConfig;
|
|
|
83
83
|
* ```
|
|
84
84
|
*/
|
|
85
85
|
export declare function createPineconeExtension(config: PineconeConfig): ExtensionResult;
|
|
86
|
-
export declare const VERSION
|
|
86
|
+
export declare const VERSION: string;
|
|
87
87
|
export declare const configSchema: ExtensionConfigSchema;
|
|
88
|
+
export declare const extensionManifest: ExtensionManifest;
|
|
88
89
|
|
|
89
90
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { createRequire } from "module";
|
|
3
|
+
|
|
1
4
|
// src/factory.ts
|
|
2
5
|
import { Pinecone } from "@pinecone-database/pinecone";
|
|
3
6
|
import {
|
|
4
7
|
RuntimeError as RuntimeError6,
|
|
5
8
|
emitExtensionEvent as emitExtensionEvent3,
|
|
6
|
-
createVector
|
|
9
|
+
createVector,
|
|
10
|
+
rillTypeToTypeValue
|
|
7
11
|
} from "@rcrsr/rill";
|
|
8
12
|
|
|
9
13
|
// ../../shared/ext-vector/dist/errors.js
|
|
@@ -202,13 +206,15 @@ var p = {
|
|
|
202
206
|
* @param name - Parameter name (must be a valid identifier)
|
|
203
207
|
* @param desc - Optional description
|
|
204
208
|
* @param def - Optional default value
|
|
205
|
-
* @
|
|
209
|
+
* @param fields - Optional structural field definitions (RillFieldDef with type and optional defaultValue)
|
|
210
|
+
* @returns RillParam with type 'dict' (with fields if provided)
|
|
206
211
|
*/
|
|
207
|
-
dict(name, desc, def) {
|
|
212
|
+
dict(name, desc, def, fields) {
|
|
208
213
|
validateParamName2(name);
|
|
214
|
+
const type = fields !== void 0 ? { type: "dict", fields } : { type: "dict" };
|
|
209
215
|
return {
|
|
210
216
|
name,
|
|
211
|
-
type
|
|
217
|
+
type,
|
|
212
218
|
defaultValue: def,
|
|
213
219
|
annotations: buildAnnotations(desc)
|
|
214
220
|
};
|
|
@@ -301,9 +307,9 @@ function createPineconeExtension(config) {
|
|
|
301
307
|
],
|
|
302
308
|
fn: async (args, ctx) => {
|
|
303
309
|
checkDisposed2();
|
|
304
|
-
const id = args[
|
|
305
|
-
const vector = args[
|
|
306
|
-
const metadataArg = args[
|
|
310
|
+
const id = args["id"];
|
|
311
|
+
const vector = args["vector"];
|
|
312
|
+
const metadataArg = args["metadata"] ?? {};
|
|
307
313
|
const metadata = convertMetadata(metadataArg);
|
|
308
314
|
return withEventEmission(
|
|
309
315
|
ctx,
|
|
@@ -328,8 +334,8 @@ function createPineconeExtension(config) {
|
|
|
328
334
|
}
|
|
329
335
|
);
|
|
330
336
|
},
|
|
331
|
-
description: "Insert or update single vector with metadata",
|
|
332
|
-
returnType: { type: "dict" }
|
|
337
|
+
annotations: { description: "Insert or update single vector with metadata" },
|
|
338
|
+
returnType: rillTypeToTypeValue({ type: "dict", fields: { id: { type: { type: "string" } }, success: { type: { type: "bool" } } } })
|
|
333
339
|
},
|
|
334
340
|
// IR-2: pinecone::upsert_batch
|
|
335
341
|
upsert_batch: {
|
|
@@ -338,7 +344,7 @@ function createPineconeExtension(config) {
|
|
|
338
344
|
const startTime = Date.now();
|
|
339
345
|
try {
|
|
340
346
|
checkDisposed2();
|
|
341
|
-
const items = args[
|
|
347
|
+
const items = args["items"];
|
|
342
348
|
let succeeded = 0;
|
|
343
349
|
const index = client.Index(factoryIndex);
|
|
344
350
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -413,19 +419,23 @@ function createPineconeExtension(config) {
|
|
|
413
419
|
throw rillError;
|
|
414
420
|
}
|
|
415
421
|
},
|
|
416
|
-
description: "Batch insert/update vectors",
|
|
417
|
-
returnType: { type: "dict" }
|
|
422
|
+
annotations: { description: "Batch insert/update vectors" },
|
|
423
|
+
returnType: rillTypeToTypeValue({ type: "dict", fields: { succeeded: { type: { type: "number" } }, failed: { type: { type: "string" } }, error: { type: { type: "string" } } } })
|
|
418
424
|
},
|
|
419
425
|
// IR-3: pinecone::search
|
|
420
426
|
search: {
|
|
421
427
|
params: [
|
|
422
428
|
vectorParam("vector"),
|
|
423
|
-
p.dict("options", void 0, {}
|
|
429
|
+
p.dict("options", void 0, {}, {
|
|
430
|
+
k: { type: { type: "number" }, defaultValue: 10 },
|
|
431
|
+
filter: { type: { type: "dict" }, defaultValue: {} },
|
|
432
|
+
score_threshold: { type: { type: "number" }, defaultValue: 0 }
|
|
433
|
+
})
|
|
424
434
|
],
|
|
425
435
|
fn: async (args, ctx) => {
|
|
426
436
|
checkDisposed2();
|
|
427
|
-
const vector = args[
|
|
428
|
-
const options = args[
|
|
437
|
+
const vector = args["vector"];
|
|
438
|
+
const options = args["options"] ?? {};
|
|
429
439
|
const k = typeof options["k"] === "number" ? options["k"] : 10;
|
|
430
440
|
const filter = options["filter"] ?? {};
|
|
431
441
|
const scoreThreshold = typeof options["score_threshold"] === "number" ? options["score_threshold"] : void 0;
|
|
@@ -485,15 +495,15 @@ function createPineconeExtension(config) {
|
|
|
485
495
|
throw rillError;
|
|
486
496
|
}
|
|
487
497
|
},
|
|
488
|
-
description: "Search k nearest neighbors",
|
|
489
|
-
returnType: { type: "list" }
|
|
498
|
+
annotations: { description: "Search k nearest neighbors" },
|
|
499
|
+
returnType: rillTypeToTypeValue({ type: "list", element: { type: "dict", fields: { id: { type: { type: "string" } }, score: { type: { type: "number" } }, metadata: { type: { type: "dict" } } } } })
|
|
490
500
|
},
|
|
491
501
|
// IR-4: pinecone::get
|
|
492
502
|
get: {
|
|
493
503
|
params: [p.str("id")],
|
|
494
504
|
fn: async (args, ctx) => {
|
|
495
505
|
checkDisposed2();
|
|
496
|
-
const id = args[
|
|
506
|
+
const id = args["id"];
|
|
497
507
|
return withEventEmission(
|
|
498
508
|
ctx,
|
|
499
509
|
"pinecone",
|
|
@@ -523,15 +533,15 @@ function createPineconeExtension(config) {
|
|
|
523
533
|
}
|
|
524
534
|
);
|
|
525
535
|
},
|
|
526
|
-
description: "Fetch vector by ID",
|
|
527
|
-
returnType: { type: "dict" }
|
|
536
|
+
annotations: { description: "Fetch vector by ID" },
|
|
537
|
+
returnType: rillTypeToTypeValue({ type: "dict", fields: { id: { type: { type: "string" } }, vector: { type: { type: "vector" } }, metadata: { type: { type: "dict" } } } })
|
|
528
538
|
},
|
|
529
539
|
// IR-5: pinecone::delete
|
|
530
540
|
delete: {
|
|
531
541
|
params: [p.str("id")],
|
|
532
542
|
fn: async (args, ctx) => {
|
|
533
543
|
checkDisposed2();
|
|
534
|
-
const id = args[
|
|
544
|
+
const id = args["id"];
|
|
535
545
|
return withEventEmission(
|
|
536
546
|
ctx,
|
|
537
547
|
"pinecone",
|
|
@@ -548,8 +558,8 @@ function createPineconeExtension(config) {
|
|
|
548
558
|
}
|
|
549
559
|
);
|
|
550
560
|
},
|
|
551
|
-
description: "Delete vector by ID",
|
|
552
|
-
returnType: { type: "dict" }
|
|
561
|
+
annotations: { description: "Delete vector by ID" },
|
|
562
|
+
returnType: rillTypeToTypeValue({ type: "dict", fields: { id: { type: { type: "string" } }, deleted: { type: { type: "bool" } } } })
|
|
553
563
|
},
|
|
554
564
|
// IR-6: pinecone::delete_batch
|
|
555
565
|
delete_batch: {
|
|
@@ -558,7 +568,7 @@ function createPineconeExtension(config) {
|
|
|
558
568
|
const startTime = Date.now();
|
|
559
569
|
try {
|
|
560
570
|
checkDisposed2();
|
|
561
|
-
const ids = args[
|
|
571
|
+
const ids = args["ids"];
|
|
562
572
|
let succeeded = 0;
|
|
563
573
|
const index = client.Index(factoryIndex);
|
|
564
574
|
for (let i = 0; i < ids.length; i++) {
|
|
@@ -605,8 +615,8 @@ function createPineconeExtension(config) {
|
|
|
605
615
|
throw rillError;
|
|
606
616
|
}
|
|
607
617
|
},
|
|
608
|
-
description: "Batch delete vectors",
|
|
609
|
-
returnType: { type: "dict" }
|
|
618
|
+
annotations: { description: "Batch delete vectors" },
|
|
619
|
+
returnType: rillTypeToTypeValue({ type: "dict", fields: { succeeded: { type: { type: "number" } }, failed: { type: { type: "string" } }, error: { type: { type: "string" } } } })
|
|
610
620
|
},
|
|
611
621
|
// IR-7: pinecone::count
|
|
612
622
|
count: {
|
|
@@ -626,19 +636,22 @@ function createPineconeExtension(config) {
|
|
|
626
636
|
}
|
|
627
637
|
);
|
|
628
638
|
},
|
|
629
|
-
description: "Return total vector count in collection",
|
|
630
|
-
returnType: { type: "number" }
|
|
639
|
+
annotations: { description: "Return total vector count in collection" },
|
|
640
|
+
returnType: rillTypeToTypeValue({ type: "number" })
|
|
631
641
|
},
|
|
632
642
|
// IR-8: pinecone::create_collection
|
|
633
643
|
create_collection: {
|
|
634
644
|
params: [
|
|
635
645
|
p.str("name"),
|
|
636
|
-
p.dict("options", void 0, {}
|
|
646
|
+
p.dict("options", void 0, {}, {
|
|
647
|
+
dimensions: { type: { type: "number" } },
|
|
648
|
+
distance: { type: { type: "string" }, defaultValue: "cosine" }
|
|
649
|
+
})
|
|
637
650
|
],
|
|
638
651
|
fn: async (args, ctx) => {
|
|
639
652
|
checkDisposed2();
|
|
640
|
-
const name = args[
|
|
641
|
-
const options = args[
|
|
653
|
+
const name = args["name"];
|
|
654
|
+
const options = args["options"] ?? {};
|
|
642
655
|
const dimensions = options["dimensions"];
|
|
643
656
|
const distance = options["distance"] ?? "cosine";
|
|
644
657
|
if (!dimensions || typeof dimensions !== "number" || dimensions <= 0) {
|
|
@@ -679,15 +692,15 @@ function createPineconeExtension(config) {
|
|
|
679
692
|
}
|
|
680
693
|
);
|
|
681
694
|
},
|
|
682
|
-
description: "Create new vector collection",
|
|
683
|
-
returnType: { type: "dict" }
|
|
695
|
+
annotations: { description: "Create new vector collection" },
|
|
696
|
+
returnType: rillTypeToTypeValue({ type: "dict", fields: { name: { type: { type: "string" } }, created: { type: { type: "bool" } } } })
|
|
684
697
|
},
|
|
685
698
|
// IR-9: pinecone::delete_collection
|
|
686
699
|
delete_collection: {
|
|
687
700
|
params: [p.str("name")],
|
|
688
701
|
fn: async (args, ctx) => {
|
|
689
702
|
checkDisposed2();
|
|
690
|
-
const name = args[
|
|
703
|
+
const name = args["name"];
|
|
691
704
|
return withEventEmission(
|
|
692
705
|
ctx,
|
|
693
706
|
"pinecone",
|
|
@@ -702,8 +715,8 @@ function createPineconeExtension(config) {
|
|
|
702
715
|
}
|
|
703
716
|
);
|
|
704
717
|
},
|
|
705
|
-
description: "Delete vector collection",
|
|
706
|
-
returnType: { type: "dict" }
|
|
718
|
+
annotations: { description: "Delete vector collection" },
|
|
719
|
+
returnType: rillTypeToTypeValue({ type: "dict", fields: { name: { type: { type: "string" } }, deleted: { type: { type: "bool" } } } })
|
|
707
720
|
},
|
|
708
721
|
// IR-10: pinecone::list_collections
|
|
709
722
|
list_collections: {
|
|
@@ -722,8 +735,8 @@ function createPineconeExtension(config) {
|
|
|
722
735
|
}
|
|
723
736
|
);
|
|
724
737
|
},
|
|
725
|
-
description: "List all collection names",
|
|
726
|
-
returnType: { type: "list" }
|
|
738
|
+
annotations: { description: "List all collection names" },
|
|
739
|
+
returnType: rillTypeToTypeValue({ type: "list", element: { type: "string" } })
|
|
727
740
|
},
|
|
728
741
|
// IR-11: pinecone::describe
|
|
729
742
|
describe: {
|
|
@@ -759,8 +772,8 @@ function createPineconeExtension(config) {
|
|
|
759
772
|
}
|
|
760
773
|
);
|
|
761
774
|
},
|
|
762
|
-
description: "Describe configured collection",
|
|
763
|
-
returnType: { type: "dict" }
|
|
775
|
+
annotations: { description: "Describe configured collection" },
|
|
776
|
+
returnType: rillTypeToTypeValue({ type: "dict", fields: { name: { type: { type: "string" } }, count: { type: { type: "number" } }, dimensions: { type: { type: "number" } }, distance: { type: { type: "string" } } } })
|
|
764
777
|
}
|
|
765
778
|
};
|
|
766
779
|
result.dispose = dispose2;
|
|
@@ -768,15 +781,23 @@ function createPineconeExtension(config) {
|
|
|
768
781
|
}
|
|
769
782
|
|
|
770
783
|
// src/index.ts
|
|
771
|
-
var
|
|
784
|
+
var _require = createRequire(import.meta.url);
|
|
785
|
+
var _pkg = _require("../package.json");
|
|
786
|
+
var VERSION = _pkg.version;
|
|
772
787
|
var configSchema = {
|
|
773
788
|
apiKey: { type: "string", required: true, secret: true },
|
|
774
789
|
index: { type: "string", required: true },
|
|
775
790
|
namespace: { type: "string" },
|
|
776
791
|
timeout: { type: "number" }
|
|
777
792
|
};
|
|
793
|
+
var extensionManifest = {
|
|
794
|
+
factory: createPineconeExtension,
|
|
795
|
+
configSchema,
|
|
796
|
+
version: VERSION
|
|
797
|
+
};
|
|
778
798
|
export {
|
|
779
799
|
VERSION,
|
|
780
800
|
configSchema,
|
|
781
|
-
createPineconeExtension
|
|
801
|
+
createPineconeExtension,
|
|
802
|
+
extensionManifest
|
|
782
803
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rcrsr/rill-ext-pinecone",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "rill extension for Pinecone vector database integration",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Andre Bremer",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"scripting"
|
|
18
18
|
],
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@rcrsr/rill": "
|
|
20
|
+
"@rcrsr/rill": "~0.16.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@rcrsr/rill": "
|
|
23
|
+
"@rcrsr/rill": "~0.16.0",
|
|
24
24
|
"@types/node": "^25.3.0",
|
|
25
25
|
"dts-bundle-generator": "^9.5.1",
|
|
26
26
|
"tsup": "^8.5.1",
|