Skip to content

Commit debb4f4

Browse files
feat: add workflows for cherry-picking and release management
- Implement cherry-pick workflow to automate cherry-picking merged PRs to main - Create script to compute next patch version based on git tags - Enhance release branch creation workflow with input validation and versioning - Add publish release workflow for managing npm package releases - Introduce trigger for documentation updates on release and PR merges
1 parent 14f534e commit debb4f4

60 files changed

Lines changed: 7573 additions & 1188 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/api-reference/errors.mdx

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
---
2+
title: "Error Classes"
3+
description: "VectoriaDB error types and codes"
4+
icon: "triangle-exclamation"
5+
---
6+
7+
All VectoriaDB errors extend `VectoriaError` and include machine-readable `code` values.
8+
9+
## Error Types
10+
11+
| Error | Code | Description |
12+
|-------|------|-------------|
13+
| `VectoriaNotInitializedError` | `NOT_INITIALIZED` | Call `initialize()` first |
14+
| `DocumentValidationError` | `DOCUMENT_VALIDATION_ERROR` | Invalid document data |
15+
| `DocumentNotFoundError` | `DOCUMENT_NOT_FOUND` | Document ID doesn't exist |
16+
| `DocumentExistsError` | `DOCUMENT_EXISTS` | Document ID already exists |
17+
| `DuplicateDocumentError` | `DUPLICATE_DOCUMENT` | Duplicate in batch |
18+
| `QueryValidationError` | `QUERY_VALIDATION_ERROR` | Invalid search query |
19+
| `EmbeddingError` | `EMBEDDING_ERROR` | Model embedding failed |
20+
| `StorageError` | `STORAGE_ERROR` | Storage operation failed |
21+
| `ConfigurationError` | `CONFIGURATION_ERROR` | Invalid config |
22+
23+
## Importing Errors
24+
25+
```ts
26+
import {
27+
VectoriaError,
28+
VectoriaNotInitializedError,
29+
DocumentValidationError,
30+
DocumentNotFoundError,
31+
DocumentExistsError,
32+
DuplicateDocumentError,
33+
QueryValidationError,
34+
EmbeddingError,
35+
StorageError,
36+
ConfigurationError,
37+
} from 'vectoriadb';
38+
```
39+
40+
## VectoriaError
41+
42+
Base class for all VectoriaDB errors.
43+
44+
```ts
45+
class VectoriaError extends Error {
46+
readonly code: string;
47+
48+
constructor(message: string, code: string);
49+
}
50+
```
51+
52+
---
53+
54+
## VectoriaNotInitializedError
55+
56+
Thrown when operations are attempted before initialization.
57+
58+
```ts
59+
class VectoriaNotInitializedError extends VectoriaError {
60+
constructor(operation: string);
61+
}
62+
```
63+
64+
### Example
65+
66+
```ts
67+
try {
68+
await db.add('id', 'text', metadata);
69+
} catch (error) {
70+
if (error instanceof VectoriaNotInitializedError) {
71+
await db.initialize();
72+
await db.add('id', 'text', metadata);
73+
}
74+
}
75+
```
76+
77+
---
78+
79+
## DocumentValidationError
80+
81+
Thrown when document validation fails.
82+
83+
```ts
84+
class DocumentValidationError extends VectoriaError {
85+
readonly documentId?: string;
86+
87+
constructor(message: string, documentId?: string);
88+
}
89+
```
90+
91+
---
92+
93+
## DocumentNotFoundError
94+
95+
Thrown when a document ID doesn't exist.
96+
97+
```ts
98+
class DocumentNotFoundError extends VectoriaError {
99+
readonly documentId: string;
100+
101+
constructor(documentId: string);
102+
}
103+
```
104+
105+
---
106+
107+
## DocumentExistsError
108+
109+
Thrown when adding a document with an existing ID.
110+
111+
```ts
112+
class DocumentExistsError extends VectoriaError {
113+
readonly documentId: string;
114+
115+
constructor(documentId: string);
116+
}
117+
```
118+
119+
---
120+
121+
## DuplicateDocumentError
122+
123+
Thrown when duplicates are found in batch operations.
124+
125+
```ts
126+
class DuplicateDocumentError extends VectoriaError {
127+
readonly documentId: string;
128+
readonly context: 'batch' | 'existing';
129+
130+
constructor(documentId: string, context: 'batch' | 'existing');
131+
}
132+
```
133+
134+
---
135+
136+
## QueryValidationError
137+
138+
Thrown when search parameters are invalid.
139+
140+
```ts
141+
class QueryValidationError extends VectoriaError {
142+
constructor(message: string);
143+
}
144+
```
145+
146+
---
147+
148+
## EmbeddingError
149+
150+
Thrown when embedding generation fails.
151+
152+
```ts
153+
class EmbeddingError extends VectoriaError {
154+
readonly details?: any;
155+
156+
constructor(message: string, details?: any);
157+
}
158+
```
159+
160+
---
161+
162+
## StorageError
163+
164+
Thrown when storage operations fail.
165+
166+
```ts
167+
class StorageError extends VectoriaError {
168+
readonly originalError?: Error;
169+
170+
constructor(message: string, originalError?: Error);
171+
}
172+
```
173+
174+
---
175+
176+
## ConfigurationError
177+
178+
Thrown when configuration is invalid.
179+
180+
```ts
181+
class ConfigurationError extends VectoriaError {
182+
constructor(message: string);
183+
}
184+
```
185+
186+
## Error Handling Pattern
187+
188+
```ts
189+
try {
190+
await db.addMany(documents);
191+
} catch (error) {
192+
if (error instanceof VectoriaNotInitializedError) {
193+
await db.initialize();
194+
return; // Retry
195+
}
196+
197+
if (error instanceof DocumentValidationError) {
198+
console.warn(`Invalid document: ${error.documentId}`);
199+
return;
200+
}
201+
202+
if (error instanceof VectoriaError) {
203+
console.error(`VectoriaDB error [${error.code}]:`, error.message);
204+
return;
205+
}
206+
207+
throw error; // Re-throw unexpected errors
208+
}
209+
```
210+
211+
## Related
212+
213+
<CardGroup cols={2}>
214+
<Card title="Common Errors" icon="triangle-exclamation" href="/troubleshooting/common-errors">
215+
Error solutions
216+
</Card>
217+
<Card title="FAQ" icon="circle-question" href="/troubleshooting/faq">
218+
Frequently asked questions
219+
</Card>
220+
</CardGroup>
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
---
2+
title: "Configuration Interfaces"
3+
description: "VectoriaConfig and related configuration types"
4+
icon: "gear"
5+
---
6+
7+
Configuration interfaces for VectoriaDB.
8+
9+
## VectoriaConfig
10+
11+
Main configuration interface for VectoriaDB constructor.
12+
13+
```ts
14+
interface VectoriaConfig {
15+
/**
16+
* Name of the embedding model to use
17+
* @default 'Xenova/all-MiniLM-L6-v2'
18+
*/
19+
modelName?: string;
20+
21+
/**
22+
* Directory to cache downloaded models
23+
* @default './.cache/transformers'
24+
*/
25+
cacheDir?: string;
26+
27+
/**
28+
* Vector dimensions (auto-detected from model if not provided)
29+
*/
30+
dimensions?: number;
31+
32+
/**
33+
* Default similarity threshold for search results
34+
* @default 0.3
35+
*/
36+
defaultSimilarityThreshold?: number;
37+
38+
/**
39+
* Maximum number of results to return by default
40+
* @default 10
41+
*/
42+
defaultTopK?: number;
43+
44+
/**
45+
* Enable HNSW index for faster search
46+
* @default false
47+
*/
48+
useHNSW?: boolean;
49+
50+
/**
51+
* HNSW index configuration
52+
*/
53+
hnsw?: HNSWConfig;
54+
55+
/**
56+
* Storage adapter for persisting embeddings
57+
* @default MemoryStorageAdapter
58+
*/
59+
storageAdapter?: StorageAdapter;
60+
61+
/**
62+
* Tools hash for cache invalidation
63+
*/
64+
toolsHash?: string;
65+
66+
/**
67+
* Version string for cache compatibility
68+
* @default '1.0.0'
69+
*/
70+
version?: string;
71+
72+
/**
73+
* Maximum number of documents allowed
74+
* @default 100000
75+
*/
76+
maxDocuments?: number;
77+
78+
/**
79+
* Maximum size of a single document text (in characters)
80+
* @default 1000000
81+
*/
82+
maxDocumentSize?: number;
83+
84+
/**
85+
* Maximum number of documents in a single batch
86+
* @default 1000
87+
*/
88+
maxBatchSize?: number;
89+
90+
/**
91+
* Enable verbose error messages
92+
* @default true
93+
*/
94+
verboseErrors?: boolean;
95+
}
96+
```
97+
98+
---
99+
100+
## HNSWConfig
101+
102+
Configuration for HNSW indexing.
103+
104+
```ts
105+
interface HNSWConfig {
106+
/**
107+
* Maximum connections per node in layer > 0
108+
* @default 16
109+
*/
110+
M?: number;
111+
112+
/**
113+
* Maximum connections for layer 0
114+
* @default 32
115+
*/
116+
M0?: number;
117+
118+
/**
119+
* Candidate list size during construction
120+
* @default 200
121+
*/
122+
efConstruction?: number;
123+
124+
/**
125+
* Candidate list size during search
126+
* @default 50
127+
*/
128+
efSearch?: number;
129+
}
130+
```
131+
132+
---
133+
134+
## StorageAdapterConfig
135+
136+
Base configuration for storage adapters.
137+
138+
```ts
139+
interface StorageAdapterConfig {
140+
/**
141+
* Namespace for storage keys
142+
*/
143+
namespace?: string;
144+
145+
/**
146+
* Whether to automatically save on changes
147+
* @default false
148+
*/
149+
autoSave?: boolean;
150+
151+
/**
152+
* Interval for auto-save in milliseconds
153+
* @default 60000
154+
*/
155+
autoSaveInterval?: number;
156+
}
157+
```
158+
159+
## Related
160+
161+
<CardGroup cols={3}>
162+
<Card title="Constructor" icon="plus" href="/api-reference/vectoriadb/constructor">
163+
Using config
164+
</Card>
165+
<Card title="Documents" icon="file-lines" href="/api-reference/interfaces/documents">
166+
Document interfaces
167+
</Card>
168+
<Card title="Search" icon="magnifying-glass" href="/api-reference/interfaces/search">
169+
Search interfaces
170+
</Card>
171+
</CardGroup>

0 commit comments

Comments
 (0)