@chatcops/store-upstash-vector 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +54 -2
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +136 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CoderCops
|
|
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
CHANGED
|
@@ -1,3 +1,55 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @chatcops/store-upstash-vector
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Upstash Vector storage for ChatCops embedded page chunks.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @chatcops/store-upstash-vector @upstash/vector
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`@upstash/vector` is a peer dependency. Create a dense Upstash Vector index with the same dimension count as the embedder (at least 4 dimensions for the ChatCops conformance suite). Configure the index distance metric for cosine similarity. Upstash credentials are available from the index settings.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { Index } from '@upstash/vector';
|
|
15
|
+
import { upstashVectors } from '@chatcops/store-upstash-vector';
|
|
16
|
+
|
|
17
|
+
const dimensions = 1024;
|
|
18
|
+
const index = new Index({
|
|
19
|
+
url: process.env.UPSTASH_VECTOR_REST_URL!,
|
|
20
|
+
token: process.env.UPSTASH_VECTOR_REST_TOKEN!,
|
|
21
|
+
});
|
|
22
|
+
const vectors = upstashVectors({ index, dimensions });
|
|
23
|
+
|
|
24
|
+
await vectors.upsert([{
|
|
25
|
+
id: 'pricing-0',
|
|
26
|
+
vector: new Float32Array(dimensions),
|
|
27
|
+
text: 'The Team plan is $20 a month.',
|
|
28
|
+
source: { id: 'pricing', url: 'https://example.com/pricing', title: 'Pricing' },
|
|
29
|
+
metadata: { locale: 'en' },
|
|
30
|
+
}]);
|
|
31
|
+
|
|
32
|
+
const results = await vectors.query({
|
|
33
|
+
vector: new Float32Array(dimensions),
|
|
34
|
+
topK: 5,
|
|
35
|
+
filter: { locale: ['en', 'de'] },
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Each filter key is ANDed with the other keys; arrays accept any listed value. Strings, numbers and booleans are serialized separately. Filter keys must be simple Upstash identifiers made of letters, digits, underscores, or hyphens (starting with a letter or underscore); nested path keys and keys containing punctuation that Upstash reserves for path syntax are rejected. String values are single-quoted with embedded quotes and backslashes escaped. The store reserves `__chatcops_source_*` metadata keys to preserve source fields and support `deleteBySource`.
|
|
40
|
+
|
|
41
|
+
For a sparse index or a hybrid index with a sparse text embedding model, enable keyword search explicitly with `upstashVectors({ index, dimensions, keywordSearch: true })`. The option adds `keywordQuery`, which tokenizes queries with `segmentWords` and sends them to Upstash in sparse mode. Dense indexes leave the method absent. The SDK's `Index` type does not encode the configured index kind, so enable this option only for supported sparse or hybrid indexes. For dense cosine indexes, Upstash reports `(1 + cosine similarity) / 2`; this adapter converts that value back to ChatCops' cosine score range of `[-1, 1]`.
|
|
42
|
+
|
|
43
|
+
To expose the store through `ChatCopsStorage`, assign it to `vectors`:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { memoryStorage } from '@chatcops/core';
|
|
47
|
+
|
|
48
|
+
const storage = { ...memoryStorage(), vectors: upstashVectors({ index, dimensions }) };
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Here `memoryStorage` is imported from `@chatcops/core` when you want its other in-memory capabilities alongside the Upstash vector index.
|
|
52
|
+
|
|
53
|
+
## Testing
|
|
54
|
+
|
|
55
|
+
Run `pnpm --filter @chatcops/store-upstash-vector test`. Unit tests use a fake Index. To run conformance against a dedicated test index, create a cosine dense index with at least 4 dimensions, set `CHATCOPS_TEST_UPSTASH_VECTOR_URL` and `CHATCOPS_TEST_UPSTASH_VECTOR_TOKEN`, then run the test command. Tests tag their records with unique run IDs and do not reset or clear the index. The test index should be reserved for conformance runs.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type MetadataFilter, type VectorStore } from '@chatcops/core';
|
|
2
|
+
import { type Index } from '@upstash/vector';
|
|
3
|
+
type UpstashMetadata = Record<string, string | number | boolean>;
|
|
4
|
+
/** Creates ChatCops vector storage backed by an Upstash Vector index. */
|
|
5
|
+
export interface UpstashVectorsOptions {
|
|
6
|
+
index: Index<UpstashMetadata>;
|
|
7
|
+
dimensions: number;
|
|
8
|
+
/** Set for a sparse index or hybrid index with a sparse text embedding model. */
|
|
9
|
+
keywordSearch?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function upstashVectors(options: UpstashVectorsOptions): VectorStore;
|
|
12
|
+
/** Serializes the MetadataFilter grammar supported by Upstash Vector. */
|
|
13
|
+
export declare function serializeFilter(filter: MetadataFilter): string;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,cAAc,EAA8E,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACpL,OAAO,EAAa,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAQxD,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAEjE,yEAAyE;AACzE,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,WAAW,CAK1E;AA2FD,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAO9D"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { segmentWords } from '@chatcops/core';
|
|
2
|
+
import { QueryMode } from '@upstash/vector';
|
|
3
|
+
const SOURCE_ID = '__chatcops_source_id';
|
|
4
|
+
const SOURCE_URL = '__chatcops_source_url';
|
|
5
|
+
const SOURCE_TITLE = '__chatcops_source_title';
|
|
6
|
+
const SOURCE_SECTION = '__chatcops_source_section';
|
|
7
|
+
const SOURCE_UPDATED_AT = '__chatcops_source_updated_at';
|
|
8
|
+
export function upstashVectors(options) {
|
|
9
|
+
const { index, dimensions, keywordSearch = false } = options;
|
|
10
|
+
if (!index)
|
|
11
|
+
throw new TypeError('upstashVectors requires an Upstash Vector index');
|
|
12
|
+
if (!Number.isInteger(dimensions) || dimensions < 1)
|
|
13
|
+
throw new Error(`dimensions must be a positive whole number; got ${dimensions}.`);
|
|
14
|
+
return new UpstashVectorStore(index, dimensions, keywordSearch);
|
|
15
|
+
}
|
|
16
|
+
class UpstashVectorStore {
|
|
17
|
+
index;
|
|
18
|
+
dimensions;
|
|
19
|
+
keywordQuery;
|
|
20
|
+
constructor(index, dimensions, keywordSearch) {
|
|
21
|
+
this.index = index;
|
|
22
|
+
this.dimensions = dimensions;
|
|
23
|
+
if (keywordSearch)
|
|
24
|
+
this.keywordQuery = this.searchKeywords.bind(this);
|
|
25
|
+
}
|
|
26
|
+
async upsert(records) {
|
|
27
|
+
for (const record of records)
|
|
28
|
+
checkVector(record.vector, this.dimensions, `record ${record.id}`);
|
|
29
|
+
if (!records.length)
|
|
30
|
+
return;
|
|
31
|
+
await this.index.upsert(records.map((record) => ({
|
|
32
|
+
id: record.id,
|
|
33
|
+
vector: Array.from(record.vector),
|
|
34
|
+
data: record.text,
|
|
35
|
+
metadata: toMetadata(record),
|
|
36
|
+
})));
|
|
37
|
+
}
|
|
38
|
+
async query({ vector, topK, filter }) {
|
|
39
|
+
checkVector(vector, this.dimensions, 'the query');
|
|
40
|
+
const limit = limitFor(topK);
|
|
41
|
+
if (!limit)
|
|
42
|
+
return [];
|
|
43
|
+
const results = await this.index.query({
|
|
44
|
+
vector: Array.from(vector), topK: limit, includeMetadata: true, includeData: true,
|
|
45
|
+
...(filter && Object.keys(filter).length ? { filter: serializeFilter(filter) } : {}),
|
|
46
|
+
});
|
|
47
|
+
return results.map((result) => fromResult(result));
|
|
48
|
+
}
|
|
49
|
+
async deleteBySource(sourceId) {
|
|
50
|
+
await this.index.delete({ filter: `${SOURCE_ID} = ${quoteString(sourceId)}` });
|
|
51
|
+
}
|
|
52
|
+
async searchKeywords({ text, topK, filter }) {
|
|
53
|
+
const limit = limitFor(topK);
|
|
54
|
+
const words = segmentWords(text).join(' ');
|
|
55
|
+
if (!limit || !words)
|
|
56
|
+
return [];
|
|
57
|
+
const results = await this.index.query({
|
|
58
|
+
data: words,
|
|
59
|
+
topK: limit,
|
|
60
|
+
queryMode: QueryMode.SPARSE,
|
|
61
|
+
includeMetadata: true,
|
|
62
|
+
includeData: true,
|
|
63
|
+
...(filter && Object.keys(filter).length ? { filter: serializeFilter(filter) } : {}),
|
|
64
|
+
});
|
|
65
|
+
return results.map((result) => fromResult(result, false));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function checkVector(vector, dimensions, what) {
|
|
69
|
+
if (vector.length !== dimensions)
|
|
70
|
+
throw new Error(`The vector for ${what} has ${vector.length} dimensions, but this store holds ${dimensions}.`);
|
|
71
|
+
if (!vector.every(Number.isFinite))
|
|
72
|
+
throw new Error(`The vector for ${what} has a value that isn't a finite number.`);
|
|
73
|
+
}
|
|
74
|
+
function limitFor(topK) {
|
|
75
|
+
return Number.isFinite(topK) && topK >= 1 ? Math.floor(topK) : 0;
|
|
76
|
+
}
|
|
77
|
+
function toMetadata(record) {
|
|
78
|
+
const metadata = { ...(record.metadata ?? {}) };
|
|
79
|
+
for (const key of [SOURCE_ID, SOURCE_URL, SOURCE_TITLE, SOURCE_SECTION, SOURCE_UPDATED_AT]) {
|
|
80
|
+
if (Object.hasOwn(metadata, key))
|
|
81
|
+
throw new Error(`Metadata key ${key} is reserved by @chatcops/store-upstash-vector.`);
|
|
82
|
+
}
|
|
83
|
+
metadata[SOURCE_ID] = record.source.id;
|
|
84
|
+
metadata[SOURCE_URL] = record.source.url;
|
|
85
|
+
if (record.source.title !== undefined)
|
|
86
|
+
metadata[SOURCE_TITLE] = record.source.title;
|
|
87
|
+
if (record.source.section !== undefined)
|
|
88
|
+
metadata[SOURCE_SECTION] = record.source.section;
|
|
89
|
+
if (record.source.updatedAt !== undefined)
|
|
90
|
+
metadata[SOURCE_UPDATED_AT] = record.source.updatedAt;
|
|
91
|
+
return metadata;
|
|
92
|
+
}
|
|
93
|
+
function fromResult(result, cosine = true) {
|
|
94
|
+
const metadata = { ...(result.metadata ?? {}) };
|
|
95
|
+
const source = {
|
|
96
|
+
id: String(metadata[SOURCE_ID] ?? ''),
|
|
97
|
+
url: String(metadata[SOURCE_URL] ?? ''),
|
|
98
|
+
...(typeof metadata[SOURCE_TITLE] === 'string' ? { title: metadata[SOURCE_TITLE] } : {}),
|
|
99
|
+
...(typeof metadata[SOURCE_SECTION] === 'string' ? { section: metadata[SOURCE_SECTION] } : {}),
|
|
100
|
+
...(typeof metadata[SOURCE_UPDATED_AT] === 'number' ? { updatedAt: metadata[SOURCE_UPDATED_AT] } : {}),
|
|
101
|
+
};
|
|
102
|
+
for (const key of [SOURCE_ID, SOURCE_URL, SOURCE_TITLE, SOURCE_SECTION, SOURCE_UPDATED_AT])
|
|
103
|
+
delete metadata[key];
|
|
104
|
+
return {
|
|
105
|
+
id: String(result.id), text: result.data ?? '', source,
|
|
106
|
+
...(Object.keys(metadata).length ? { metadata } : {}),
|
|
107
|
+
// Dense cosine scores use [-1, 1]; sparse scores are backend-specific BM25-style values.
|
|
108
|
+
score: cosine ? Math.round((result.score * 2 - 1) * 1e12) / 1e12 : result.score,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/** Serializes the MetadataFilter grammar supported by Upstash Vector. */
|
|
112
|
+
export function serializeFilter(filter) {
|
|
113
|
+
return Object.entries(filter).map(([key, wanted]) => {
|
|
114
|
+
const field = quoteField(key);
|
|
115
|
+
const values = Array.isArray(wanted) ? wanted : [wanted];
|
|
116
|
+
if (!values.length)
|
|
117
|
+
return `${field} = '__chatcops_no_match__' AND ${field} != '__chatcops_no_match__'`;
|
|
118
|
+
return `(${values.map((value) => `${field} = ${serializeValue(value)}`).join(' OR ')})`;
|
|
119
|
+
}).join(' AND ');
|
|
120
|
+
}
|
|
121
|
+
function quoteField(field) {
|
|
122
|
+
if (!/^[A-Za-z_][A-Za-z0-9_-]*$/.test(field))
|
|
123
|
+
throw new Error(`Unsupported Upstash metadata field name: ${field}`);
|
|
124
|
+
return field;
|
|
125
|
+
}
|
|
126
|
+
function serializeValue(value) {
|
|
127
|
+
if (typeof value === 'string')
|
|
128
|
+
return quoteString(value);
|
|
129
|
+
if (typeof value === 'boolean')
|
|
130
|
+
return value ? '1' : '0';
|
|
131
|
+
return String(value);
|
|
132
|
+
}
|
|
133
|
+
function quoteString(value) {
|
|
134
|
+
return `'${value.replaceAll('\\', '\\\\').replaceAll("'", "\\'")}'`;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAwI,MAAM,gBAAgB,CAAC;AACpL,OAAO,EAAE,SAAS,EAAc,MAAM,iBAAiB,CAAC;AAExD,MAAM,SAAS,GAAG,sBAAsB,CAAC;AACzC,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAC3C,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAC/C,MAAM,cAAc,GAAG,2BAA2B,CAAC;AACnD,MAAM,iBAAiB,GAAG,8BAA8B,CAAC;AAYzD,MAAM,UAAU,cAAc,CAAC,OAA8B;IAC3D,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,aAAa,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAC7D,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,SAAS,CAAC,iDAAiD,CAAC,CAAC;IACnF,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,UAAU,GAAG,CAAC,CAAC;IACvI,OAAO,IAAI,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,aAA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CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,KAAK,EAAE,CAAC,CAAC;IACnH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,cAAc,CAAC,KAAoB;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;IACzD,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IACzD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;AACtE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatcops/store-upstash-vector",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Upstash Vector storage for ChatCops",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"chatcops",
|
|
7
|
+
"storage",
|
|
8
|
+
"vector",
|
|
9
|
+
"upstash"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://chat.codercops.com",
|
|
12
|
+
"bugs": "https://github.com/codercops/chatcops/issues",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"types": "dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@upstash/vector": "^1.2.3",
|
|
28
|
+
"@chatcops/core": "^0.6.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@upstash/vector": "^1.2.3",
|
|
32
|
+
"typescript": "^5.7.0",
|
|
33
|
+
"vitest": "^4.1.11",
|
|
34
|
+
"@chatcops/core": "0.6.0"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/codercops/chatcops.git",
|
|
39
|
+
"directory": "packages/store-upstash-vector"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=22"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsc",
|
|
50
|
+
"typecheck": "tsc -p tsconfig.test.json --noEmit",
|
|
51
|
+
"test": "vitest run",
|
|
52
|
+
"test:watch": "vitest"
|
|
53
|
+
}
|
|
6
54
|
}
|