@rcrsr/rill-ext-pinecone 0.8.6 → 0.9.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/README.md CHANGED
@@ -39,213 +39,16 @@ const result = await execute(parse(script), ctx);
39
39
  dispose?.();
40
40
  ```
41
41
 
42
- ## Host Functions
43
-
44
- All vector database extensions share identical function signatures. Swap `pinecone::` for `qdrant::` or `chroma::` with no script changes.
45
-
46
- ### pinecone::upsert(id, vector, metadata?)
47
-
48
- Insert or update a single vector with metadata.
49
-
50
- ```rill
51
- pinecone::upsert("doc-1", $embedding, [title: "Example", page: 1]) => $result
52
- $result.id -> log # "doc-1"
53
- $result.success -> log # true
54
- ```
55
-
56
- **Idempotent.** Duplicate ID overwrites existing vector.
57
-
58
- ### pinecone::upsert_batch(items)
59
-
60
- Batch insert or update vectors. Processes sequentially; halts on first failure.
61
-
62
- ```rill
63
- pinecone::upsert_batch([
64
- [id: "doc-1", vector: $v1, metadata: [title: "First"]],
65
- [id: "doc-2", vector: $v2, metadata: [title: "Second"]]
66
- ]) => $result
67
- $result.succeeded -> log # 2
68
- ```
69
-
70
- Returns `{ succeeded }` on success. Returns `{ succeeded, failed, error }` on failure.
71
-
72
- ### pinecone::search(vector, options?)
73
-
74
- Search for k nearest neighbors.
75
-
76
- ```rill
77
- pinecone::search($embedding, [k: 5, score_threshold: 0.8]) => $results
78
- $results -> each { "{.id}: {.score}" -> log }
79
- ```
80
-
81
- | Option | Type | Default | Description |
82
- |--------|------|---------|-------------|
83
- | `k` | number | `10` | Max results to return |
84
- | `filter` | dict | `{}` | Metadata filter conditions |
85
- | `score_threshold` | number | (none) | Exclude results below threshold |
86
-
87
- Returns `[{ id, score, metadata }]`. Empty results return `[]`.
88
-
89
- ### pinecone::get(id)
90
-
91
- Fetch a vector by ID.
92
-
93
- ```rill
94
- pinecone::get("doc-1") => $point
95
- $point.id -> log # "doc-1"
96
- $point.metadata -> log # [title: "Example", page: 1]
97
- ```
98
-
99
- Returns `{ id, vector, metadata }`. Halts with error if ID not found.
100
-
101
- ### pinecone::delete(id)
102
-
103
- Delete a vector by ID.
104
-
105
- ```rill
106
- pinecone::delete("doc-1") => $result
107
- $result.deleted -> log # true
108
- ```
109
-
110
- Returns `{ id, deleted }`. Halts with error if ID not found.
111
-
112
- ### pinecone::delete_batch(ids)
113
-
114
- Batch delete vectors. Processes sequentially; halts on first failure.
115
-
116
- ```rill
117
- pinecone::delete_batch(["doc-1", "doc-2", "doc-3"]) => $result
118
- $result.succeeded -> log # 3
119
- ```
120
-
121
- Returns `{ succeeded }` on success. Returns `{ succeeded, failed, error }` on failure.
122
-
123
- ### pinecone::count()
124
-
125
- Count vectors in the index.
126
-
127
- ```rill
128
- pinecone::count() -> log # 42
129
- ```
130
-
131
- Returns a number.
132
-
133
- ### pinecone::create_collection(name, options?)
134
-
135
- Create a new collection.
136
-
137
- ```rill
138
- pinecone::create_collection("my_vectors", [dimensions: 384, distance: "cosine"]) => $result
139
- $result.created -> log # true
140
- ```
141
-
142
- | Option | Type | Default | Description |
143
- |--------|------|---------|-------------|
144
- | `dimensions` | number | (none) | Vector dimension size |
145
- | `distance` | string | `"cosine"` | `"cosine"`, `"euclidean"`, or `"dot"` |
146
-
147
- Returns `{ name, created }`. **Not idempotent** — halts if collection exists.
148
-
149
- ### pinecone::delete_collection(id)
150
-
151
- Delete a collection.
152
-
153
- ```rill
154
- pinecone::delete_collection("old_vectors") => $result
155
- $result.deleted -> log # true
156
- ```
157
-
158
- Returns `{ name, deleted }`. **Not idempotent** — halts if collection not found.
159
-
160
- ### pinecone::list_collections()
161
-
162
- List all collection names.
163
-
164
- ```rill
165
- pinecone::list_collections() -> log # ["my_vectors", "archive"]
166
- ```
167
-
168
- Returns a list of strings.
169
-
170
- ### pinecone::describe()
171
-
172
- Describe the configured index.
173
-
174
- ```rill
175
- pinecone::describe() => $info
176
- $info.name -> log # "my-index"
177
- $info.count -> log # 42
178
- $info.dimensions -> log # 384
179
- $info.distance -> log # "cosine"
180
- ```
181
-
182
- Returns `{ name, count, dimensions, distance }`.
183
-
184
- ## Configuration
185
-
186
- ```typescript
187
- const ext = createPineconeExtension({
188
- apiKey: process.env.PINECONE_API_KEY!,
189
- index: 'my-index',
190
- namespace: 'production',
191
- timeout: 30000,
192
- });
193
- ```
194
-
195
- | Option | Type | Default | Description |
196
- |--------|------|---------|-------------|
197
- | `apiKey` | string | required | Pinecone API key |
198
- | `index` | string | required | Index name |
199
- | `namespace` | string | `''` | Namespace for partitioning |
200
- | `timeout` | number | `30000` | Request timeout in ms |
201
-
202
- ## Error Handling
203
-
204
- All errors use `RuntimeError('RILL-R004', 'pinecone: <message>')` and halt script execution.
205
-
206
- | Condition | Message |
207
- |-----------|---------|
208
- | HTTP 401 | `pinecone: authentication failed (401)` |
209
- | Collection not found | `pinecone: collection not found` |
210
- | Rate limit (429) | `pinecone: rate limit exceeded` |
211
- | Timeout | `pinecone: request timeout` |
212
- | Dimension mismatch | `pinecone: dimension mismatch (expected N, got M)` |
213
- | Collection exists | `pinecone: collection already exists` |
214
- | ID not found | `pinecone: id not found` |
215
- | After dispose | `pinecone: operation cancelled` |
216
- | Other | `pinecone: <error message>` |
217
-
218
- ## Cloud Setup
219
-
220
- Create a free account at [pinecone.io](https://www.pinecone.io). Find your API key in the Pinecone Console under **API Keys**.
221
-
222
- ```bash
223
- pinecone index create my-index \
224
- --dimension 384 \
225
- --metric cosine \
226
- --cloud aws \
227
- --region us-east-1
228
- ```
229
-
230
- Free tier includes 1 serverless index, 2GB storage, 10K vectors per namespace. See [Pinecone Pricing](https://www.pinecone.io/pricing/) for current limits.
231
-
232
- ## Lifecycle
233
-
234
- ```typescript
235
- const ext = createPineconeExtension({ ... });
236
- // ... use extension ...
237
- await ext.dispose?.();
238
- ```
42
+ ## Documentation
239
43
 
240
- `dispose()` aborts pending requests and closes the SDK client. Idempotent — second call resolves without error.
44
+ See [full documentation](docs/extension-vectordb-pinecone.md) for configuration, functions, error handling, and cloud setup.
241
45
 
242
- ## Documentation
46
+ ## Related
243
47
 
244
- | Document | Description |
245
- |----------|-------------|
246
- | [Extensions Guide](https://github.com/rcrsr/rill/blob/main/docs/integration-extensions.md) | Extension contract and patterns |
247
- | [Host API Reference](https://github.com/rcrsr/rill/blob/main/docs/ref-host-api.md) | Runtime context and host functions |
248
- | [Pinecone Documentation](https://docs.pinecone.io) | Official Pinecone docs |
48
+ - [rill](https://github.com/rcrsr/rill) Core language runtime
49
+ - [Extensions Guide](https://github.com/rcrsr/rill/blob/main/docs/integration-extensions.md) — Extension contract and patterns
50
+ - [Host API Reference](https://github.com/rcrsr/rill/blob/main/docs/ref-host-api.md) Runtime context and host functions
51
+ - [Pinecone Documentation](https://docs.pinecone.io) Official Pinecone docs
249
52
 
250
53
  ## License
251
54
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- import { ExtensionResult } from '@rcrsr/rill';
3
+ import { ExtensionConfigSchema, ExtensionResult } from '@rcrsr/rill';
4
4
 
5
5
  /**
6
6
  * Type definitions for Pinecone extension.
@@ -84,5 +84,6 @@ export type PineconeExtensionConfig = PineconeConfig;
84
84
  */
85
85
  export declare function createPineconeExtension(config: PineconeConfig): ExtensionResult;
86
86
  export declare const VERSION = "0.0.1";
87
+ export declare const configSchema: ExtensionConfigSchema;
87
88
 
88
89
  export {};
package/dist/index.js CHANGED
@@ -174,13 +174,15 @@ function createPineconeExtension(config) {
174
174
  { id },
175
175
  async () => {
176
176
  const index = client.Index(factoryIndex);
177
- await index.namespace(factoryNamespace).upsert([
178
- {
179
- id,
180
- values: Array.from(vector.data),
181
- metadata
182
- }
183
- ]);
177
+ await index.namespace(factoryNamespace).upsert({
178
+ records: [
179
+ {
180
+ id,
181
+ values: Array.from(vector.data),
182
+ metadata
183
+ }
184
+ ]
185
+ });
184
186
  return {
185
187
  id,
186
188
  success: true
@@ -224,13 +226,15 @@ function createPineconeExtension(config) {
224
226
  const metadataArg = item["metadata"] ?? {};
225
227
  const metadata = convertMetadata(metadataArg);
226
228
  try {
227
- await index.namespace(factoryNamespace).upsert([
228
- {
229
- id,
230
- values: Array.from(vector.data),
231
- metadata
232
- }
233
- ]);
229
+ await index.namespace(factoryNamespace).upsert({
230
+ records: [
231
+ {
232
+ id,
233
+ values: Array.from(vector.data),
234
+ metadata
235
+ }
236
+ ]
237
+ });
234
238
  succeeded++;
235
239
  } catch (error) {
236
240
  const rillError = mapPineconeError(error);
@@ -359,7 +363,7 @@ function createPineconeExtension(config) {
359
363
  { id },
360
364
  async () => {
361
365
  const index = client.Index(factoryIndex);
362
- const response = await index.namespace(factoryNamespace).fetch([id]);
366
+ const response = await index.namespace(factoryNamespace).fetch({ ids: [id] });
363
367
  if (!response.records || response.records[id] === void 0) {
364
368
  throw new RuntimeError4("RILL-R004", "pinecone: id not found");
365
369
  }
@@ -398,7 +402,7 @@ function createPineconeExtension(config) {
398
402
  async () => {
399
403
  const index = client.Index(factoryIndex);
400
404
  const ns = factoryNamespace || "";
401
- await index.namespace(ns).deleteOne(id);
405
+ await index.namespace(ns).deleteOne({ id });
402
406
  return {
403
407
  id,
404
408
  deleted: true
@@ -422,7 +426,7 @@ function createPineconeExtension(config) {
422
426
  for (let i = 0; i < ids.length; i++) {
423
427
  const id = ids[i];
424
428
  try {
425
- await index.namespace(factoryNamespace).deleteOne(id);
429
+ await index.namespace(factoryNamespace).deleteOne({ id });
426
430
  succeeded++;
427
431
  } catch (error) {
428
432
  const rillError = mapPineconeError(error);
@@ -627,7 +631,14 @@ function createPineconeExtension(config) {
627
631
 
628
632
  // src/index.ts
629
633
  var VERSION = "0.0.1";
634
+ var configSchema = {
635
+ apiKey: { type: "string", required: true, secret: true },
636
+ index: { type: "string", required: true },
637
+ namespace: { type: "string" },
638
+ timeout: { type: "number" }
639
+ };
630
640
  export {
631
641
  VERSION,
642
+ configSchema,
632
643
  createPineconeExtension
633
644
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rcrsr/rill-ext-pinecone",
3
- "version": "0.8.6",
3
+ "version": "0.9.0",
4
4
  "description": "rill extension for Pinecone vector database integration",
5
5
  "license": "MIT",
6
6
  "author": "Andre Bremer",
@@ -17,14 +17,14 @@
17
17
  "scripting"
18
18
  ],
19
19
  "peerDependencies": {
20
- "@rcrsr/rill": "^0.8.6"
20
+ "@rcrsr/rill": "^0.9.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@types/node": "^25.2.3",
23
+ "@rcrsr/rill": "^0.9.0",
24
+ "@types/node": "^25.3.0",
24
25
  "dts-bundle-generator": "^9.5.1",
25
- "tsup": "^8.5.0",
26
- "undici-types": "^7.21.0",
27
- "@rcrsr/rill": "^0.8.6",
26
+ "tsup": "^8.5.1",
27
+ "undici-types": "^7.22.0",
28
28
  "@rcrsr/rill-ext-vector-shared": "^0.0.1"
29
29
  },
30
30
  "files": [
@@ -32,18 +32,18 @@
32
32
  ],
33
33
  "repository": {
34
34
  "type": "git",
35
- "url": "git+https://github.com/rcrsr/rill.git",
35
+ "url": "git+https://github.com/rcrsr/rill-ext.git",
36
36
  "directory": "packages/ext/vectordb-pinecone"
37
37
  },
38
- "homepage": "https://rill.run/docs/extensions/pinecone/",
38
+ "homepage": "https://github.com/rcrsr/rill-ext/tree/main/packages/ext/vectordb-pinecone#readme",
39
39
  "bugs": {
40
- "url": "https://github.com/rcrsr/rill/issues"
40
+ "url": "https://github.com/rcrsr/rill-ext/issues"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  },
45
45
  "dependencies": {
46
- "@pinecone-database/pinecone": "^3.0.3"
46
+ "@pinecone-database/pinecone": "^7.1.0"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsup && dts-bundle-generator --config dts-bundle-generator.config.cjs",