@rcrsr/rill-ext-pinecone 0.0.1
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 +21 -0
- package/README.md +252 -0
- package/dist/factory.d.ts +26 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +597 -0
- package/dist/factory.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +63 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andre Bremer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# @rcrsr/rill-ext-pinecone
|
|
2
|
+
|
|
3
|
+
[rill](https://rill.run) extension for [Pinecone](https://www.pinecone.io) vector database integration. Provides 11 host functions for vector CRUD, batch operations, and collection management.
|
|
4
|
+
|
|
5
|
+
> **Experimental.** Breaking changes will occur before stabilization.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @rcrsr/rill-ext-pinecone
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Peer dependencies:** `@rcrsr/rill`
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { parse, execute, createRuntimeContext, prefixFunctions } from '@rcrsr/rill';
|
|
19
|
+
import { createPineconeExtension } from '@rcrsr/rill-ext-pinecone';
|
|
20
|
+
|
|
21
|
+
const ext = createPineconeExtension({
|
|
22
|
+
apiKey: process.env.PINECONE_API_KEY!,
|
|
23
|
+
index: 'my-index',
|
|
24
|
+
});
|
|
25
|
+
const prefixed = prefixFunctions('pinecone', ext);
|
|
26
|
+
const { dispose, ...functions } = prefixed;
|
|
27
|
+
|
|
28
|
+
const ctx = createRuntimeContext({
|
|
29
|
+
functions,
|
|
30
|
+
callbacks: { onLog: (v) => console.log(v) },
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const script = `
|
|
34
|
+
pinecone::upsert("doc-1", $embedding, [title: "Example"])
|
|
35
|
+
pinecone::search($embedding, [k: 5]) -> log
|
|
36
|
+
`;
|
|
37
|
+
const result = await execute(parse(script), ctx);
|
|
38
|
+
|
|
39
|
+
dispose?.();
|
|
40
|
+
```
|
|
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
|
+
```
|
|
239
|
+
|
|
240
|
+
`dispose()` aborts pending requests and closes the SDK client. Idempotent — second call resolves without error.
|
|
241
|
+
|
|
242
|
+
## Documentation
|
|
243
|
+
|
|
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 |
|
|
249
|
+
|
|
250
|
+
## License
|
|
251
|
+
|
|
252
|
+
MIT
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension factory for Pinecone vector database integration.
|
|
3
|
+
* Creates extension instance with config validation and SDK lifecycle management.
|
|
4
|
+
*/
|
|
5
|
+
import { type ExtensionResult } from '@rcrsr/rill';
|
|
6
|
+
import type { PineconeConfig } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Create Pinecone extension instance.
|
|
9
|
+
* Validates configuration and returns host functions with cleanup.
|
|
10
|
+
*
|
|
11
|
+
* @param config - Extension configuration
|
|
12
|
+
* @returns ExtensionResult with 11 vector database functions and dispose
|
|
13
|
+
* @throws Error for invalid configuration (AC-10)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const ext = createPineconeExtension({
|
|
18
|
+
* apiKey: 'your-api-key',
|
|
19
|
+
* index: 'my-index',
|
|
20
|
+
* });
|
|
21
|
+
* // Use with rill runtime...
|
|
22
|
+
* await ext.dispose();
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function createPineconeExtension(config: PineconeConfig): ExtensionResult;
|
|
26
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAIL,KAAK,eAAe,EAIrB,MAAM,aAAa,CAAC;AAUrB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA2CjD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,cAAc,GACrB,eAAe,CA2rBjB"}
|
package/dist/factory.js
ADDED
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension factory for Pinecone vector database integration.
|
|
3
|
+
* Creates extension instance with config validation and SDK lifecycle management.
|
|
4
|
+
*/
|
|
5
|
+
import { Pinecone } from '@pinecone-database/pinecone';
|
|
6
|
+
import { RuntimeError, emitExtensionEvent, createVector, } from '@rcrsr/rill';
|
|
7
|
+
import { mapVectorError, withEventEmission, createDisposalState, checkDisposed as sharedCheckDisposed, dispose as sharedDispose, assertRequired, } from '@rcrsr/rill-ext-vector-shared';
|
|
8
|
+
// ============================================================
|
|
9
|
+
// HELPER FUNCTIONS
|
|
10
|
+
// ============================================================
|
|
11
|
+
/**
|
|
12
|
+
* Map Pinecone SDK error to RuntimeError with Pinecone-specific checks.
|
|
13
|
+
* Adds "authentication" keyword check and "index" to "collection" translation.
|
|
14
|
+
*
|
|
15
|
+
* @param error - Error from Pinecone SDK
|
|
16
|
+
* @returns RuntimeError with appropriate message
|
|
17
|
+
*/
|
|
18
|
+
function mapPineconeError(error) {
|
|
19
|
+
// Pinecone-specific: Check for "authentication" keyword (IR-1)
|
|
20
|
+
if (error instanceof Error) {
|
|
21
|
+
const message = error.message;
|
|
22
|
+
if (message.toLowerCase().includes('authentication')) {
|
|
23
|
+
return new RuntimeError('RILL-R004', 'pinecone: authentication failed (401)');
|
|
24
|
+
}
|
|
25
|
+
// Special handling for "index" instead of "collection" in error messages
|
|
26
|
+
// This must be checked before delegating to shared mapper
|
|
27
|
+
if (message.toLowerCase().includes('index') &&
|
|
28
|
+
message.toLowerCase().includes('not found')) {
|
|
29
|
+
return new RuntimeError('RILL-R004', 'pinecone: collection not found');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// Delegate to shared error mapper for common error patterns
|
|
33
|
+
return mapVectorError('pinecone', error);
|
|
34
|
+
}
|
|
35
|
+
// Validation functions removed - now using assertRequired from shared utilities
|
|
36
|
+
// ============================================================
|
|
37
|
+
// FACTORY
|
|
38
|
+
// ============================================================
|
|
39
|
+
/**
|
|
40
|
+
* Create Pinecone extension instance.
|
|
41
|
+
* Validates configuration and returns host functions with cleanup.
|
|
42
|
+
*
|
|
43
|
+
* @param config - Extension configuration
|
|
44
|
+
* @returns ExtensionResult with 11 vector database functions and dispose
|
|
45
|
+
* @throws Error for invalid configuration (AC-10)
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const ext = createPineconeExtension({
|
|
50
|
+
* apiKey: 'your-api-key',
|
|
51
|
+
* index: 'my-index',
|
|
52
|
+
* });
|
|
53
|
+
* // Use with rill runtime...
|
|
54
|
+
* await ext.dispose();
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export function createPineconeExtension(config) {
|
|
58
|
+
// Validate required fields using shared assertRequired (AC-10)
|
|
59
|
+
assertRequired(config.apiKey, 'apiKey');
|
|
60
|
+
assertRequired(config.index, 'index');
|
|
61
|
+
// Instantiate SDK client at factory time
|
|
62
|
+
const client = new Pinecone({
|
|
63
|
+
apiKey: config.apiKey,
|
|
64
|
+
});
|
|
65
|
+
// Store config values for use in functions
|
|
66
|
+
const factoryIndex = config.index;
|
|
67
|
+
const factoryNamespace = config.namespace ?? '';
|
|
68
|
+
// Create disposal state using shared utility (IR-4)
|
|
69
|
+
const disposalState = createDisposalState('pinecone');
|
|
70
|
+
// Dispose function for cleanup using shared utility (AC-31, AC-32, IR-6)
|
|
71
|
+
const dispose = async () => {
|
|
72
|
+
await sharedDispose(disposalState);
|
|
73
|
+
};
|
|
74
|
+
// Helper to check if disposed using shared utility (EC-8, IR-5)
|
|
75
|
+
const checkDisposed = () => {
|
|
76
|
+
sharedCheckDisposed(disposalState, 'pinecone');
|
|
77
|
+
};
|
|
78
|
+
// Convert RillValue metadata to Pinecone-compatible format
|
|
79
|
+
const convertMetadata = (input) => {
|
|
80
|
+
const result = {};
|
|
81
|
+
for (const [key, value] of Object.entries(input)) {
|
|
82
|
+
if (typeof value === 'string' ||
|
|
83
|
+
typeof value === 'number' ||
|
|
84
|
+
typeof value === 'boolean') {
|
|
85
|
+
result[key] = value;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
result[key] = String(value);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
};
|
|
93
|
+
// Return extension result with implementations
|
|
94
|
+
const result = {
|
|
95
|
+
// IR-1: pinecone::upsert
|
|
96
|
+
upsert: {
|
|
97
|
+
params: [
|
|
98
|
+
{ name: 'id', type: 'string' },
|
|
99
|
+
{ name: 'vector', type: 'vector' },
|
|
100
|
+
{ name: 'metadata', type: 'dict', defaultValue: {} },
|
|
101
|
+
],
|
|
102
|
+
fn: async (args, ctx) => {
|
|
103
|
+
checkDisposed();
|
|
104
|
+
// Extract arguments
|
|
105
|
+
const id = args[0];
|
|
106
|
+
const vector = args[1];
|
|
107
|
+
const metadataArg = (args[2] ?? {});
|
|
108
|
+
// Convert metadata
|
|
109
|
+
const metadata = convertMetadata(metadataArg);
|
|
110
|
+
// Use shared withEventEmission wrapper (IR-2)
|
|
111
|
+
return withEventEmission(ctx, 'pinecone', 'upsert', { id }, async () => {
|
|
112
|
+
// Get index handle
|
|
113
|
+
const index = client.Index(factoryIndex);
|
|
114
|
+
// Call Pinecone API
|
|
115
|
+
await index.namespace(factoryNamespace).upsert([
|
|
116
|
+
{
|
|
117
|
+
id,
|
|
118
|
+
values: Array.from(vector.data),
|
|
119
|
+
metadata,
|
|
120
|
+
},
|
|
121
|
+
]);
|
|
122
|
+
// Build and return result
|
|
123
|
+
return {
|
|
124
|
+
id,
|
|
125
|
+
success: true,
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
description: 'Insert or update single vector with metadata',
|
|
130
|
+
returnType: 'dict',
|
|
131
|
+
},
|
|
132
|
+
// IR-2: pinecone::upsert_batch
|
|
133
|
+
upsert_batch: {
|
|
134
|
+
params: [{ name: 'items', type: 'list' }],
|
|
135
|
+
fn: async (args, ctx) => {
|
|
136
|
+
const startTime = Date.now();
|
|
137
|
+
try {
|
|
138
|
+
checkDisposed();
|
|
139
|
+
// Extract arguments
|
|
140
|
+
const items = args[0];
|
|
141
|
+
let succeeded = 0;
|
|
142
|
+
// Get index handle
|
|
143
|
+
const index = client.Index(factoryIndex);
|
|
144
|
+
// Process sequentially; halt on first failure
|
|
145
|
+
for (let i = 0; i < items.length; i++) {
|
|
146
|
+
const item = items[i];
|
|
147
|
+
// Validate item structure
|
|
148
|
+
if (!item || typeof item !== 'object') {
|
|
149
|
+
const result = {
|
|
150
|
+
succeeded,
|
|
151
|
+
failed: `index ${i}`,
|
|
152
|
+
error: 'invalid item structure',
|
|
153
|
+
};
|
|
154
|
+
const duration = Date.now() - startTime;
|
|
155
|
+
emitExtensionEvent(ctx, {
|
|
156
|
+
event: 'pinecone:upsert_batch',
|
|
157
|
+
subsystem: 'extension:pinecone',
|
|
158
|
+
duration,
|
|
159
|
+
count: items.length,
|
|
160
|
+
succeeded,
|
|
161
|
+
});
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
const id = item['id'];
|
|
165
|
+
const vector = item['vector'];
|
|
166
|
+
const metadataArg = (item['metadata'] ?? {});
|
|
167
|
+
// Convert metadata
|
|
168
|
+
const metadata = convertMetadata(metadataArg);
|
|
169
|
+
try {
|
|
170
|
+
// Call Pinecone API
|
|
171
|
+
await index.namespace(factoryNamespace).upsert([
|
|
172
|
+
{
|
|
173
|
+
id,
|
|
174
|
+
values: Array.from(vector.data),
|
|
175
|
+
metadata,
|
|
176
|
+
},
|
|
177
|
+
]);
|
|
178
|
+
succeeded++;
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
// Halt on first failure
|
|
182
|
+
const rillError = mapPineconeError(error);
|
|
183
|
+
const result = {
|
|
184
|
+
succeeded,
|
|
185
|
+
failed: id,
|
|
186
|
+
error: rillError.message,
|
|
187
|
+
};
|
|
188
|
+
const duration = Date.now() - startTime;
|
|
189
|
+
emitExtensionEvent(ctx, {
|
|
190
|
+
event: 'pinecone:upsert_batch',
|
|
191
|
+
subsystem: 'extension:pinecone',
|
|
192
|
+
duration,
|
|
193
|
+
count: items.length,
|
|
194
|
+
succeeded,
|
|
195
|
+
});
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// All succeeded - emit single success event
|
|
200
|
+
const duration = Date.now() - startTime;
|
|
201
|
+
emitExtensionEvent(ctx, {
|
|
202
|
+
event: 'pinecone:upsert_batch',
|
|
203
|
+
subsystem: 'extension:pinecone',
|
|
204
|
+
duration,
|
|
205
|
+
count: items.length,
|
|
206
|
+
succeeded,
|
|
207
|
+
});
|
|
208
|
+
return { succeeded };
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
// Map error and emit failure event
|
|
212
|
+
const duration = Date.now() - startTime;
|
|
213
|
+
const rillError = mapPineconeError(error);
|
|
214
|
+
emitExtensionEvent(ctx, {
|
|
215
|
+
event: 'pinecone:error',
|
|
216
|
+
subsystem: 'extension:pinecone',
|
|
217
|
+
error: rillError.message,
|
|
218
|
+
duration,
|
|
219
|
+
});
|
|
220
|
+
throw rillError;
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
description: 'Batch insert/update vectors',
|
|
224
|
+
returnType: 'dict',
|
|
225
|
+
},
|
|
226
|
+
// IR-3: pinecone::search
|
|
227
|
+
search: {
|
|
228
|
+
params: [
|
|
229
|
+
{ name: 'vector', type: 'vector' },
|
|
230
|
+
{ name: 'options', type: 'dict', defaultValue: {} },
|
|
231
|
+
],
|
|
232
|
+
fn: async (args, ctx) => {
|
|
233
|
+
checkDisposed();
|
|
234
|
+
// Extract arguments
|
|
235
|
+
const vector = args[0];
|
|
236
|
+
const options = (args[1] ?? {});
|
|
237
|
+
// Extract options with defaults
|
|
238
|
+
const k = typeof options['k'] === 'number' ? options['k'] : 10;
|
|
239
|
+
const filter = (options['filter'] ?? {});
|
|
240
|
+
const scoreThreshold = typeof options['score_threshold'] === 'number'
|
|
241
|
+
? options['score_threshold']
|
|
242
|
+
: undefined;
|
|
243
|
+
// Manual event emission for search (needs result_count after operation)
|
|
244
|
+
const startTime = Date.now();
|
|
245
|
+
try {
|
|
246
|
+
// Get index handle
|
|
247
|
+
const index = client.Index(factoryIndex);
|
|
248
|
+
// Build search request
|
|
249
|
+
const searchRequest = {
|
|
250
|
+
vector: Array.from(vector.data),
|
|
251
|
+
topK: k,
|
|
252
|
+
includeMetadata: true,
|
|
253
|
+
};
|
|
254
|
+
if (Object.keys(filter).length > 0) {
|
|
255
|
+
searchRequest.filter = filter;
|
|
256
|
+
}
|
|
257
|
+
// Call Pinecone API
|
|
258
|
+
const response = await index
|
|
259
|
+
.namespace(factoryNamespace)
|
|
260
|
+
.query(searchRequest);
|
|
261
|
+
// Build result list
|
|
262
|
+
const results = (response.matches ?? []).map((hit) => {
|
|
263
|
+
const metadata = {};
|
|
264
|
+
if (hit.metadata) {
|
|
265
|
+
for (const [key, value] of Object.entries(hit.metadata)) {
|
|
266
|
+
if (typeof value === 'string' ||
|
|
267
|
+
typeof value === 'number' ||
|
|
268
|
+
typeof value === 'boolean') {
|
|
269
|
+
metadata[key] = value;
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
metadata[key] = String(value);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
id: hit.id,
|
|
278
|
+
score: hit.score ?? 0,
|
|
279
|
+
metadata,
|
|
280
|
+
};
|
|
281
|
+
});
|
|
282
|
+
// Filter by score_threshold if provided
|
|
283
|
+
let filtered = results;
|
|
284
|
+
if (scoreThreshold !== undefined && Array.isArray(results)) {
|
|
285
|
+
filtered = results.filter((r) => (r['score'] ?? 0) >= scoreThreshold);
|
|
286
|
+
}
|
|
287
|
+
// Emit success event with actual result_count
|
|
288
|
+
const duration = Date.now() - startTime;
|
|
289
|
+
emitExtensionEvent(ctx, {
|
|
290
|
+
event: 'pinecone:search',
|
|
291
|
+
subsystem: 'extension:pinecone',
|
|
292
|
+
duration,
|
|
293
|
+
result_count: Array.isArray(filtered) ? filtered.length : 0,
|
|
294
|
+
k,
|
|
295
|
+
});
|
|
296
|
+
return filtered;
|
|
297
|
+
}
|
|
298
|
+
catch (error) {
|
|
299
|
+
// Map error and emit failure event
|
|
300
|
+
const duration = Date.now() - startTime;
|
|
301
|
+
const rillError = mapPineconeError(error);
|
|
302
|
+
emitExtensionEvent(ctx, {
|
|
303
|
+
event: 'pinecone:error',
|
|
304
|
+
subsystem: 'extension:pinecone',
|
|
305
|
+
error: rillError.message,
|
|
306
|
+
duration,
|
|
307
|
+
});
|
|
308
|
+
throw rillError;
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
description: 'Search k nearest neighbors',
|
|
312
|
+
returnType: 'list',
|
|
313
|
+
},
|
|
314
|
+
// IR-4: pinecone::get
|
|
315
|
+
get: {
|
|
316
|
+
params: [{ name: 'id', type: 'string' }],
|
|
317
|
+
fn: async (args, ctx) => {
|
|
318
|
+
checkDisposed();
|
|
319
|
+
// Extract arguments
|
|
320
|
+
const id = args[0];
|
|
321
|
+
// Use shared withEventEmission wrapper (IR-2)
|
|
322
|
+
return withEventEmission(ctx, 'pinecone', 'get', { id }, async () => {
|
|
323
|
+
// Get index handle
|
|
324
|
+
const index = client.Index(factoryIndex);
|
|
325
|
+
// Call Pinecone API
|
|
326
|
+
const response = await index
|
|
327
|
+
.namespace(factoryNamespace)
|
|
328
|
+
.fetch([id]);
|
|
329
|
+
// EC-7: ID not found
|
|
330
|
+
if (!response.records || response.records[id] === undefined) {
|
|
331
|
+
throw new RuntimeError('RILL-R004', 'pinecone: id not found');
|
|
332
|
+
}
|
|
333
|
+
const record = response.records[id];
|
|
334
|
+
const vectorData = record.values;
|
|
335
|
+
// Validate vector data
|
|
336
|
+
if (!vectorData || !Array.isArray(vectorData)) {
|
|
337
|
+
throw new RuntimeError('RILL-R004', 'pinecone: invalid vector format');
|
|
338
|
+
}
|
|
339
|
+
const float32Data = new Float32Array(vectorData);
|
|
340
|
+
const vector = createVector(float32Data, factoryIndex);
|
|
341
|
+
// Build and return result
|
|
342
|
+
return {
|
|
343
|
+
id,
|
|
344
|
+
vector,
|
|
345
|
+
metadata: record.metadata ?? {},
|
|
346
|
+
};
|
|
347
|
+
});
|
|
348
|
+
},
|
|
349
|
+
description: 'Fetch vector by ID',
|
|
350
|
+
returnType: 'dict',
|
|
351
|
+
},
|
|
352
|
+
// IR-5: pinecone::delete
|
|
353
|
+
delete: {
|
|
354
|
+
params: [{ name: 'id', type: 'string' }],
|
|
355
|
+
fn: async (args, ctx) => {
|
|
356
|
+
checkDisposed();
|
|
357
|
+
// Extract arguments
|
|
358
|
+
const id = args[0];
|
|
359
|
+
// Use shared withEventEmission wrapper (IR-2)
|
|
360
|
+
return withEventEmission(ctx, 'pinecone', 'delete', { id }, async () => {
|
|
361
|
+
// Get index handle
|
|
362
|
+
const index = client.Index(factoryIndex);
|
|
363
|
+
// Call Pinecone API
|
|
364
|
+
const ns = factoryNamespace || '';
|
|
365
|
+
await index.namespace(ns).deleteOne(id);
|
|
366
|
+
// Build and return result
|
|
367
|
+
return {
|
|
368
|
+
id,
|
|
369
|
+
deleted: true,
|
|
370
|
+
};
|
|
371
|
+
});
|
|
372
|
+
},
|
|
373
|
+
description: 'Delete vector by ID',
|
|
374
|
+
returnType: 'dict',
|
|
375
|
+
},
|
|
376
|
+
// IR-6: pinecone::delete_batch
|
|
377
|
+
delete_batch: {
|
|
378
|
+
params: [{ name: 'ids', type: 'list' }],
|
|
379
|
+
fn: async (args, ctx) => {
|
|
380
|
+
const startTime = Date.now();
|
|
381
|
+
try {
|
|
382
|
+
checkDisposed();
|
|
383
|
+
// Extract arguments
|
|
384
|
+
const ids = args[0];
|
|
385
|
+
let succeeded = 0;
|
|
386
|
+
// Get index handle
|
|
387
|
+
const index = client.Index(factoryIndex);
|
|
388
|
+
// Process sequentially; halt on first failure
|
|
389
|
+
for (let i = 0; i < ids.length; i++) {
|
|
390
|
+
const id = ids[i];
|
|
391
|
+
try {
|
|
392
|
+
// Call Pinecone API
|
|
393
|
+
await index.namespace(factoryNamespace).deleteOne(id);
|
|
394
|
+
succeeded++;
|
|
395
|
+
}
|
|
396
|
+
catch (error) {
|
|
397
|
+
// Halt on first failure
|
|
398
|
+
const rillError = mapPineconeError(error);
|
|
399
|
+
const result = {
|
|
400
|
+
succeeded,
|
|
401
|
+
failed: id,
|
|
402
|
+
error: rillError.message,
|
|
403
|
+
};
|
|
404
|
+
const duration = Date.now() - startTime;
|
|
405
|
+
emitExtensionEvent(ctx, {
|
|
406
|
+
event: 'pinecone:delete_batch',
|
|
407
|
+
subsystem: 'extension:pinecone',
|
|
408
|
+
duration,
|
|
409
|
+
count: ids.length,
|
|
410
|
+
succeeded,
|
|
411
|
+
});
|
|
412
|
+
return result;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
// All succeeded - emit single success event
|
|
416
|
+
const duration = Date.now() - startTime;
|
|
417
|
+
emitExtensionEvent(ctx, {
|
|
418
|
+
event: 'pinecone:delete_batch',
|
|
419
|
+
subsystem: 'extension:pinecone',
|
|
420
|
+
duration,
|
|
421
|
+
count: ids.length,
|
|
422
|
+
succeeded,
|
|
423
|
+
});
|
|
424
|
+
return { succeeded };
|
|
425
|
+
}
|
|
426
|
+
catch (error) {
|
|
427
|
+
// Map error and emit failure event
|
|
428
|
+
const duration = Date.now() - startTime;
|
|
429
|
+
const rillError = mapPineconeError(error);
|
|
430
|
+
emitExtensionEvent(ctx, {
|
|
431
|
+
event: 'pinecone:error',
|
|
432
|
+
subsystem: 'extension:pinecone',
|
|
433
|
+
error: rillError.message,
|
|
434
|
+
duration,
|
|
435
|
+
});
|
|
436
|
+
throw rillError;
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
description: 'Batch delete vectors',
|
|
440
|
+
returnType: 'dict',
|
|
441
|
+
},
|
|
442
|
+
// IR-7: pinecone::count
|
|
443
|
+
count: {
|
|
444
|
+
params: [],
|
|
445
|
+
fn: async (_args, ctx) => {
|
|
446
|
+
checkDisposed();
|
|
447
|
+
// Use shared withEventEmission wrapper (IR-2)
|
|
448
|
+
return withEventEmission(ctx, 'pinecone', 'count', {}, async () => {
|
|
449
|
+
// Get index handle
|
|
450
|
+
const index = client.Index(factoryIndex);
|
|
451
|
+
// Call Pinecone API to get index stats
|
|
452
|
+
const stats = await index.describeIndexStats();
|
|
453
|
+
// Extract count from the target namespace
|
|
454
|
+
const count = stats.namespaces?.[factoryNamespace]?.recordCount ?? 0;
|
|
455
|
+
return count;
|
|
456
|
+
});
|
|
457
|
+
},
|
|
458
|
+
description: 'Return total vector count in collection',
|
|
459
|
+
returnType: 'number',
|
|
460
|
+
},
|
|
461
|
+
// IR-8: pinecone::create_collection
|
|
462
|
+
create_collection: {
|
|
463
|
+
params: [
|
|
464
|
+
{ name: 'name', type: 'string' },
|
|
465
|
+
{ name: 'options', type: 'dict', defaultValue: {} },
|
|
466
|
+
],
|
|
467
|
+
fn: async (args, ctx) => {
|
|
468
|
+
checkDisposed();
|
|
469
|
+
// Extract arguments
|
|
470
|
+
const name = args[0];
|
|
471
|
+
const options = (args[1] ?? {});
|
|
472
|
+
// Extract options
|
|
473
|
+
const dimensions = options['dimensions'];
|
|
474
|
+
const distance = options['distance'] ?? 'cosine';
|
|
475
|
+
// Validate dimensions
|
|
476
|
+
if (!dimensions || typeof dimensions !== 'number' || dimensions <= 0) {
|
|
477
|
+
throw new RuntimeError('RILL-R004', 'pinecone: dimensions must be a positive integer');
|
|
478
|
+
}
|
|
479
|
+
// Use shared withEventEmission wrapper (IR-2)
|
|
480
|
+
return withEventEmission(ctx, 'pinecone', 'create_collection', { name }, async () => {
|
|
481
|
+
// Map distance metric to Pinecone format
|
|
482
|
+
let pineconeMetric;
|
|
483
|
+
if (distance === 'cosine') {
|
|
484
|
+
pineconeMetric = 'cosine';
|
|
485
|
+
}
|
|
486
|
+
else if (distance === 'euclidean') {
|
|
487
|
+
pineconeMetric = 'euclidean';
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
pineconeMetric = 'dotproduct';
|
|
491
|
+
}
|
|
492
|
+
// Call Pinecone API to create serverless index
|
|
493
|
+
await client.createIndex({
|
|
494
|
+
name,
|
|
495
|
+
dimension: dimensions,
|
|
496
|
+
metric: pineconeMetric,
|
|
497
|
+
spec: {
|
|
498
|
+
serverless: {
|
|
499
|
+
cloud: 'aws',
|
|
500
|
+
region: 'us-east-1',
|
|
501
|
+
},
|
|
502
|
+
},
|
|
503
|
+
});
|
|
504
|
+
// Build and return result
|
|
505
|
+
return {
|
|
506
|
+
name,
|
|
507
|
+
created: true,
|
|
508
|
+
};
|
|
509
|
+
});
|
|
510
|
+
},
|
|
511
|
+
description: 'Create new vector collection',
|
|
512
|
+
returnType: 'dict',
|
|
513
|
+
},
|
|
514
|
+
// IR-9: pinecone::delete_collection
|
|
515
|
+
delete_collection: {
|
|
516
|
+
params: [{ name: 'name', type: 'string' }],
|
|
517
|
+
fn: async (args, ctx) => {
|
|
518
|
+
checkDisposed();
|
|
519
|
+
// Extract arguments
|
|
520
|
+
const name = args[0];
|
|
521
|
+
// Use shared withEventEmission wrapper (IR-2)
|
|
522
|
+
return withEventEmission(ctx, 'pinecone', 'delete_collection', { name }, async () => {
|
|
523
|
+
// Call Pinecone API to delete index
|
|
524
|
+
await client.deleteIndex(name);
|
|
525
|
+
// Build and return result
|
|
526
|
+
return {
|
|
527
|
+
name,
|
|
528
|
+
deleted: true,
|
|
529
|
+
};
|
|
530
|
+
});
|
|
531
|
+
},
|
|
532
|
+
description: 'Delete vector collection',
|
|
533
|
+
returnType: 'dict',
|
|
534
|
+
},
|
|
535
|
+
// IR-10: pinecone::list_collections
|
|
536
|
+
list_collections: {
|
|
537
|
+
params: [],
|
|
538
|
+
fn: async (_args, ctx) => {
|
|
539
|
+
checkDisposed();
|
|
540
|
+
// Use shared withEventEmission wrapper (IR-2)
|
|
541
|
+
return withEventEmission(ctx, 'pinecone', 'list_collections', {}, async () => {
|
|
542
|
+
// Call Pinecone API to list indexes
|
|
543
|
+
const response = await client.listIndexes();
|
|
544
|
+
// Extract index names
|
|
545
|
+
const names = response.indexes?.map((index) => index.name ?? '') ?? [];
|
|
546
|
+
return names;
|
|
547
|
+
});
|
|
548
|
+
},
|
|
549
|
+
description: 'List all collection names',
|
|
550
|
+
returnType: 'list',
|
|
551
|
+
},
|
|
552
|
+
// IR-11: pinecone::describe
|
|
553
|
+
describe: {
|
|
554
|
+
params: [],
|
|
555
|
+
fn: async (_args, ctx) => {
|
|
556
|
+
checkDisposed();
|
|
557
|
+
// Use shared withEventEmission wrapper (IR-2)
|
|
558
|
+
return withEventEmission(ctx, 'pinecone', 'describe', { name: factoryIndex }, async () => {
|
|
559
|
+
// Get index handle for stats
|
|
560
|
+
const index = client.Index(factoryIndex);
|
|
561
|
+
// Call Pinecone API to get index stats (data plane)
|
|
562
|
+
const stats = await index.describeIndexStats();
|
|
563
|
+
// Call Pinecone API to get index metadata (control plane)
|
|
564
|
+
const indexInfo = await client.describeIndex(factoryIndex);
|
|
565
|
+
// Extract collection info
|
|
566
|
+
const dimensions = stats.dimension ?? 0;
|
|
567
|
+
const count = stats.namespaces?.[factoryNamespace]?.recordCount ?? 0;
|
|
568
|
+
// Map Pinecone metric to standard format
|
|
569
|
+
let distance = 'cosine';
|
|
570
|
+
const metric = indexInfo.metric;
|
|
571
|
+
if (metric === 'cosine') {
|
|
572
|
+
distance = 'cosine';
|
|
573
|
+
}
|
|
574
|
+
else if (metric === 'euclidean') {
|
|
575
|
+
distance = 'euclidean';
|
|
576
|
+
}
|
|
577
|
+
else if (metric === 'dotproduct') {
|
|
578
|
+
distance = 'dot';
|
|
579
|
+
}
|
|
580
|
+
// Build and return result
|
|
581
|
+
return {
|
|
582
|
+
name: factoryIndex,
|
|
583
|
+
count,
|
|
584
|
+
dimensions,
|
|
585
|
+
distance,
|
|
586
|
+
};
|
|
587
|
+
});
|
|
588
|
+
},
|
|
589
|
+
description: 'Describe configured collection',
|
|
590
|
+
returnType: 'dict',
|
|
591
|
+
},
|
|
592
|
+
};
|
|
593
|
+
// Attach dispose lifecycle method
|
|
594
|
+
result.dispose = dispose;
|
|
595
|
+
return result;
|
|
596
|
+
}
|
|
597
|
+
//# sourceMappingURL=factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,YAAY,GAKb,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,IAAI,mBAAmB,EACpC,OAAO,IAAI,aAAa,EACxB,cAAc,GAEf,MAAM,+BAA+B,CAAC;AAGvC,+DAA+D;AAC/D,mBAAmB;AACnB,+DAA+D;AAE/D;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,KAAc;IACtC,+DAA+D;IAC/D,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC9B,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACrD,OAAO,IAAI,YAAY,CACrB,WAAW,EACX,uCAAuC,CACxC,CAAC;QACJ,CAAC;QACD,yEAAyE;QACzE,0DAA0D;QAC1D,IACE,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;YACvC,OAAO,CAAC,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Y,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAK1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// VERSION
|
|
3
|
+
// ============================================================
|
|
4
|
+
export const VERSION = '0.0.1';
|
|
5
|
+
// ============================================================
|
|
6
|
+
// FACTORY
|
|
7
|
+
// ============================================================
|
|
8
|
+
export { createPineconeExtension } from './factory.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,UAAU;AACV,+DAA+D;AAE/D,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAO/B,+DAA+D;AAC/D,UAAU;AACV,+DAA+D;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for Pinecone extension.
|
|
3
|
+
* Defines configuration for connecting to Pinecone vector database.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for Pinecone extension.
|
|
7
|
+
*
|
|
8
|
+
* Defines connection parameters for Pinecone client including
|
|
9
|
+
* API key, index name, namespace, and timeout settings.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Basic configuration with required fields
|
|
14
|
+
* const basicConfig: PineconeConfig = {
|
|
15
|
+
* apiKey: 'your-pinecone-api-key',
|
|
16
|
+
* index: 'my-index',
|
|
17
|
+
* };
|
|
18
|
+
*
|
|
19
|
+
* // Full configuration with optional fields
|
|
20
|
+
* const fullConfig: PineconeConfig = {
|
|
21
|
+
* apiKey: 'your-pinecone-api-key',
|
|
22
|
+
* index: 'my-index',
|
|
23
|
+
* namespace: 'production',
|
|
24
|
+
* timeout: 60000,
|
|
25
|
+
* };
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export interface PineconeConfig {
|
|
29
|
+
/**
|
|
30
|
+
* API key for Pinecone authentication.
|
|
31
|
+
*
|
|
32
|
+
* Required for all Pinecone operations.
|
|
33
|
+
* Obtain from Pinecone console.
|
|
34
|
+
*/
|
|
35
|
+
readonly apiKey: string;
|
|
36
|
+
/**
|
|
37
|
+
* Index name for vector operations.
|
|
38
|
+
*
|
|
39
|
+
* Must match an existing index in the Pinecone project.
|
|
40
|
+
*/
|
|
41
|
+
readonly index: string;
|
|
42
|
+
/**
|
|
43
|
+
* Namespace for partitioning vectors within an index.
|
|
44
|
+
*
|
|
45
|
+
* Namespaces allow logical separation of vectors within a single index.
|
|
46
|
+
* Default: '' (default namespace)
|
|
47
|
+
*/
|
|
48
|
+
readonly namespace?: string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Request timeout in milliseconds.
|
|
51
|
+
*
|
|
52
|
+
* Must be a positive integer.
|
|
53
|
+
* Default: SDK default (30000ms)
|
|
54
|
+
*/
|
|
55
|
+
readonly timeout?: number | undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Legacy type alias for PineconeConfig.
|
|
59
|
+
*
|
|
60
|
+
* @deprecated Use PineconeConfig instead.
|
|
61
|
+
*/
|
|
62
|
+
export type PineconeExtensionConfig = PineconeConfig;
|
|
63
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAExC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAMD;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rcrsr/rill-ext-pinecone",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "rill extension for Pinecone vector database integration",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Andre Bremer",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"keywords": [
|
|
11
|
+
"rill",
|
|
12
|
+
"pinecone",
|
|
13
|
+
"vector-database",
|
|
14
|
+
"vector-search",
|
|
15
|
+
"extension",
|
|
16
|
+
"ai",
|
|
17
|
+
"scripting"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc --build",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"typecheck": "tsc --noEmit",
|
|
23
|
+
"lint": "eslint --config ../../../eslint.config.js src/",
|
|
24
|
+
"check": "pnpm run build && pnpm run test && pnpm run lint"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@rcrsr/rill": "workspace:^"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@rcrsr/rill": "workspace:^"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist"
|
|
34
|
+
],
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/rcrsr/rill.git",
|
|
38
|
+
"directory": "packages/ext/pinecone"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/rcrsr/rill/tree/main/packages/ext/pinecone#readme",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/rcrsr/rill/issues"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@rcrsr/rill-ext-vector-shared": "workspace:^",
|
|
49
|
+
"@pinecone-database/pinecone": "^3.0.3"
|
|
50
|
+
}
|
|
51
|
+
}
|