@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 CHANGED
@@ -1,356 +1,273 @@
1
1
  # @memberjunction/ai-vectors
2
2
 
3
- The MemberJunction AI Vectors Core package provides the foundational abstractions and base classes for working with vector embeddings, vector databases, and vector operations within the MemberJunction ecosystem.
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 core foundation for vector-related operations in MemberJunction, providing:
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
- ## Features
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
- - **Core Interfaces**: Fundamental interface definitions for vector operations
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
- ## Installation
66
+ ## Core Components
26
67
 
27
- ```bash
28
- npm install @memberjunction/ai-vectors
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
- ## Core Components
104
+ **Key capabilities:**
32
105
 
33
- ### Interfaces
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
- The package defines several key interfaces for vector operations:
116
+ ### Interfaces
36
117
 
37
118
  #### IEmbedding
38
119
 
39
- Interface for text embedding generation:
120
+ Contract for text embedding providers:
40
121
 
41
122
  ```typescript
42
123
  interface IEmbedding {
43
- createEmbedding(text: string, options?: any): any;
44
- createBatchEmbedding(text: string[], options?: any): any;
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
- Interface for vector database management:
131
+ Contract for vector database management operations:
51
132
 
52
133
  ```typescript
53
134
  interface IVectorDatabase {
54
- listIndexes(options?: any): any;
55
- createIndex(options: any): any;
56
- deleteIndex(indexID: any, options?: any): any;
57
- editIndex(indexID: any, options?: any): any;
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
- Interface for vector index operations:
144
+ Contract for CRUD operations on vector records within an index:
64
145
 
65
146
  ```typescript
66
147
  interface IVectorIndex {
67
- createRecord(record: any, options?: any): any;
68
- createRecords(records: any[], options?: any): any;
69
- getRecord(recordID: any, options?: any): any;
70
- getRecords(recordIDs: any[], options?: any): any;
71
- updateRecord(record: any, options?: any): any;
72
- updateRecords(records: any[], options?: any): any;
73
- deleteRecord(recordID: any, options?: any): any;
74
- deleteRecords(recordIDs: any[], options?: any): any;
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
- ### VectorBase Class
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
- ### Type Definitions
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
- EntityID: string | number; // The ID of the entity to get records from
107
- PageNumber: number; // Page number (1-based)
108
- PageSize: number; // Number of records per page
109
- ResultType: "entity_object" | "simple" | "count_only"; // Type of result
110
- Filter?: string; // Optional SQL filter
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 the Base Class
175
+ ### Extending VectorBase
117
176
 
118
- Create specialized vector operation classes by extending `VectorBase`:
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
- async processEntityRecords(entityId: string): Promise<void> {
126
- // Get all entity records
127
- const records = await this.GetRecordsByEntityID(entityId);
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
- Implement the interfaces to create specific provider implementations:
188
+ // Access configured AI models and vector databases
189
+ const model = this.GetAIModel();
190
+ const vectorDb = this.GetVectorDatabase();
155
191
 
156
- ```typescript
157
- import { IEmbedding } from '@memberjunction/ai-vectors';
158
-
159
- export class OpenAIEmbedding implements IEmbedding {
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
- ```typescript
177
- import { VectorBase, PageRecordsParams } from '@memberjunction/ai-vectors';
178
- import { BaseEntity } from '@memberjunction/core';
179
- import { AIModelEntityExtended, VectorDatabaseEntity } from '@memberjunction/core-entities';
180
-
181
- class EntityVectorizer extends VectorBase {
182
- async vectorizeEntities(entityId: string): Promise<void> {
183
- // Get AI model for embeddings (defaults to first embedding model if no ID provided)
184
- const embeddingModel: AIModelEntityExtended = this.GetAIModel();
185
- console.log(`Using embedding model: ${embeddingModel.Name}`);
186
-
187
- // Get vector database (defaults to first configured vector DB)
188
- const vectorDb: VectorDatabaseEntity = this.GetVectorDatabase();
189
- console.log(`Using vector database: ${vectorDb.Name}`);
190
-
191
- // Process records in pages for memory efficiency
192
- let pageNumber = 1;
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
- ### Advanced Entity Filtering
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 AdvancedVectorProcessor extends VectorBase {
232
- async getSpecificRecords(entityId: string): Promise<void> {
233
- // Build composite keys for specific records
234
- const compositeKeys: CompositeKey[] = [
235
- {
236
- KeyValuePairs: [
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
- ```typescript
261
- import { VectorBase } from '@memberjunction/ai-vectors';
262
- import { AIEngine } from '@memberjunction/aiengine';
263
- import { Metadata, RunView } from '@memberjunction/core';
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 core package serves as the foundation for a suite of vector-related packages:
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
- The package automatically integrates with MemberJunction's configuration system:
286
-
287
- 1. **AI Models**: Embedding models are configured in the MemberJunction metadata and accessed via `AIEngine.Instance`
288
- 2. **Vector Databases**: Vector databases are configured similarly and accessed through the AI engine
289
- 3. **User Context**: The current user context is automatically managed and passed to entity operations
290
-
291
- ## Best Practices
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
- - `@memberjunction/core`: ^2.43.0 - Core MemberJunction functionality
322
- - `@memberjunction/global`: ^2.43.0 - Global utilities
323
- - `@memberjunction/core-entities`: ^2.43.0 - Entity definitions
324
- - `@memberjunction/aiengine`: ^2.43.0 - AI engine integration
325
- - `@memberjunction/ai`: ^2.43.0 - AI abstractions
326
- - `@memberjunction/ai-vectordb`: ^2.43.0 - Vector database interfaces
327
- - `openai`: ^4.28.4 - OpenAI SDK (for embedding implementations)
328
- - `dotenv`: ^16.4.1 - Environment configuration
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
- ```bash
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,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=IEmbedding.js.map
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=IVectorDatabase.js.map
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=IVectorIndex.js.map
@@ -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;IAI5B,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAI1B,UAAU,EAAE,MAAM,CAAC;IAInB,QAAQ,EAAE,MAAM,CAAC;IAIjB,UAAU,EAAE,eAAe,GAAG,QAAQ,GAAG,YAAY,CAAC;IAItD,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
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"}
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=VectorCore.types.js.map
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
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
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":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,yDAAuC;AACvC,uDAAqC;AACrC,sDAAoC;AACpC,6DAA2C"}
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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G,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,EAAE,CAAC,EAAE,MAAM,GAAG,oBAAoB;cAgB9C,qBAAqB,CAAC,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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VectorBase = void 0;
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 core_1.RunView();
9
- this._metadata = new core_1.Metadata();
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 core_1.Metadata();
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 = aiengine_1.AIEngine.Instance.Models.find(m => m.AIModelType === "Embeddings" && m.ID === id);
57
+ model = AIEngine.Instance.Models.find(m => m.AIModelType === "Embeddings" && m.ID === id);
61
58
  }
62
59
  else {
63
- model = aiengine_1.AIEngine.Instance.Models.find(m => m.AIModelType === "Embeddings");
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 (aiengine_1.AIEngine.Instance.VectorDatabases.length > 0) {
68
+ if (AIEngine.Instance.VectorDatabases.length > 0) {
72
69
  if (id) {
73
- let vectorDB = aiengine_1.AIEngine.Instance.VectorDatabases.find(vd => vd.ID === id);
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 aiengine_1.AIEngine.Instance.VectorDatabases[0];
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
- (0, core_1.LogError)(rvResult.ErrorMessage);
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":"VectorB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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
- "version": "3.4.0",
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": "3.4.0",
19
- "@memberjunction/global": "3.4.0",
20
- "@memberjunction/core-entities": "3.4.0",
21
- "@memberjunction/aiengine": "3.4.0",
22
- "@memberjunction/ai": "3.4.0",
23
- "@memberjunction/ai-core-plus": "3.4.0",
24
- "@memberjunction/ai-vectordb": "3.4.0",
25
- "dotenv": "^16.4.1",
26
- "openai": "^4.28.4"
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": "20.14.2",
30
+ "@types/node": "24.10.11",
30
31
  "ts-node-dev": "^2.0.0",
31
- "typescript": "^5.4.5"
32
+ "typescript": "^5.9.3"
32
33
  },
33
34
  "repository": {
34
35
  "type": "git",