@memberjunction/ai-vectors 3.4.0 → 4.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/README.md +188 -271
- package/dist/generic/IEmbedding.js +1 -2
- package/dist/generic/IVectorDatabase.js +1 -2
- package/dist/generic/IVectorIndex.js +1 -2
- package/dist/generic/VectorCore.types.d.ts +15 -0
- package/dist/generic/VectorCore.types.d.ts.map +1 -1
- package/dist/generic/VectorCore.types.js +1 -2
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -21
- package/dist/index.js.map +1 -1
- package/dist/models/VectorBase.d.ts +5 -1
- package/dist/models/VectorBase.d.ts.map +1 -1
- package/dist/models/VectorBase.js +16 -16
- package/dist/models/VectorBase.js.map +1 -1
- package/package.json +14 -13
package/README.md
CHANGED
|
@@ -1,356 +1,273 @@
|
|
|
1
1
|
# @memberjunction/ai-vectors
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The core foundation package for vector operations in MemberJunction. Provides base classes, interfaces, and type definitions that all other vector packages build upon.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
```mermaid
|
|
8
|
+
graph TD
|
|
9
|
+
subgraph Core["@memberjunction/ai-vectors"]
|
|
10
|
+
VB["VectorBase"]
|
|
11
|
+
IE["IEmbedding"]
|
|
12
|
+
IVD["IVectorDatabase"]
|
|
13
|
+
IVI["IVectorIndex"]
|
|
14
|
+
PT["PageRecordsParams"]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
subgraph MJCore["MemberJunction Core"]
|
|
18
|
+
MD["Metadata"]
|
|
19
|
+
RV["RunView"]
|
|
20
|
+
BE["BaseEntity"]
|
|
21
|
+
UI["UserInfo"]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
subgraph AIEngine["AI Engine"]
|
|
25
|
+
AIM["AIEngine.Instance"]
|
|
26
|
+
MOD["Embedding Models"]
|
|
27
|
+
VDB["Vector Databases"]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
subgraph Consumers["Consumer Packages"]
|
|
31
|
+
SYNC["ai-vector-sync"]
|
|
32
|
+
DUPE["ai-vector-dupe"]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
VB --> MD
|
|
36
|
+
VB --> RV
|
|
37
|
+
VB --> BE
|
|
38
|
+
VB --> AIM
|
|
39
|
+
AIM --> MOD
|
|
40
|
+
AIM --> VDB
|
|
41
|
+
SYNC --> VB
|
|
42
|
+
DUPE --> VB
|
|
43
|
+
|
|
44
|
+
style Core fill:#2d6a9f,stroke:#1a4971,color:#fff
|
|
45
|
+
style MJCore fill:#2d8659,stroke:#1a5c3a,color:#fff
|
|
46
|
+
style AIEngine fill:#b8762f,stroke:#8a5722,color:#fff
|
|
47
|
+
style Consumers fill:#7c5295,stroke:#563a6b,color:#fff
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install @memberjunction/ai-vectors
|
|
54
|
+
```
|
|
4
55
|
|
|
5
56
|
## Overview
|
|
6
57
|
|
|
7
|
-
This package serves as the
|
|
8
|
-
- Abstract interfaces for vector database and embedding operations
|
|
9
|
-
- Base class implementation with entity integration
|
|
10
|
-
- Type definitions for pagination and data handling
|
|
11
|
-
- Seamless integration with MemberJunction's metadata system and AI engine
|
|
58
|
+
This package serves as the shared foundation for all vector-related operations in MemberJunction. It provides:
|
|
12
59
|
|
|
13
|
-
|
|
60
|
+
- **VectorBase** -- a base class that integrates with MemberJunction metadata, AI models, vector databases, and the entity system
|
|
61
|
+
- **Interfaces** -- contracts for embedding generation (`IEmbedding`), vector database management (`IVectorDatabase`), and vector index CRUD (`IVectorIndex`)
|
|
62
|
+
- **Type definitions** -- `PageRecordsParams` for paginated data retrieval across entities
|
|
14
63
|
|
|
15
|
-
-
|
|
16
|
-
- **Base Classes**: Base implementation patterns for vector-related functionality
|
|
17
|
-
- **Database Abstraction**: Interface for vector database operations
|
|
18
|
-
- **Embedding Abstraction**: Interface for text embedding generation
|
|
19
|
-
- **Entity Integration**: Seamless integration with MemberJunction entities
|
|
20
|
-
- **Pagination Support**: Efficiently retrieve and process large sets of records
|
|
21
|
-
- **Type Definitions**: Comprehensive TypeScript types for vector operations
|
|
22
|
-
- **AI Model Integration**: Built-in support for accessing embedding models
|
|
23
|
-
- **User Context Management**: Automatic handling of user context for entity operations
|
|
64
|
+
All higher-level vector packages (`ai-vector-sync`, `ai-vector-dupe`) extend `VectorBase` to inherit its data access, model lookup, and user context capabilities.
|
|
24
65
|
|
|
25
|
-
##
|
|
66
|
+
## Core Components
|
|
26
67
|
|
|
27
|
-
|
|
28
|
-
|
|
68
|
+
### VectorBase Class
|
|
69
|
+
|
|
70
|
+
The primary class that downstream packages extend. It wraps MemberJunction's `Metadata`, `RunView`, and `AIEngine` systems into a unified base for vector operations.
|
|
71
|
+
|
|
72
|
+
```mermaid
|
|
73
|
+
classDiagram
|
|
74
|
+
class VectorBase {
|
|
75
|
+
+Metadata : Metadata
|
|
76
|
+
+RunView : RunView
|
|
77
|
+
+CurrentUser : UserInfo
|
|
78
|
+
#GetRecordsByEntityID(entityID, recordIDs?) BaseEntity[]
|
|
79
|
+
#PageRecordsByEntityID~T~(params) T[]
|
|
80
|
+
#GetAIModel(id?) AIModelEntityExtended
|
|
81
|
+
#GetVectorDatabase(id?) VectorDatabaseEntity
|
|
82
|
+
#RunViewForSingleValue~T~(entityName, filter) T
|
|
83
|
+
#SaveEntity(entity) boolean
|
|
84
|
+
#BuildExtraFilter(compositeKeys) string
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
class EntityVectorSyncer {
|
|
88
|
+
+VectorizeEntity(params, user) VectorizeEntityResponse
|
|
89
|
+
+Config(forceRefresh, user) void
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
class DuplicateRecordDetector {
|
|
93
|
+
+getDuplicateRecords(params, user) PotentialDuplicateResponse
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
VectorBase <|-- EntityVectorSyncer
|
|
97
|
+
VectorBase <|-- DuplicateRecordDetector
|
|
98
|
+
|
|
99
|
+
style VectorBase fill:#2d6a9f,stroke:#1a4971,color:#fff
|
|
100
|
+
style EntityVectorSyncer fill:#7c5295,stroke:#563a6b,color:#fff
|
|
101
|
+
style DuplicateRecordDetector fill:#7c5295,stroke:#563a6b,color:#fff
|
|
29
102
|
```
|
|
30
103
|
|
|
31
|
-
|
|
104
|
+
**Key capabilities:**
|
|
32
105
|
|
|
33
|
-
|
|
106
|
+
| Method | Purpose |
|
|
107
|
+
|---|---|
|
|
108
|
+
| `GetRecordsByEntityID` | Load all entity records, optionally filtered by composite keys |
|
|
109
|
+
| `PageRecordsByEntityID` | Paginated retrieval with configurable page size, result type, and filter |
|
|
110
|
+
| `GetAIModel` | Locate an embedding model from `AIEngine.Instance.Models` by ID or get the first available |
|
|
111
|
+
| `GetVectorDatabase` | Locate a vector database from `AIEngine.Instance.VectorDatabases` by ID or get the first available |
|
|
112
|
+
| `RunViewForSingleValue` | Query for a single entity record matching a filter |
|
|
113
|
+
| `SaveEntity` | Save a `BaseEntity` with the current user context automatically applied |
|
|
114
|
+
| `BuildExtraFilter` | Convert an array of `CompositeKey` objects into a SQL filter string |
|
|
34
115
|
|
|
35
|
-
|
|
116
|
+
### Interfaces
|
|
36
117
|
|
|
37
118
|
#### IEmbedding
|
|
38
119
|
|
|
39
|
-
|
|
120
|
+
Contract for text embedding providers:
|
|
40
121
|
|
|
41
122
|
```typescript
|
|
42
123
|
interface IEmbedding {
|
|
43
|
-
|
|
44
|
-
|
|
124
|
+
createEmbedding(text: string, options?: unknown): unknown;
|
|
125
|
+
createBatchEmbedding(text: string[], options?: unknown): unknown;
|
|
45
126
|
}
|
|
46
127
|
```
|
|
47
128
|
|
|
48
129
|
#### IVectorDatabase
|
|
49
130
|
|
|
50
|
-
|
|
131
|
+
Contract for vector database management operations:
|
|
51
132
|
|
|
52
133
|
```typescript
|
|
53
134
|
interface IVectorDatabase {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
135
|
+
listIndexes(options?: unknown): unknown;
|
|
136
|
+
createIndex(options: unknown): unknown;
|
|
137
|
+
deleteIndex(indexID: unknown, options?: unknown): unknown;
|
|
138
|
+
editIndex(indexID: unknown, options?: unknown): unknown;
|
|
58
139
|
}
|
|
59
140
|
```
|
|
60
141
|
|
|
61
142
|
#### IVectorIndex
|
|
62
143
|
|
|
63
|
-
|
|
144
|
+
Contract for CRUD operations on vector records within an index:
|
|
64
145
|
|
|
65
146
|
```typescript
|
|
66
147
|
interface IVectorIndex {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
148
|
+
createRecord(record: unknown, options?: unknown): unknown;
|
|
149
|
+
createRecords(records: unknown[], options?: unknown): unknown;
|
|
150
|
+
getRecord(recordID: unknown, options?: unknown): unknown;
|
|
151
|
+
getRecords(recordIDs: unknown[], options?: unknown): unknown;
|
|
152
|
+
updateRecord(record: unknown, options?: unknown): unknown;
|
|
153
|
+
updateRecords(records: unknown[], options?: unknown): unknown;
|
|
154
|
+
deleteRecord(recordID: unknown, options?: unknown): unknown;
|
|
155
|
+
deleteRecords(recordIDs: unknown[], options?: unknown): unknown;
|
|
75
156
|
}
|
|
76
157
|
```
|
|
77
158
|
|
|
78
|
-
###
|
|
79
|
-
|
|
80
|
-
The `VectorBase` class serves as the foundation for vector operations, providing:
|
|
81
|
-
|
|
82
|
-
- Integration with MemberJunction's metadata system
|
|
83
|
-
- Entity record retrieval and manipulation
|
|
84
|
-
- Pagination support for handling large datasets
|
|
85
|
-
- Helper methods for AI model and vector database access
|
|
86
|
-
- Automatic user context management for entity operations
|
|
87
|
-
- Built-in RunView integration for flexible data querying
|
|
88
|
-
|
|
89
|
-
#### Key Methods
|
|
90
|
-
|
|
91
|
-
- `GetRecordsByEntityID(entityID: string, recordIDs?: CompositeKey[]): Promise<BaseEntity[]>` - Retrieve entity records with optional filtering
|
|
92
|
-
- `PageRecordsByEntityID<T>(params: PageRecordsParams): Promise<T[]>` - Paginated entity record retrieval
|
|
93
|
-
- `GetAIModel(id?: string): AIModelEntityExtended` - Access configured embedding models
|
|
94
|
-
- `GetVectorDatabase(id?: string): VectorDatabaseEntity` - Access configured vector databases
|
|
95
|
-
- `RunViewForSingleValue<T>(entityName: string, extraFilter: string): Promise<T | null>` - Query for single entity records
|
|
96
|
-
- `SaveEntity(entity: BaseEntity): Promise<boolean>` - Save entities with proper user context
|
|
159
|
+
### PageRecordsParams Type
|
|
97
160
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
#### PageRecordsParams
|
|
101
|
-
|
|
102
|
-
Type definition for paginated record retrieval:
|
|
161
|
+
Configuration for paginated entity record retrieval:
|
|
103
162
|
|
|
104
163
|
```typescript
|
|
105
164
|
type PageRecordsParams = {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
165
|
+
EntityID: string | number;
|
|
166
|
+
PageNumber: number;
|
|
167
|
+
PageSize: number;
|
|
168
|
+
ResultType: "entity_object" | "simple" | "count_only";
|
|
169
|
+
Filter?: string;
|
|
170
|
+
};
|
|
112
171
|
```
|
|
113
172
|
|
|
114
173
|
## Usage
|
|
115
174
|
|
|
116
|
-
### Extending
|
|
175
|
+
### Extending VectorBase
|
|
117
176
|
|
|
118
|
-
Create specialized vector
|
|
177
|
+
Create specialized vector processing classes by extending `VectorBase`:
|
|
119
178
|
|
|
120
179
|
```typescript
|
|
121
180
|
import { VectorBase, PageRecordsParams } from '@memberjunction/ai-vectors';
|
|
122
181
|
import { BaseEntity } from '@memberjunction/core';
|
|
123
182
|
|
|
124
183
|
export class MyVectorProcessor extends VectorBase {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
// Process each record
|
|
130
|
-
for (const record of records) {
|
|
131
|
-
// Your vector processing logic here
|
|
132
|
-
console.log(`Processing ${record.EntityInfo.Name} record ${record.ID}`);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
async paginatedProcess(entityId: string): Promise<void> {
|
|
137
|
-
// Process records page by page
|
|
138
|
-
const params: PageRecordsParams = {
|
|
139
|
-
EntityID: entityId,
|
|
140
|
-
PageNumber: 1,
|
|
141
|
-
PageSize: 100,
|
|
142
|
-
ResultType: 'entity_object' as const
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
const records = await this.PageRecordsByEntityID<BaseEntity>(params);
|
|
146
|
-
// Process paged records
|
|
147
|
-
console.log(`Retrieved ${records.length} records`);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### Implementing the Interfaces
|
|
184
|
+
async processEntity(entityId: string): Promise<void> {
|
|
185
|
+
// Retrieve all records for an entity
|
|
186
|
+
const records = await this.GetRecordsByEntityID(entityId);
|
|
153
187
|
|
|
154
|
-
|
|
188
|
+
// Access configured AI models and vector databases
|
|
189
|
+
const model = this.GetAIModel();
|
|
190
|
+
const vectorDb = this.GetVectorDatabase();
|
|
155
191
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
constructor(private apiKey: string) {}
|
|
161
|
-
|
|
162
|
-
async createEmbedding(text: string): Promise<number[]> {
|
|
163
|
-
// Implementation using OpenAI's embedding API
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
async createBatchEmbedding(texts: string[]): Promise<number[][]> {
|
|
167
|
-
// Batch implementation
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Working with Entity Records
|
|
173
|
-
|
|
174
|
-
The package provides utilities for working with MemberJunction entities:
|
|
192
|
+
for (const record of records) {
|
|
193
|
+
// Process each record with the embedding model and vector DB
|
|
194
|
+
}
|
|
195
|
+
}
|
|
175
196
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
let hasMoreRecords = true;
|
|
194
|
-
|
|
195
|
-
while (hasMoreRecords) {
|
|
196
|
-
const params: PageRecordsParams = {
|
|
197
|
-
EntityID: entityId,
|
|
198
|
-
PageNumber: pageNumber,
|
|
199
|
-
PageSize: 50,
|
|
200
|
-
ResultType: 'entity_object' as const,
|
|
201
|
-
Filter: "IsActive = 1" // Optional: add custom filtering
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
const records = await this.PageRecordsByEntityID<BaseEntity>(params);
|
|
205
|
-
hasMoreRecords = records.length === params.PageSize;
|
|
206
|
-
pageNumber++;
|
|
207
|
-
|
|
208
|
-
// Process the current page of records
|
|
209
|
-
for (const record of records) {
|
|
210
|
-
// Your vectorization logic here
|
|
211
|
-
// Example: Generate embeddings for record content
|
|
212
|
-
}
|
|
197
|
+
async processInPages(entityId: string): Promise<void> {
|
|
198
|
+
let page = 1;
|
|
199
|
+
let hasMore = true;
|
|
200
|
+
|
|
201
|
+
while (hasMore) {
|
|
202
|
+
const params: PageRecordsParams = {
|
|
203
|
+
EntityID: entityId,
|
|
204
|
+
PageNumber: page,
|
|
205
|
+
PageSize: 100,
|
|
206
|
+
ResultType: 'simple',
|
|
207
|
+
Filter: "Status = 'Active'"
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const records = await this.PageRecordsByEntityID<Record<string, unknown>>(params);
|
|
211
|
+
hasMore = records.length === 100;
|
|
212
|
+
page++;
|
|
213
|
+
}
|
|
213
214
|
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
async saveVectorizedEntity(entity: BaseEntity): Promise<boolean> {
|
|
217
|
-
// SaveEntity automatically adds user context
|
|
218
|
-
return await this.SaveEntity(entity);
|
|
219
|
-
}
|
|
220
215
|
}
|
|
221
216
|
```
|
|
222
217
|
|
|
223
|
-
###
|
|
224
|
-
|
|
225
|
-
Use composite keys for complex filtering scenarios:
|
|
218
|
+
### Filtering with Composite Keys
|
|
226
219
|
|
|
227
220
|
```typescript
|
|
228
221
|
import { VectorBase } from '@memberjunction/ai-vectors';
|
|
229
222
|
import { CompositeKey } from '@memberjunction/core';
|
|
230
223
|
|
|
231
|
-
class
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
{ FieldName: 'Status', Value: 'Active' },
|
|
238
|
-
{ FieldName: 'CategoryID', Value: '123' }
|
|
239
|
-
]
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
KeyValuePairs: [
|
|
243
|
-
{ FieldName: 'Status', Value: 'Pending' },
|
|
244
|
-
{ FieldName: 'CategoryID', Value: '456' }
|
|
245
|
-
]
|
|
246
|
-
}
|
|
247
|
-
];
|
|
248
|
-
|
|
249
|
-
// This will generate: (Status = 'Active' AND CategoryID = '123') OR (Status = 'Pending' AND CategoryID = '456')
|
|
250
|
-
const records = await this.GetRecordsByEntityID(entityId, compositeKeys);
|
|
251
|
-
console.log(`Found ${records.length} matching records`);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
## Integration with MemberJunction
|
|
257
|
-
|
|
258
|
-
This package works in harmony with other MemberJunction packages:
|
|
224
|
+
class FilteredProcessor extends VectorBase {
|
|
225
|
+
async getSpecificRecords(entityId: string): Promise<void> {
|
|
226
|
+
const keys: CompositeKey[] = [
|
|
227
|
+
{ KeyValuePairs: [{ FieldName: 'ID', Value: 'abc-123' }] },
|
|
228
|
+
{ KeyValuePairs: [{ FieldName: 'ID', Value: 'def-456' }] }
|
|
229
|
+
];
|
|
259
230
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
// Your vector processing will have access to:
|
|
266
|
-
// - Entity metadata
|
|
267
|
-
// - AI models configuration
|
|
268
|
-
// - Vector database configuration
|
|
269
|
-
// - User context
|
|
231
|
+
// Generates: (ID = 'abc-123') OR (ID = 'def-456')
|
|
232
|
+
const records = await this.GetRecordsByEntityID(entityId, keys);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
270
235
|
```
|
|
271
236
|
|
|
272
237
|
## Package Ecosystem
|
|
273
238
|
|
|
274
|
-
This
|
|
275
|
-
|
|
276
|
-
- `@memberjunction/ai-vectors` - Core abstractions (this package)
|
|
277
|
-
- `@memberjunction/ai-vectordb` - Vector database interface
|
|
278
|
-
- `@memberjunction/ai-vectors-memory` - In-memory vector similarity search
|
|
279
|
-
- `@memberjunction/ai-vectors-sync` - Entity synchronization with vector databases
|
|
280
|
-
- `@memberjunction/ai-vectors-pinecone` - Pinecone vector database implementation
|
|
281
|
-
- `@memberjunction/ai-vectors-dupe` - Duplicate detection using vector similarity
|
|
282
|
-
|
|
283
|
-
## Configuration
|
|
239
|
+
This package sits at the base of the MemberJunction vector package hierarchy:
|
|
284
240
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
1. **Always extend VectorBase** for custom vector operations to ensure proper integration
|
|
294
|
-
2. **Use pagination** when processing large datasets to avoid memory issues
|
|
295
|
-
3. **Handle errors gracefully** - the base class methods throw exceptions that should be caught
|
|
296
|
-
4. **Set user context** - The base class automatically manages user context for entity operations
|
|
297
|
-
5. **Use type-safe generics** - When using `PageRecordsByEntityID`, specify the expected type
|
|
298
|
-
|
|
299
|
-
## Error Handling
|
|
300
|
-
|
|
301
|
-
The package provides clear error messages for common scenarios:
|
|
302
|
-
|
|
303
|
-
```typescript
|
|
304
|
-
try {
|
|
305
|
-
const model = this.GetAIModel('specific-model-id');
|
|
306
|
-
} catch (error) {
|
|
307
|
-
// Will throw if no embedding model is configured
|
|
308
|
-
console.error('No AI Model Entity found');
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
try {
|
|
312
|
-
const records = await this.GetRecordsByEntityID('invalid-id');
|
|
313
|
-
} catch (error) {
|
|
314
|
-
// Will throw if entity ID doesn't exist
|
|
315
|
-
console.error(`Entity with ID invalid-id not found.`);
|
|
316
|
-
}
|
|
317
|
-
```
|
|
241
|
+
| Package | Depends On Core | Purpose |
|
|
242
|
+
|---|---|---|
|
|
243
|
+
| `@memberjunction/ai-vectordb` | No (peer) | Abstract vector database interface |
|
|
244
|
+
| `@memberjunction/ai-vector-sync` | Yes | Entity-to-vector synchronization |
|
|
245
|
+
| `@memberjunction/ai-vector-dupe` | Yes | Duplicate detection via vector similarity |
|
|
246
|
+
| `@memberjunction/ai-vectors-memory` | No | In-memory vector search and clustering |
|
|
247
|
+
| `@memberjunction/ai-vectors-pinecone` | No | Pinecone implementation of `VectorDBBase` |
|
|
318
248
|
|
|
319
249
|
## Dependencies
|
|
320
250
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
-
|
|
251
|
+
| Package | Purpose |
|
|
252
|
+
|---|---|
|
|
253
|
+
| `@memberjunction/core` | Metadata, RunView, BaseEntity, UserInfo |
|
|
254
|
+
| `@memberjunction/global` | MJGlobal class factory |
|
|
255
|
+
| `@memberjunction/core-entities` | VectorDatabaseEntity and other entity types |
|
|
256
|
+
| `@memberjunction/aiengine` | AIEngine singleton for model and database discovery |
|
|
257
|
+
| `@memberjunction/ai` | Base AI abstractions |
|
|
258
|
+
| `@memberjunction/ai-core-plus` | AIModelEntityExtended |
|
|
259
|
+
| `@memberjunction/ai-vectordb` | VectorDBBase and related types |
|
|
329
260
|
|
|
330
261
|
## Development
|
|
331
262
|
|
|
332
|
-
### Building
|
|
333
|
-
|
|
334
263
|
```bash
|
|
264
|
+
# Build
|
|
335
265
|
npm run build
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
### Development Mode
|
|
339
266
|
|
|
340
|
-
|
|
267
|
+
# Development mode
|
|
341
268
|
npm run start
|
|
342
269
|
```
|
|
343
270
|
|
|
344
|
-
## Contributing
|
|
345
|
-
|
|
346
|
-
When contributing to this package:
|
|
347
|
-
|
|
348
|
-
1. Follow the MemberJunction coding standards
|
|
349
|
-
2. Ensure all interfaces remain generic and implementation-agnostic
|
|
350
|
-
3. Add comprehensive TypeScript types
|
|
351
|
-
4. Update this README with any new features or changes
|
|
352
|
-
5. Test integration with dependent packages
|
|
353
|
-
|
|
354
271
|
## License
|
|
355
272
|
|
|
356
|
-
ISC
|
|
273
|
+
ISC
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
export type PageRecordsParams = {
|
|
2
|
+
/**
|
|
3
|
+
* The ID of the entitiy to get the records from
|
|
4
|
+
*/
|
|
2
5
|
EntityID: string | number;
|
|
6
|
+
/**
|
|
7
|
+
* Number of records to offset. This number will be multiplied by the PageSize to get the actual offset
|
|
8
|
+
*/
|
|
3
9
|
PageNumber: number;
|
|
10
|
+
/**
|
|
11
|
+
* Number of records returned per page
|
|
12
|
+
*/
|
|
4
13
|
PageSize: number;
|
|
14
|
+
/**
|
|
15
|
+
* The type of result to return
|
|
16
|
+
*/
|
|
5
17
|
ResultType: "entity_object" | "simple" | "count_only";
|
|
18
|
+
/**
|
|
19
|
+
* Filter to apply to the query
|
|
20
|
+
*/
|
|
6
21
|
Filter?: string;
|
|
7
22
|
};
|
|
8
23
|
//# sourceMappingURL=VectorCore.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorCore.types.d.ts","sourceRoot":"","sources":["../../src/generic/VectorCore.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;
|
|
1
|
+
{"version":3,"file":"VectorCore.types.d.ts","sourceRoot":"","sources":["../../src/generic/VectorCore.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC5B;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,EAAE,eAAe,GAAG,QAAQ,GAAG,YAAY,CAAC;IACtD;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './generic/IVectorDatabase';
|
|
2
|
-
export * from './generic/IVectorIndex';
|
|
3
|
-
export * from './generic/IEmbedding';
|
|
4
|
-
export * from './models/VectorBase';
|
|
5
|
-
export * from './generic/VectorCore.types';
|
|
1
|
+
export * from './generic/IVectorDatabase.js';
|
|
2
|
+
export * from './generic/IVectorIndex.js';
|
|
3
|
+
export * from './generic/IEmbedding.js';
|
|
4
|
+
export * from './models/VectorBase.js';
|
|
5
|
+
export * from './generic/VectorCore.types.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./generic/IVectorDatabase"), exports);
|
|
18
|
-
__exportStar(require("./generic/IVectorIndex"), exports);
|
|
19
|
-
__exportStar(require("./generic/IEmbedding"), exports);
|
|
20
|
-
__exportStar(require("./models/VectorBase"), exports);
|
|
21
|
-
__exportStar(require("./generic/VectorCore.types"), exports);
|
|
1
|
+
export * from './generic/IVectorDatabase.js';
|
|
2
|
+
export * from './generic/IVectorIndex.js';
|
|
3
|
+
export * from './generic/IEmbedding.js';
|
|
4
|
+
export * from './models/VectorBase.js';
|
|
5
|
+
export * from './generic/VectorCore.types.js';
|
|
22
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseEntity, Metadata, CompositeKey, RunView, UserInfo } from "@memberjunction/core";
|
|
2
2
|
import { VectorDatabaseEntity } from "@memberjunction/core-entities";
|
|
3
|
-
import { PageRecordsParams } from "../generic/VectorCore.types";
|
|
3
|
+
import { PageRecordsParams } from "../generic/VectorCore.types.js";
|
|
4
4
|
import { AIModelEntityExtended } from "@memberjunction/ai-core-plus";
|
|
5
5
|
export declare class VectorBase {
|
|
6
6
|
_runView: RunView;
|
|
@@ -17,6 +17,10 @@ export declare class VectorBase {
|
|
|
17
17
|
protected GetAIModel(id?: string): AIModelEntityExtended;
|
|
18
18
|
protected GetVectorDatabase(id?: string): VectorDatabaseEntity;
|
|
19
19
|
protected RunViewForSingleValue<T extends BaseEntity>(entityName: string, extraFilter: string): Promise<T | null>;
|
|
20
|
+
/**
|
|
21
|
+
* Saving an Entity in any vector related package needs the CurrentUser property to be set on the entity
|
|
22
|
+
* So this is a simple wrapper to set it before saving
|
|
23
|
+
**/
|
|
20
24
|
protected SaveEntity(entity: BaseEntity): Promise<boolean>;
|
|
21
25
|
}
|
|
22
26
|
//# sourceMappingURL=VectorBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorBase.d.ts","sourceRoot":"","sources":["../../src/models/VectorBase.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAuC,MAAM,sBAAsB,CAAC;AAClI,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,qBAAa,UAAU;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,QAAQ,CAAC;IACpB,YAAY,EAAE,QAAQ,CAAC;;IAQvB,IAAW,QAAQ,IAAI,QAAQ,CAA2B;IAC1D,IAAW,OAAO,IAAI,OAAO,CAA0B;IACvD,IAAW,WAAW,IAAI,QAAQ,CAA8B;IAChE,IAAW,WAAW,CAAC,IAAI,EAAE,QAAQ,EAA+B;cAEpD,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;cAqBzF,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAqBjF,SAAS,CAAC,gBAAgB,CAAC,YAAY,EAAE,YAAY,EAAE,GAAG,MAAM;IAQhE,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,qBAAqB;IAexD,SAAS,CAAC,iBAAiB,CAAC,E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AAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAgBvH;;;QAGI;cACY,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;CAInE"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const aiengine_1 = require("@memberjunction/aiengine");
|
|
5
|
-
const core_1 = require("@memberjunction/core");
|
|
6
|
-
class VectorBase {
|
|
1
|
+
import { AIEngine } from "@memberjunction/aiengine";
|
|
2
|
+
import { Metadata, RunView, LogError } from "@memberjunction/core";
|
|
3
|
+
export class VectorBase {
|
|
7
4
|
constructor() {
|
|
8
|
-
this._runView = new
|
|
9
|
-
this._metadata = new
|
|
5
|
+
this._runView = new RunView();
|
|
6
|
+
this._metadata = new Metadata();
|
|
10
7
|
this._currentUser = this._metadata.CurrentUser;
|
|
11
8
|
}
|
|
12
9
|
get Metadata() { return this._metadata; }
|
|
@@ -14,7 +11,7 @@ class VectorBase {
|
|
|
14
11
|
get CurrentUser() { return this._currentUser; }
|
|
15
12
|
set CurrentUser(user) { this._currentUser = user; }
|
|
16
13
|
async GetRecordsByEntityID(entityID, recordIDs) {
|
|
17
|
-
const md = new
|
|
14
|
+
const md = new Metadata();
|
|
18
15
|
const entity = md.Entities.find(e => e.ID === entityID);
|
|
19
16
|
if (!entity) {
|
|
20
17
|
throw new Error(`Entity with ID ${entityID} not found.`);
|
|
@@ -57,10 +54,10 @@ class VectorBase {
|
|
|
57
54
|
GetAIModel(id) {
|
|
58
55
|
let model;
|
|
59
56
|
if (id) {
|
|
60
|
-
model =
|
|
57
|
+
model = AIEngine.Instance.Models.find(m => m.AIModelType === "Embeddings" && m.ID === id);
|
|
61
58
|
}
|
|
62
59
|
else {
|
|
63
|
-
model =
|
|
60
|
+
model = AIEngine.Instance.Models.find(m => m.AIModelType === "Embeddings");
|
|
64
61
|
}
|
|
65
62
|
if (!model) {
|
|
66
63
|
throw new Error("No AI Model Entity found");
|
|
@@ -68,15 +65,15 @@ class VectorBase {
|
|
|
68
65
|
return model;
|
|
69
66
|
}
|
|
70
67
|
GetVectorDatabase(id) {
|
|
71
|
-
if (
|
|
68
|
+
if (AIEngine.Instance.VectorDatabases.length > 0) {
|
|
72
69
|
if (id) {
|
|
73
|
-
let vectorDB =
|
|
70
|
+
let vectorDB = AIEngine.Instance.VectorDatabases.find(vd => vd.ID === id);
|
|
74
71
|
if (vectorDB) {
|
|
75
72
|
return vectorDB;
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
else {
|
|
79
|
-
return
|
|
76
|
+
return AIEngine.Instance.VectorDatabases[0];
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
79
|
throw new Error("No Vector Database Entity found");
|
|
@@ -91,14 +88,17 @@ class VectorBase {
|
|
|
91
88
|
return rvResult.RowCount > 0 ? rvResult.Results[0] : null;
|
|
92
89
|
}
|
|
93
90
|
else {
|
|
94
|
-
|
|
91
|
+
LogError(rvResult.ErrorMessage);
|
|
95
92
|
return null;
|
|
96
93
|
}
|
|
97
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Saving an Entity in any vector related package needs the CurrentUser property to be set on the entity
|
|
97
|
+
* So this is a simple wrapper to set it before saving
|
|
98
|
+
**/
|
|
98
99
|
async SaveEntity(entity) {
|
|
99
100
|
entity.ContextCurrentUser = this.CurrentUser;
|
|
100
101
|
return await entity.Save();
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
|
-
exports.VectorBase = VectorBase;
|
|
104
104
|
//# sourceMappingURL=VectorBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorBase.js","sourceRoot":"","sources":["../../src/models/VectorBase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VectorBase.js","sourceRoot":"","sources":["../../src/models/VectorBase.ts"],"names":[],"mappings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AChD,CAAC;QACL,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACvD,CAAC;IAES,KAAK,CAAC,qBAAqB,CAAuB,UAAkB,EAAE,WAAmB;QAC/F,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;YACzC,UAAU,EAAE,UAAU;YACtB,WAAW,EAAE,WAAW;YACxB,UAAU,EAAE,eAAe;SAC9B,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAErB,IAAG,QAAQ,CAAC,OAAO,EAAC,CAAC;YACjB,OAAO,QAAQ,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAM,CAAA,CAAC,CAAC,IAAI,CAAC;QAClE,CAAC;aACG,CAAC;YACD,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YAChC,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;IAED;;;QAGI;IACM,KAAK,CAAC,UAAU,CAAC,MAAkB;QACzC,MAAM,CAAC,kBAAkB,GAAG,IAAI,CAAC,WAAW,CAAC;QAC7C,OAAO,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ai-vectors",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "4.1.0",
|
|
4
5
|
"description": "MemberJunction: AI Vectors Module",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
@@ -9,26 +10,26 @@
|
|
|
9
10
|
],
|
|
10
11
|
"scripts": {
|
|
11
12
|
"start": "ts-node-dev src/index.ts",
|
|
12
|
-
"build": "tsc",
|
|
13
|
+
"build": "tsc && tsc-alias -f",
|
|
13
14
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
14
15
|
},
|
|
15
16
|
"author": "MemberJunction.com",
|
|
16
17
|
"license": "ISC",
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@memberjunction/core": "
|
|
19
|
-
"@memberjunction/global": "
|
|
20
|
-
"@memberjunction/core-entities": "
|
|
21
|
-
"@memberjunction/aiengine": "
|
|
22
|
-
"@memberjunction/ai": "
|
|
23
|
-
"@memberjunction/ai-core-plus": "
|
|
24
|
-
"@memberjunction/ai-vectordb": "
|
|
25
|
-
"dotenv": "^
|
|
26
|
-
"openai": "^
|
|
19
|
+
"@memberjunction/core": "4.1.0",
|
|
20
|
+
"@memberjunction/global": "4.1.0",
|
|
21
|
+
"@memberjunction/core-entities": "4.1.0",
|
|
22
|
+
"@memberjunction/aiengine": "4.1.0",
|
|
23
|
+
"@memberjunction/ai": "4.1.0",
|
|
24
|
+
"@memberjunction/ai-core-plus": "4.1.0",
|
|
25
|
+
"@memberjunction/ai-vectordb": "4.1.0",
|
|
26
|
+
"dotenv": "^17.2.4",
|
|
27
|
+
"openai": "^6.18.0"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
|
-
"@types/node": "
|
|
30
|
+
"@types/node": "24.10.11",
|
|
30
31
|
"ts-node-dev": "^2.0.0",
|
|
31
|
-
"typescript": "^5.
|
|
32
|
+
"typescript": "^5.9.3"
|
|
32
33
|
},
|
|
33
34
|
"repository": {
|
|
34
35
|
"type": "git",
|