@wiscale/velesdb-sdk 1.15.0 → 1.17.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 +50 -6
- package/dist/index.d.mts +44 -3
- package/dist/index.d.ts +44 -3
- package/dist/index.js +116 -59
- package/dist/index.mjs +115 -59
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Official TypeScript SDK for [VelesDB](https://github.com/cyberlife-coder/VelesDB) -- the local-first vector database for AI and RAG. Sub-millisecond semantic search in Browser and Node.js.
|
|
4
4
|
|
|
5
|
-
**v1.
|
|
5
|
+
**v1.17.0** | Node.js >= 18 | Browser (WASM) | MIT License
|
|
6
6
|
|
|
7
|
-
## What's New in v1.
|
|
7
|
+
## What's New in v1.16.0
|
|
8
8
|
|
|
9
|
-
- **
|
|
9
|
+
- **First-party embedding helper.** New `OpenAIEmbedder` (plus the `Embedder` interface and `OpenAIEmbedderOptions` type), exported from the package root. It calls any OpenAI-compatible `/embeddings` endpoint via the global `fetch` API — no extra runtime dependency — so you can go from text to vectors without hand-writing the request. See [Embedding helper](#embedding-helper) below. Works in Node.js ≥ 18, browsers, and Deno.
|
|
10
|
+
|
|
11
|
+
### Previous (v1.14.2)
|
|
12
|
+
|
|
13
|
+
- **No SDK source change.** v1.14.2 was a workspace patch focused on the Python Haystack `DocumentStore` (`DuplicatePolicy.SKIP` contract fix) and seven version-drift gaps in the release tooling. The TS SDK ships in lock-step with the workspace and was functionally identical to v1.14.1.
|
|
10
14
|
|
|
11
15
|
### Previous (v1.14.1)
|
|
12
16
|
|
|
@@ -125,6 +129,7 @@ await db.upsertBatch('documents', [
|
|
|
125
129
|
]);
|
|
126
130
|
|
|
127
131
|
// 5. Search for similar vectors
|
|
132
|
+
const queryVector = new Float32Array(768).fill(0.1);
|
|
128
133
|
const results = await db.search('documents', queryVector, { k: 5 });
|
|
129
134
|
console.log(results);
|
|
130
135
|
// [{ id: 'doc-1', score: 0.95, payload: { title: 'Hello World', ... } }, ...]
|
|
@@ -151,6 +156,7 @@ await db.init();
|
|
|
151
156
|
// Same API as WASM backend
|
|
152
157
|
await db.createCollection('products', { dimension: 1536 });
|
|
153
158
|
await db.upsert('products', { id: 1, vector: embedding });
|
|
159
|
+
const queryVector = new Float32Array(1536).fill(0.1);
|
|
154
160
|
const results = await db.search('products', queryVector, { k: 10 });
|
|
155
161
|
```
|
|
156
162
|
|
|
@@ -161,6 +167,39 @@ const results = await db.search('products', queryVector, { k: 10 });
|
|
|
161
167
|
> are accepted for backward compatibility but are deprecated and will be removed
|
|
162
168
|
> in a future major version. Always target `/v1/` in custom HTTP clients.
|
|
163
169
|
|
|
170
|
+
## Embedding helper
|
|
171
|
+
|
|
172
|
+
The SDK ships an optional `OpenAIEmbedder` so you can turn text into vectors without
|
|
173
|
+
writing the HTTP call yourself. It targets any OpenAI-compatible `/embeddings`
|
|
174
|
+
endpoint (OpenAI, Azure OpenAI, vLLM, …) using the global `fetch` API, so it adds
|
|
175
|
+
**no extra runtime dependency** and runs in Node.js ≥ 18, browsers, and Deno.
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
import { VelesDB, OpenAIEmbedder } from '@wiscale/velesdb-sdk';
|
|
179
|
+
|
|
180
|
+
const embedder = new OpenAIEmbedder({
|
|
181
|
+
apiKey: process.env.OPENAI_API_KEY!,
|
|
182
|
+
model: 'text-embedding-3-small', // default; pass `dimensions` to truncate
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
const db = new VelesDB({ backend: 'wasm' });
|
|
186
|
+
await db.init();
|
|
187
|
+
|
|
188
|
+
// Embed first so the collection dimension matches the model output.
|
|
189
|
+
const vectors = await embedder.embed(['hello world', 'vector search']);
|
|
190
|
+
await db.createCollection('docs', { dimension: embedder.dimension, metric: 'cosine' });
|
|
191
|
+
await db.upsertBatch('docs', vectors.map((vector, i) => ({ id: `doc-${i}`, vector })));
|
|
192
|
+
|
|
193
|
+
const [query] = await embedder.embed(['greeting']);
|
|
194
|
+
const results = await db.search('docs', query, { k: 5 });
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
`embedder.dimension` is `0` until the first `embed()` call (or until you pass
|
|
198
|
+
`dimensions` to the constructor), at which point it is inferred from the model's
|
|
199
|
+
output. To use a different provider, set `baseUrl`. Implement the `Embedder`
|
|
200
|
+
interface (`{ dimension: number; embed(texts: string[]): Promise<number[][]> }`)
|
|
201
|
+
to plug in any other embedding source.
|
|
202
|
+
|
|
164
203
|
## API Reference
|
|
165
204
|
|
|
166
205
|
### Client
|
|
@@ -312,7 +351,7 @@ Vector similarity search.
|
|
|
312
351
|
```typescript
|
|
313
352
|
const results = await db.search('docs', queryVector, {
|
|
314
353
|
k: 10,
|
|
315
|
-
filter: { category: 'tech' },
|
|
354
|
+
filter: { condition: { type: 'eq', field: 'category', value: 'tech' } },
|
|
316
355
|
includeVectors: true
|
|
317
356
|
});
|
|
318
357
|
// Returns: SearchResult[] = [{ id, score, payload?, vector? }, ...]
|
|
@@ -325,7 +364,7 @@ Execute multiple search queries in parallel.
|
|
|
325
364
|
```typescript
|
|
326
365
|
const batchResults = await db.searchBatch('docs', [
|
|
327
366
|
{ vector: queryA, k: 5 },
|
|
328
|
-
{ vector: queryB, k: 10, filter: { type: 'article' } },
|
|
367
|
+
{ vector: queryB, k: 10, filter: { condition: { type: 'eq', field: 'type', value: 'article' } } },
|
|
329
368
|
]);
|
|
330
369
|
// Returns: SearchResult[][] (one result array per query)
|
|
331
370
|
```
|
|
@@ -538,7 +577,7 @@ const combined = await db.query('users',
|
|
|
538
577
|
|
|
539
578
|
// Fusion strategy
|
|
540
579
|
const fused = await db.query('docs',
|
|
541
|
-
"SELECT * FROM docs USING FUSION(strategy = 'rrf', k = 60)
|
|
580
|
+
"SELECT * FROM docs LIMIT 20 USING FUSION(strategy = 'rrf', k = 60)"
|
|
542
581
|
);
|
|
543
582
|
```
|
|
544
583
|
|
|
@@ -828,6 +867,11 @@ import {
|
|
|
828
867
|
VelesDB,
|
|
829
868
|
AgentMemoryClient,
|
|
830
869
|
|
|
870
|
+
// Embedding helper
|
|
871
|
+
OpenAIEmbedder,
|
|
872
|
+
type Embedder,
|
|
873
|
+
type OpenAIEmbedderOptions,
|
|
874
|
+
|
|
831
875
|
// Backends (advanced: use VelesDB client instead)
|
|
832
876
|
WasmBackend,
|
|
833
877
|
RestBackend,
|
package/dist/index.d.mts
CHANGED
|
@@ -648,8 +648,8 @@ interface ColumnStatsDetail {
|
|
|
648
648
|
name: string;
|
|
649
649
|
nullCount: number;
|
|
650
650
|
distinctCount: number;
|
|
651
|
-
minValue: unknown
|
|
652
|
-
maxValue: unknown
|
|
651
|
+
minValue: unknown;
|
|
652
|
+
maxValue: unknown;
|
|
653
653
|
avgSizeBytes: number;
|
|
654
654
|
histogramBuckets: number | null;
|
|
655
655
|
histogramStale: boolean | null;
|
|
@@ -2046,4 +2046,45 @@ type VelesErrorCode = (typeof VELES_ERROR_CODES)[number];
|
|
|
2046
2046
|
*/
|
|
2047
2047
|
declare function parseVelesError(code: string | null | undefined, message: string): VelesError;
|
|
2048
2048
|
|
|
2049
|
-
|
|
2049
|
+
/**
|
|
2050
|
+
* Optional embedding helpers for the VelesDB TypeScript SDK.
|
|
2051
|
+
*
|
|
2052
|
+
* A thin {@link Embedder} interface plus an adapter for OpenAI-compatible
|
|
2053
|
+
* endpoints. The adapter uses the global `fetch` API (Node ≥ 18, browsers,
|
|
2054
|
+
* Deno) and has no additional runtime dependencies.
|
|
2055
|
+
*
|
|
2056
|
+
* @example
|
|
2057
|
+
* ```typescript
|
|
2058
|
+
* import { VelesDB, OpenAIEmbedder } from '@wiscale/velesdb-sdk';
|
|
2059
|
+
*
|
|
2060
|
+
* const embedder = new OpenAIEmbedder({ apiKey: process.env.OPENAI_API_KEY! });
|
|
2061
|
+
* const db = new VelesDB({ backend: 'wasm' });
|
|
2062
|
+
* await db.init();
|
|
2063
|
+
* await db.createCollection('docs', { dimension: embedder.dimension ?? 1536 });
|
|
2064
|
+
* const vectors = await embedder.embed(['hello world', 'vector search']);
|
|
2065
|
+
* ```
|
|
2066
|
+
*/
|
|
2067
|
+
interface Embedder {
|
|
2068
|
+
/** Embedding dimension, or `0` if not yet known (determined after first call). */
|
|
2069
|
+
readonly dimension: number;
|
|
2070
|
+
embed(texts: string[]): Promise<number[][]>;
|
|
2071
|
+
}
|
|
2072
|
+
interface OpenAIEmbedderOptions {
|
|
2073
|
+
model?: string;
|
|
2074
|
+
apiKey: string;
|
|
2075
|
+
/** Override the base URL for Azure OpenAI, vLLM, or any compatible endpoint. */
|
|
2076
|
+
baseUrl?: string;
|
|
2077
|
+
/** Request a specific output dimension (requires a model that supports it). */
|
|
2078
|
+
dimensions?: number;
|
|
2079
|
+
}
|
|
2080
|
+
declare class OpenAIEmbedder implements Embedder {
|
|
2081
|
+
private readonly model;
|
|
2082
|
+
private readonly apiKey;
|
|
2083
|
+
private readonly baseUrl;
|
|
2084
|
+
private readonly requestedDimensions;
|
|
2085
|
+
dimension: number;
|
|
2086
|
+
constructor(options: OpenAIEmbedderOptions);
|
|
2087
|
+
embed(texts: string[]): Promise<number[][]>;
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
export { type ActualStats, type AddEdgeRequest, AgentMemoryClient, type AgentMemoryConfig, type AggregateQueryOptions, type AggregateResponse, type AggregationQueryResponse, AllocationFailedError, type AsyncIndexBuilderOptions, type BackendType, BackpressureError, type CapabilityMap, type Collection, type CollectionConfig, type CollectionConfigResponse, CollectionExistsError, CollectionNotFoundError, type CollectionSanityChecks, type CollectionSanityDiagnostics, type CollectionSanityResponse, type CollectionStatsResponse, type CollectionType, type ColumnStatsDetail, ColumnStoreError, type CompareOp, type Condition, ConfigError, ConnectionError, type CreateIndexOptions, DatabaseLockedError, type DeferredIndexerOptions, type DegreeResponse, DimensionMismatchError, type DistanceMetric, EdgeExistsError, EdgeNotFoundError, type EdgesResponse, type Embedder, type EpisodicEvent, EpochMismatchError, type ExplainCost, type ExplainFeatures, type ExplainPlanStep, type ExplainResponse, type Filter, type FilterInput, type FusionOptions, type FusionStrategy, type GetEdgesOptions, type GetNodeEdgesOptions, GpuError, type GraphCollectionConfig, type GraphEdge, GraphNotSupportedError, type GraphSchemaMode, type GraphSearchRequest, type GraphSearchResponse, type GraphSearchResultItem, GuardRailError, type GuardRailsConfigResponse, type GuardRailsUpdateRequest, type HnswParams, type IVelesDBBackend, IncompatibleSchemaVersionError, IndexCorruptedError, IndexError, type IndexInfo, type IndexType, InternalError, InvalidCollectionNameError, InvalidDimensionError, InvalidEdgeLabelError, InvalidQuantizerConfigError, InvalidVectorError, IoError, type JsonValue, type ListNodesResponse, type MatchQueryOptions, type MatchQueryResponse, type MatchQueryResultItem, type MultiQuerySearchOptions, type NearVectorOptions, NodeNotFoundError, type NodePayloadResponse, type NodeStats, NotFoundError, OpenAIEmbedder, type OpenAIEmbedderOptions, OverflowError, PointNotFoundError, type PqTrainOptions, type ProceduralPattern, type QueryApiResponse, QueryError, type QueryOptions, type QueryResponse, type QueryResult, type QueryStats, REST_CAPABILITIES, type RebuildIndexResponse, type RelDirection, type RelOptions, RestBackend, type RestPointId, SchemaValidationError, type ScrollRequest, type ScrollResponse, SearchNotSupportedError, type SearchOptions, type SearchQuality, type SearchQualityWire, type SearchResult, type SemanticEntry, SerializationError, SnapshotBuildFailedError, SparseIndexError, type SparseSearchNamedOptions, type SparseVector, StorageError, type StorageMode, type StreamUpsertResponse, TrainingFailedError, type TraversalResultItem, type TraversalStats, type TraverseParallelRequest, type TraverseRequest, type TraverseResponse, VELES_ERROR_CODES, ValidationError, type VectorDocument, VectorNotAllowedError, VectorRequiredError, VelesDB, type VelesDBConfig, VelesDBError, VelesError, type VelesErrorCode, VelesQLBuilder, WASM_CAPABILITIES, WasmBackend, f, isTypedFilter, normalizeFilter, parseVelesError, searchQualityToMode, velesql };
|
package/dist/index.d.ts
CHANGED
|
@@ -648,8 +648,8 @@ interface ColumnStatsDetail {
|
|
|
648
648
|
name: string;
|
|
649
649
|
nullCount: number;
|
|
650
650
|
distinctCount: number;
|
|
651
|
-
minValue: unknown
|
|
652
|
-
maxValue: unknown
|
|
651
|
+
minValue: unknown;
|
|
652
|
+
maxValue: unknown;
|
|
653
653
|
avgSizeBytes: number;
|
|
654
654
|
histogramBuckets: number | null;
|
|
655
655
|
histogramStale: boolean | null;
|
|
@@ -2046,4 +2046,45 @@ type VelesErrorCode = (typeof VELES_ERROR_CODES)[number];
|
|
|
2046
2046
|
*/
|
|
2047
2047
|
declare function parseVelesError(code: string | null | undefined, message: string): VelesError;
|
|
2048
2048
|
|
|
2049
|
-
|
|
2049
|
+
/**
|
|
2050
|
+
* Optional embedding helpers for the VelesDB TypeScript SDK.
|
|
2051
|
+
*
|
|
2052
|
+
* A thin {@link Embedder} interface plus an adapter for OpenAI-compatible
|
|
2053
|
+
* endpoints. The adapter uses the global `fetch` API (Node ≥ 18, browsers,
|
|
2054
|
+
* Deno) and has no additional runtime dependencies.
|
|
2055
|
+
*
|
|
2056
|
+
* @example
|
|
2057
|
+
* ```typescript
|
|
2058
|
+
* import { VelesDB, OpenAIEmbedder } from '@wiscale/velesdb-sdk';
|
|
2059
|
+
*
|
|
2060
|
+
* const embedder = new OpenAIEmbedder({ apiKey: process.env.OPENAI_API_KEY! });
|
|
2061
|
+
* const db = new VelesDB({ backend: 'wasm' });
|
|
2062
|
+
* await db.init();
|
|
2063
|
+
* await db.createCollection('docs', { dimension: embedder.dimension ?? 1536 });
|
|
2064
|
+
* const vectors = await embedder.embed(['hello world', 'vector search']);
|
|
2065
|
+
* ```
|
|
2066
|
+
*/
|
|
2067
|
+
interface Embedder {
|
|
2068
|
+
/** Embedding dimension, or `0` if not yet known (determined after first call). */
|
|
2069
|
+
readonly dimension: number;
|
|
2070
|
+
embed(texts: string[]): Promise<number[][]>;
|
|
2071
|
+
}
|
|
2072
|
+
interface OpenAIEmbedderOptions {
|
|
2073
|
+
model?: string;
|
|
2074
|
+
apiKey: string;
|
|
2075
|
+
/** Override the base URL for Azure OpenAI, vLLM, or any compatible endpoint. */
|
|
2076
|
+
baseUrl?: string;
|
|
2077
|
+
/** Request a specific output dimension (requires a model that supports it). */
|
|
2078
|
+
dimensions?: number;
|
|
2079
|
+
}
|
|
2080
|
+
declare class OpenAIEmbedder implements Embedder {
|
|
2081
|
+
private readonly model;
|
|
2082
|
+
private readonly apiKey;
|
|
2083
|
+
private readonly baseUrl;
|
|
2084
|
+
private readonly requestedDimensions;
|
|
2085
|
+
dimension: number;
|
|
2086
|
+
constructor(options: OpenAIEmbedderOptions);
|
|
2087
|
+
embed(texts: string[]): Promise<number[][]>;
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
export { type ActualStats, type AddEdgeRequest, AgentMemoryClient, type AgentMemoryConfig, type AggregateQueryOptions, type AggregateResponse, type AggregationQueryResponse, AllocationFailedError, type AsyncIndexBuilderOptions, type BackendType, BackpressureError, type CapabilityMap, type Collection, type CollectionConfig, type CollectionConfigResponse, CollectionExistsError, CollectionNotFoundError, type CollectionSanityChecks, type CollectionSanityDiagnostics, type CollectionSanityResponse, type CollectionStatsResponse, type CollectionType, type ColumnStatsDetail, ColumnStoreError, type CompareOp, type Condition, ConfigError, ConnectionError, type CreateIndexOptions, DatabaseLockedError, type DeferredIndexerOptions, type DegreeResponse, DimensionMismatchError, type DistanceMetric, EdgeExistsError, EdgeNotFoundError, type EdgesResponse, type Embedder, type EpisodicEvent, EpochMismatchError, type ExplainCost, type ExplainFeatures, type ExplainPlanStep, type ExplainResponse, type Filter, type FilterInput, type FusionOptions, type FusionStrategy, type GetEdgesOptions, type GetNodeEdgesOptions, GpuError, type GraphCollectionConfig, type GraphEdge, GraphNotSupportedError, type GraphSchemaMode, type GraphSearchRequest, type GraphSearchResponse, type GraphSearchResultItem, GuardRailError, type GuardRailsConfigResponse, type GuardRailsUpdateRequest, type HnswParams, type IVelesDBBackend, IncompatibleSchemaVersionError, IndexCorruptedError, IndexError, type IndexInfo, type IndexType, InternalError, InvalidCollectionNameError, InvalidDimensionError, InvalidEdgeLabelError, InvalidQuantizerConfigError, InvalidVectorError, IoError, type JsonValue, type ListNodesResponse, type MatchQueryOptions, type MatchQueryResponse, type MatchQueryResultItem, type MultiQuerySearchOptions, type NearVectorOptions, NodeNotFoundError, type NodePayloadResponse, type NodeStats, NotFoundError, OpenAIEmbedder, type OpenAIEmbedderOptions, OverflowError, PointNotFoundError, type PqTrainOptions, type ProceduralPattern, type QueryApiResponse, QueryError, type QueryOptions, type QueryResponse, type QueryResult, type QueryStats, REST_CAPABILITIES, type RebuildIndexResponse, type RelDirection, type RelOptions, RestBackend, type RestPointId, SchemaValidationError, type ScrollRequest, type ScrollResponse, SearchNotSupportedError, type SearchOptions, type SearchQuality, type SearchQualityWire, type SearchResult, type SemanticEntry, SerializationError, SnapshotBuildFailedError, SparseIndexError, type SparseSearchNamedOptions, type SparseVector, StorageError, type StorageMode, type StreamUpsertResponse, TrainingFailedError, type TraversalResultItem, type TraversalStats, type TraverseParallelRequest, type TraverseRequest, type TraverseResponse, VELES_ERROR_CODES, ValidationError, type VectorDocument, VectorNotAllowedError, VectorRequiredError, VelesDB, type VelesDBConfig, VelesDBError, VelesError, type VelesErrorCode, VelesQLBuilder, WASM_CAPABILITIES, WasmBackend, f, isTypedFilter, normalizeFilter, parseVelesError, searchQualityToMode, velesql };
|
package/dist/index.js
CHANGED
|
@@ -105,6 +105,7 @@ __export(index_exports, {
|
|
|
105
105
|
IoError: () => IoError,
|
|
106
106
|
NodeNotFoundError: () => NodeNotFoundError,
|
|
107
107
|
NotFoundError: () => NotFoundError,
|
|
108
|
+
OpenAIEmbedder: () => OpenAIEmbedder,
|
|
108
109
|
OverflowError: () => OverflowError,
|
|
109
110
|
PointNotFoundError: () => PointNotFoundError,
|
|
110
111
|
QueryError: () => QueryError,
|
|
@@ -725,49 +726,49 @@ var VELES_ERROR_CODES = [
|
|
|
725
726
|
"VELES-035",
|
|
726
727
|
"VELES-036"
|
|
727
728
|
];
|
|
728
|
-
var CODE_TO_CLASS =
|
|
729
|
-
"VELES-001"
|
|
730
|
-
"VELES-002"
|
|
731
|
-
"VELES-003"
|
|
732
|
-
"VELES-004"
|
|
733
|
-
"VELES-005"
|
|
734
|
-
"VELES-006"
|
|
735
|
-
"VELES-007"
|
|
736
|
-
"VELES-008"
|
|
737
|
-
"VELES-009"
|
|
738
|
-
"VELES-010"
|
|
739
|
-
"VELES-011"
|
|
740
|
-
"VELES-012"
|
|
741
|
-
"VELES-013"
|
|
742
|
-
"VELES-014"
|
|
743
|
-
"VELES-015"
|
|
744
|
-
"VELES-016"
|
|
745
|
-
"VELES-017"
|
|
746
|
-
"VELES-018"
|
|
747
|
-
"VELES-019"
|
|
748
|
-
"VELES-020"
|
|
749
|
-
"VELES-021"
|
|
750
|
-
"VELES-022"
|
|
751
|
-
"VELES-023"
|
|
752
|
-
"VELES-024"
|
|
753
|
-
"VELES-025"
|
|
754
|
-
"VELES-026"
|
|
755
|
-
"VELES-027"
|
|
756
|
-
"VELES-028"
|
|
757
|
-
"VELES-029"
|
|
758
|
-
"VELES-030"
|
|
759
|
-
"VELES-031"
|
|
760
|
-
"VELES-032"
|
|
761
|
-
"VELES-033"
|
|
762
|
-
"VELES-034"
|
|
763
|
-
"VELES-035"
|
|
764
|
-
"VELES-036"
|
|
765
|
-
|
|
729
|
+
var CODE_TO_CLASS = /* @__PURE__ */ new Map([
|
|
730
|
+
["VELES-001", CollectionExistsError],
|
|
731
|
+
["VELES-002", CollectionNotFoundError],
|
|
732
|
+
["VELES-003", PointNotFoundError],
|
|
733
|
+
["VELES-004", DimensionMismatchError],
|
|
734
|
+
["VELES-005", InvalidVectorError],
|
|
735
|
+
["VELES-006", StorageError],
|
|
736
|
+
["VELES-007", IndexError],
|
|
737
|
+
["VELES-008", IndexCorruptedError],
|
|
738
|
+
["VELES-009", ConfigError],
|
|
739
|
+
["VELES-010", QueryError],
|
|
740
|
+
["VELES-011", IoError],
|
|
741
|
+
["VELES-012", SerializationError],
|
|
742
|
+
["VELES-013", InternalError],
|
|
743
|
+
["VELES-014", VectorNotAllowedError],
|
|
744
|
+
["VELES-015", SearchNotSupportedError],
|
|
745
|
+
["VELES-016", VectorRequiredError],
|
|
746
|
+
["VELES-017", SchemaValidationError],
|
|
747
|
+
["VELES-018", GraphNotSupportedError],
|
|
748
|
+
["VELES-019", EdgeExistsError],
|
|
749
|
+
["VELES-020", EdgeNotFoundError],
|
|
750
|
+
["VELES-021", InvalidEdgeLabelError],
|
|
751
|
+
["VELES-022", NodeNotFoundError],
|
|
752
|
+
["VELES-023", OverflowError],
|
|
753
|
+
["VELES-024", ColumnStoreError],
|
|
754
|
+
["VELES-025", GpuError],
|
|
755
|
+
["VELES-026", EpochMismatchError],
|
|
756
|
+
["VELES-027", GuardRailError],
|
|
757
|
+
["VELES-028", InvalidQuantizerConfigError],
|
|
758
|
+
["VELES-029", TrainingFailedError],
|
|
759
|
+
["VELES-030", SparseIndexError],
|
|
760
|
+
["VELES-031", DatabaseLockedError],
|
|
761
|
+
["VELES-032", InvalidDimensionError],
|
|
762
|
+
["VELES-033", AllocationFailedError],
|
|
763
|
+
["VELES-034", InvalidCollectionNameError],
|
|
764
|
+
["VELES-035", SnapshotBuildFailedError],
|
|
765
|
+
["VELES-036", IncompatibleSchemaVersionError]
|
|
766
|
+
]);
|
|
766
767
|
function parseVelesError(code, message) {
|
|
767
768
|
if (code === null || code === void 0) {
|
|
768
769
|
return new VelesError(message, "VELES-UNKNOWN");
|
|
769
770
|
}
|
|
770
|
-
const Cls = CODE_TO_CLASS
|
|
771
|
+
const Cls = CODE_TO_CLASS.get(code);
|
|
771
772
|
if (Cls !== void 0) {
|
|
772
773
|
return new Cls(message);
|
|
773
774
|
}
|
|
@@ -2939,7 +2940,8 @@ function validateDocsBatch(docs, validateDoc) {
|
|
|
2939
2940
|
}
|
|
2940
2941
|
}
|
|
2941
2942
|
function validateDocument(doc, config) {
|
|
2942
|
-
|
|
2943
|
+
const id = doc.id;
|
|
2944
|
+
if (id === void 0 || id === null) {
|
|
2943
2945
|
throw new ValidationError("Document ID is required");
|
|
2944
2946
|
}
|
|
2945
2947
|
requireVector(doc.vector, "Vector");
|
|
@@ -2994,11 +2996,15 @@ function trainPq2(backend, collection, options) {
|
|
|
2994
2996
|
return backend.trainPq(collection, options);
|
|
2995
2997
|
}
|
|
2996
2998
|
function streamInsert2(backend, config, collection, docs) {
|
|
2997
|
-
validateDocsBatch(docs, (doc) =>
|
|
2999
|
+
validateDocsBatch(docs, (doc) => {
|
|
3000
|
+
validateDocument(doc, config);
|
|
3001
|
+
});
|
|
2998
3002
|
return backend.streamInsert(collection, docs);
|
|
2999
3003
|
}
|
|
3000
3004
|
function streamUpsertPoints2(backend, config, collection, docs) {
|
|
3001
|
-
validateDocsBatch(docs, (doc) =>
|
|
3005
|
+
validateDocsBatch(docs, (doc) => {
|
|
3006
|
+
validateDocument(doc, config);
|
|
3007
|
+
});
|
|
3002
3008
|
return backend.streamUpsertPoints(collection, docs);
|
|
3003
3009
|
}
|
|
3004
3010
|
function scroll2(backend, collection, request2) {
|
|
@@ -3131,13 +3137,14 @@ var VelesDB = class {
|
|
|
3131
3137
|
this.backend = this.createBackend(config);
|
|
3132
3138
|
}
|
|
3133
3139
|
validateConfig(config) {
|
|
3134
|
-
|
|
3140
|
+
const backend = config.backend;
|
|
3141
|
+
if (!backend) {
|
|
3135
3142
|
throw new ValidationError("Backend type is required");
|
|
3136
3143
|
}
|
|
3137
|
-
if (
|
|
3138
|
-
throw new ValidationError(`Invalid backend type: ${
|
|
3144
|
+
if (backend !== "wasm" && backend !== "rest") {
|
|
3145
|
+
throw new ValidationError(`Invalid backend type: ${backend}. Use 'wasm' or 'rest'`);
|
|
3139
3146
|
}
|
|
3140
|
-
if (
|
|
3147
|
+
if (backend === "rest" && !config.url) {
|
|
3141
3148
|
throw new ValidationError("URL is required for REST backend");
|
|
3142
3149
|
}
|
|
3143
3150
|
}
|
|
@@ -3145,10 +3152,14 @@ var VelesDB = class {
|
|
|
3145
3152
|
switch (config.backend) {
|
|
3146
3153
|
case "wasm":
|
|
3147
3154
|
return new WasmBackend();
|
|
3148
|
-
case "rest":
|
|
3155
|
+
case "rest": {
|
|
3156
|
+
if (!config.url) {
|
|
3157
|
+
throw new ValidationError("URL is required for REST backend");
|
|
3158
|
+
}
|
|
3149
3159
|
return new RestBackend(config.url, config.apiKey, config.timeout);
|
|
3160
|
+
}
|
|
3150
3161
|
default:
|
|
3151
|
-
throw new ValidationError(`Unknown backend: ${config.backend}`);
|
|
3162
|
+
throw new ValidationError(`Unknown backend: ${String(config.backend)}`);
|
|
3152
3163
|
}
|
|
3153
3164
|
}
|
|
3154
3165
|
/** Initialize the client. Must be called before any other operations. */
|
|
@@ -3207,7 +3218,9 @@ var VelesDB = class {
|
|
|
3207
3218
|
}
|
|
3208
3219
|
async upsertBatch(collection, docs) {
|
|
3209
3220
|
this.ensureInitialized();
|
|
3210
|
-
validateDocsBatch(docs, (doc) =>
|
|
3221
|
+
validateDocsBatch(docs, (doc) => {
|
|
3222
|
+
validateDocument(doc, this.config);
|
|
3223
|
+
});
|
|
3211
3224
|
await this.backend.upsertBatch(collection, docs);
|
|
3212
3225
|
}
|
|
3213
3226
|
async delete(collection, id) {
|
|
@@ -3723,13 +3736,14 @@ var VelesQLBuilder = class _VelesQLBuilder {
|
|
|
3723
3736
|
return `*${min}..${max}`;
|
|
3724
3737
|
}
|
|
3725
3738
|
buildWhereClause() {
|
|
3726
|
-
|
|
3727
|
-
const
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3739
|
+
let result = "";
|
|
3740
|
+
for (const [idx, clause] of this.state.whereClauses.entries()) {
|
|
3741
|
+
if (idx === 0) {
|
|
3742
|
+
if (!clause) return "";
|
|
3743
|
+
result = clause;
|
|
3744
|
+
continue;
|
|
3745
|
+
}
|
|
3746
|
+
const operator = this.state.whereOperators[idx - 1] ?? "AND";
|
|
3733
3747
|
if (clause) {
|
|
3734
3748
|
result += ` ${operator} ${clause}`;
|
|
3735
3749
|
}
|
|
@@ -3743,13 +3757,14 @@ function velesql() {
|
|
|
3743
3757
|
|
|
3744
3758
|
// src/filter.ts
|
|
3745
3759
|
function isTypedFilter(input) {
|
|
3746
|
-
|
|
3760
|
+
const value = input;
|
|
3761
|
+
if (typeof value !== "object" || value === null) {
|
|
3747
3762
|
return false;
|
|
3748
3763
|
}
|
|
3749
|
-
if (!("condition" in
|
|
3764
|
+
if (!("condition" in value)) {
|
|
3750
3765
|
return false;
|
|
3751
3766
|
}
|
|
3752
|
-
const cond =
|
|
3767
|
+
const cond = value.condition;
|
|
3753
3768
|
return typeof cond === "object" && cond !== null;
|
|
3754
3769
|
}
|
|
3755
3770
|
function normalizeFilter(input) {
|
|
@@ -3884,6 +3899,47 @@ var f = {
|
|
|
3884
3899
|
return { condition: { type: "not", condition: filter.condition } };
|
|
3885
3900
|
}
|
|
3886
3901
|
};
|
|
3902
|
+
|
|
3903
|
+
// src/embed.ts
|
|
3904
|
+
var OpenAIEmbedder = class {
|
|
3905
|
+
constructor(options) {
|
|
3906
|
+
this.model = options.model ?? "text-embedding-3-small";
|
|
3907
|
+
this.apiKey = options.apiKey;
|
|
3908
|
+
this.baseUrl = options.baseUrl?.replace(/\/$/, "") ?? "https://api.openai.com/v1";
|
|
3909
|
+
this.requestedDimensions = options.dimensions;
|
|
3910
|
+
this.dimension = options.dimensions ?? 0;
|
|
3911
|
+
}
|
|
3912
|
+
async embed(texts) {
|
|
3913
|
+
if (texts.length === 0) return [];
|
|
3914
|
+
const body = { model: this.model, input: texts };
|
|
3915
|
+
if (this.requestedDimensions !== void 0) {
|
|
3916
|
+
body["dimensions"] = this.requestedDimensions;
|
|
3917
|
+
}
|
|
3918
|
+
const response = await fetch(`${this.baseUrl}/embeddings`, {
|
|
3919
|
+
method: "POST",
|
|
3920
|
+
headers: {
|
|
3921
|
+
"Content-Type": "application/json",
|
|
3922
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
3923
|
+
},
|
|
3924
|
+
body: JSON.stringify(body)
|
|
3925
|
+
});
|
|
3926
|
+
if (!response.ok) {
|
|
3927
|
+
const text = await response.text().catch(() => "");
|
|
3928
|
+
throw new Error(
|
|
3929
|
+
`OpenAI embeddings request failed: ${response.status} ${response.statusText} \u2014 ${text.slice(0, 500)}`
|
|
3930
|
+
);
|
|
3931
|
+
}
|
|
3932
|
+
const json = await response.json();
|
|
3933
|
+
const vectors = json.data.map((item) => item.embedding);
|
|
3934
|
+
if (this.dimension === 0) {
|
|
3935
|
+
for (const vec of vectors) {
|
|
3936
|
+
this.dimension = vec.length;
|
|
3937
|
+
break;
|
|
3938
|
+
}
|
|
3939
|
+
}
|
|
3940
|
+
return vectors;
|
|
3941
|
+
}
|
|
3942
|
+
};
|
|
3887
3943
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3888
3944
|
0 && (module.exports = {
|
|
3889
3945
|
AgentMemoryClient,
|
|
@@ -3914,6 +3970,7 @@ var f = {
|
|
|
3914
3970
|
IoError,
|
|
3915
3971
|
NodeNotFoundError,
|
|
3916
3972
|
NotFoundError,
|
|
3973
|
+
OpenAIEmbedder,
|
|
3917
3974
|
OverflowError,
|
|
3918
3975
|
PointNotFoundError,
|
|
3919
3976
|
QueryError,
|
package/dist/index.mjs
CHANGED
|
@@ -587,49 +587,49 @@ var VELES_ERROR_CODES = [
|
|
|
587
587
|
"VELES-035",
|
|
588
588
|
"VELES-036"
|
|
589
589
|
];
|
|
590
|
-
var CODE_TO_CLASS =
|
|
591
|
-
"VELES-001"
|
|
592
|
-
"VELES-002"
|
|
593
|
-
"VELES-003"
|
|
594
|
-
"VELES-004"
|
|
595
|
-
"VELES-005"
|
|
596
|
-
"VELES-006"
|
|
597
|
-
"VELES-007"
|
|
598
|
-
"VELES-008"
|
|
599
|
-
"VELES-009"
|
|
600
|
-
"VELES-010"
|
|
601
|
-
"VELES-011"
|
|
602
|
-
"VELES-012"
|
|
603
|
-
"VELES-013"
|
|
604
|
-
"VELES-014"
|
|
605
|
-
"VELES-015"
|
|
606
|
-
"VELES-016"
|
|
607
|
-
"VELES-017"
|
|
608
|
-
"VELES-018"
|
|
609
|
-
"VELES-019"
|
|
610
|
-
"VELES-020"
|
|
611
|
-
"VELES-021"
|
|
612
|
-
"VELES-022"
|
|
613
|
-
"VELES-023"
|
|
614
|
-
"VELES-024"
|
|
615
|
-
"VELES-025"
|
|
616
|
-
"VELES-026"
|
|
617
|
-
"VELES-027"
|
|
618
|
-
"VELES-028"
|
|
619
|
-
"VELES-029"
|
|
620
|
-
"VELES-030"
|
|
621
|
-
"VELES-031"
|
|
622
|
-
"VELES-032"
|
|
623
|
-
"VELES-033"
|
|
624
|
-
"VELES-034"
|
|
625
|
-
"VELES-035"
|
|
626
|
-
"VELES-036"
|
|
627
|
-
|
|
590
|
+
var CODE_TO_CLASS = /* @__PURE__ */ new Map([
|
|
591
|
+
["VELES-001", CollectionExistsError],
|
|
592
|
+
["VELES-002", CollectionNotFoundError],
|
|
593
|
+
["VELES-003", PointNotFoundError],
|
|
594
|
+
["VELES-004", DimensionMismatchError],
|
|
595
|
+
["VELES-005", InvalidVectorError],
|
|
596
|
+
["VELES-006", StorageError],
|
|
597
|
+
["VELES-007", IndexError],
|
|
598
|
+
["VELES-008", IndexCorruptedError],
|
|
599
|
+
["VELES-009", ConfigError],
|
|
600
|
+
["VELES-010", QueryError],
|
|
601
|
+
["VELES-011", IoError],
|
|
602
|
+
["VELES-012", SerializationError],
|
|
603
|
+
["VELES-013", InternalError],
|
|
604
|
+
["VELES-014", VectorNotAllowedError],
|
|
605
|
+
["VELES-015", SearchNotSupportedError],
|
|
606
|
+
["VELES-016", VectorRequiredError],
|
|
607
|
+
["VELES-017", SchemaValidationError],
|
|
608
|
+
["VELES-018", GraphNotSupportedError],
|
|
609
|
+
["VELES-019", EdgeExistsError],
|
|
610
|
+
["VELES-020", EdgeNotFoundError],
|
|
611
|
+
["VELES-021", InvalidEdgeLabelError],
|
|
612
|
+
["VELES-022", NodeNotFoundError],
|
|
613
|
+
["VELES-023", OverflowError],
|
|
614
|
+
["VELES-024", ColumnStoreError],
|
|
615
|
+
["VELES-025", GpuError],
|
|
616
|
+
["VELES-026", EpochMismatchError],
|
|
617
|
+
["VELES-027", GuardRailError],
|
|
618
|
+
["VELES-028", InvalidQuantizerConfigError],
|
|
619
|
+
["VELES-029", TrainingFailedError],
|
|
620
|
+
["VELES-030", SparseIndexError],
|
|
621
|
+
["VELES-031", DatabaseLockedError],
|
|
622
|
+
["VELES-032", InvalidDimensionError],
|
|
623
|
+
["VELES-033", AllocationFailedError],
|
|
624
|
+
["VELES-034", InvalidCollectionNameError],
|
|
625
|
+
["VELES-035", SnapshotBuildFailedError],
|
|
626
|
+
["VELES-036", IncompatibleSchemaVersionError]
|
|
627
|
+
]);
|
|
628
628
|
function parseVelesError(code, message) {
|
|
629
629
|
if (code === null || code === void 0) {
|
|
630
630
|
return new VelesError(message, "VELES-UNKNOWN");
|
|
631
631
|
}
|
|
632
|
-
const Cls = CODE_TO_CLASS
|
|
632
|
+
const Cls = CODE_TO_CLASS.get(code);
|
|
633
633
|
if (Cls !== void 0) {
|
|
634
634
|
return new Cls(message);
|
|
635
635
|
}
|
|
@@ -2801,7 +2801,8 @@ function validateDocsBatch(docs, validateDoc) {
|
|
|
2801
2801
|
}
|
|
2802
2802
|
}
|
|
2803
2803
|
function validateDocument(doc, config) {
|
|
2804
|
-
|
|
2804
|
+
const id = doc.id;
|
|
2805
|
+
if (id === void 0 || id === null) {
|
|
2805
2806
|
throw new ValidationError("Document ID is required");
|
|
2806
2807
|
}
|
|
2807
2808
|
requireVector(doc.vector, "Vector");
|
|
@@ -2856,11 +2857,15 @@ function trainPq2(backend, collection, options) {
|
|
|
2856
2857
|
return backend.trainPq(collection, options);
|
|
2857
2858
|
}
|
|
2858
2859
|
function streamInsert2(backend, config, collection, docs) {
|
|
2859
|
-
validateDocsBatch(docs, (doc) =>
|
|
2860
|
+
validateDocsBatch(docs, (doc) => {
|
|
2861
|
+
validateDocument(doc, config);
|
|
2862
|
+
});
|
|
2860
2863
|
return backend.streamInsert(collection, docs);
|
|
2861
2864
|
}
|
|
2862
2865
|
function streamUpsertPoints2(backend, config, collection, docs) {
|
|
2863
|
-
validateDocsBatch(docs, (doc) =>
|
|
2866
|
+
validateDocsBatch(docs, (doc) => {
|
|
2867
|
+
validateDocument(doc, config);
|
|
2868
|
+
});
|
|
2864
2869
|
return backend.streamUpsertPoints(collection, docs);
|
|
2865
2870
|
}
|
|
2866
2871
|
function scroll2(backend, collection, request2) {
|
|
@@ -2993,13 +2998,14 @@ var VelesDB = class {
|
|
|
2993
2998
|
this.backend = this.createBackend(config);
|
|
2994
2999
|
}
|
|
2995
3000
|
validateConfig(config) {
|
|
2996
|
-
|
|
3001
|
+
const backend = config.backend;
|
|
3002
|
+
if (!backend) {
|
|
2997
3003
|
throw new ValidationError("Backend type is required");
|
|
2998
3004
|
}
|
|
2999
|
-
if (
|
|
3000
|
-
throw new ValidationError(`Invalid backend type: ${
|
|
3005
|
+
if (backend !== "wasm" && backend !== "rest") {
|
|
3006
|
+
throw new ValidationError(`Invalid backend type: ${backend}. Use 'wasm' or 'rest'`);
|
|
3001
3007
|
}
|
|
3002
|
-
if (
|
|
3008
|
+
if (backend === "rest" && !config.url) {
|
|
3003
3009
|
throw new ValidationError("URL is required for REST backend");
|
|
3004
3010
|
}
|
|
3005
3011
|
}
|
|
@@ -3007,10 +3013,14 @@ var VelesDB = class {
|
|
|
3007
3013
|
switch (config.backend) {
|
|
3008
3014
|
case "wasm":
|
|
3009
3015
|
return new WasmBackend();
|
|
3010
|
-
case "rest":
|
|
3016
|
+
case "rest": {
|
|
3017
|
+
if (!config.url) {
|
|
3018
|
+
throw new ValidationError("URL is required for REST backend");
|
|
3019
|
+
}
|
|
3011
3020
|
return new RestBackend(config.url, config.apiKey, config.timeout);
|
|
3021
|
+
}
|
|
3012
3022
|
default:
|
|
3013
|
-
throw new ValidationError(`Unknown backend: ${config.backend}`);
|
|
3023
|
+
throw new ValidationError(`Unknown backend: ${String(config.backend)}`);
|
|
3014
3024
|
}
|
|
3015
3025
|
}
|
|
3016
3026
|
/** Initialize the client. Must be called before any other operations. */
|
|
@@ -3069,7 +3079,9 @@ var VelesDB = class {
|
|
|
3069
3079
|
}
|
|
3070
3080
|
async upsertBatch(collection, docs) {
|
|
3071
3081
|
this.ensureInitialized();
|
|
3072
|
-
validateDocsBatch(docs, (doc) =>
|
|
3082
|
+
validateDocsBatch(docs, (doc) => {
|
|
3083
|
+
validateDocument(doc, this.config);
|
|
3084
|
+
});
|
|
3073
3085
|
await this.backend.upsertBatch(collection, docs);
|
|
3074
3086
|
}
|
|
3075
3087
|
async delete(collection, id) {
|
|
@@ -3585,13 +3597,14 @@ var VelesQLBuilder = class _VelesQLBuilder {
|
|
|
3585
3597
|
return `*${min}..${max}`;
|
|
3586
3598
|
}
|
|
3587
3599
|
buildWhereClause() {
|
|
3588
|
-
|
|
3589
|
-
const
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3600
|
+
let result = "";
|
|
3601
|
+
for (const [idx, clause] of this.state.whereClauses.entries()) {
|
|
3602
|
+
if (idx === 0) {
|
|
3603
|
+
if (!clause) return "";
|
|
3604
|
+
result = clause;
|
|
3605
|
+
continue;
|
|
3606
|
+
}
|
|
3607
|
+
const operator = this.state.whereOperators[idx - 1] ?? "AND";
|
|
3595
3608
|
if (clause) {
|
|
3596
3609
|
result += ` ${operator} ${clause}`;
|
|
3597
3610
|
}
|
|
@@ -3605,13 +3618,14 @@ function velesql() {
|
|
|
3605
3618
|
|
|
3606
3619
|
// src/filter.ts
|
|
3607
3620
|
function isTypedFilter(input) {
|
|
3608
|
-
|
|
3621
|
+
const value = input;
|
|
3622
|
+
if (typeof value !== "object" || value === null) {
|
|
3609
3623
|
return false;
|
|
3610
3624
|
}
|
|
3611
|
-
if (!("condition" in
|
|
3625
|
+
if (!("condition" in value)) {
|
|
3612
3626
|
return false;
|
|
3613
3627
|
}
|
|
3614
|
-
const cond =
|
|
3628
|
+
const cond = value.condition;
|
|
3615
3629
|
return typeof cond === "object" && cond !== null;
|
|
3616
3630
|
}
|
|
3617
3631
|
function normalizeFilter(input) {
|
|
@@ -3746,6 +3760,47 @@ var f = {
|
|
|
3746
3760
|
return { condition: { type: "not", condition: filter.condition } };
|
|
3747
3761
|
}
|
|
3748
3762
|
};
|
|
3763
|
+
|
|
3764
|
+
// src/embed.ts
|
|
3765
|
+
var OpenAIEmbedder = class {
|
|
3766
|
+
constructor(options) {
|
|
3767
|
+
this.model = options.model ?? "text-embedding-3-small";
|
|
3768
|
+
this.apiKey = options.apiKey;
|
|
3769
|
+
this.baseUrl = options.baseUrl?.replace(/\/$/, "") ?? "https://api.openai.com/v1";
|
|
3770
|
+
this.requestedDimensions = options.dimensions;
|
|
3771
|
+
this.dimension = options.dimensions ?? 0;
|
|
3772
|
+
}
|
|
3773
|
+
async embed(texts) {
|
|
3774
|
+
if (texts.length === 0) return [];
|
|
3775
|
+
const body = { model: this.model, input: texts };
|
|
3776
|
+
if (this.requestedDimensions !== void 0) {
|
|
3777
|
+
body["dimensions"] = this.requestedDimensions;
|
|
3778
|
+
}
|
|
3779
|
+
const response = await fetch(`${this.baseUrl}/embeddings`, {
|
|
3780
|
+
method: "POST",
|
|
3781
|
+
headers: {
|
|
3782
|
+
"Content-Type": "application/json",
|
|
3783
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
3784
|
+
},
|
|
3785
|
+
body: JSON.stringify(body)
|
|
3786
|
+
});
|
|
3787
|
+
if (!response.ok) {
|
|
3788
|
+
const text = await response.text().catch(() => "");
|
|
3789
|
+
throw new Error(
|
|
3790
|
+
`OpenAI embeddings request failed: ${response.status} ${response.statusText} \u2014 ${text.slice(0, 500)}`
|
|
3791
|
+
);
|
|
3792
|
+
}
|
|
3793
|
+
const json = await response.json();
|
|
3794
|
+
const vectors = json.data.map((item) => item.embedding);
|
|
3795
|
+
if (this.dimension === 0) {
|
|
3796
|
+
for (const vec of vectors) {
|
|
3797
|
+
this.dimension = vec.length;
|
|
3798
|
+
break;
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3801
|
+
return vectors;
|
|
3802
|
+
}
|
|
3803
|
+
};
|
|
3749
3804
|
export {
|
|
3750
3805
|
AgentMemoryClient,
|
|
3751
3806
|
AllocationFailedError,
|
|
@@ -3775,6 +3830,7 @@ export {
|
|
|
3775
3830
|
IoError,
|
|
3776
3831
|
NodeNotFoundError,
|
|
3777
3832
|
NotFoundError,
|
|
3833
|
+
OpenAIEmbedder,
|
|
3778
3834
|
OverflowError,
|
|
3779
3835
|
PointNotFoundError,
|
|
3780
3836
|
QueryError,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wiscale/velesdb-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "VelesDB TypeScript SDK: The Local Vector Database for AI & RAG. Microsecond semantic search in Browser & Node.js.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -54,12 +54,12 @@
|
|
|
54
54
|
"url": "https://github.com/cyberlife-coder/VelesDB/issues"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@eslint/js": "^
|
|
57
|
+
"@eslint/js": "^10.0.1",
|
|
58
58
|
"@types/node": "^25.6.0",
|
|
59
59
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
60
60
|
"@typescript-eslint/parser": "^8.0.0",
|
|
61
61
|
"@vitest/coverage-v8": "^4.0.16",
|
|
62
|
-
"eslint": "^10.
|
|
62
|
+
"eslint": "^10.4.0",
|
|
63
63
|
"eslint-config-prettier": "^10.1.8",
|
|
64
64
|
"prettier": "^3.0.0",
|
|
65
65
|
"tsup": "^8.0.0",
|