@memberjunction/aiengine 5.40.1 → 5.40.2
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/package.json +10 -10
- package/dist/services/QueryEmbeddingService.d.ts +0 -62
- package/dist/services/QueryEmbeddingService.d.ts.map +0 -1
- package/dist/services/QueryEmbeddingService.js +0 -124
- package/dist/services/QueryEmbeddingService.js.map +0 -1
- package/dist/types/QueryMatchResult.d.ts +0 -55
- package/dist/types/QueryMatchResult.d.ts.map +0 -1
- package/dist/types/QueryMatchResult.js +0 -2
- package/dist/types/QueryMatchResult.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/aiengine",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.40.
|
|
4
|
+
"version": "5.40.2",
|
|
5
5
|
"description": "MemberJunction: AI Engine Package - handles automatic execution of Entity AI Actions using AI Models",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
"author": "MemberJunction.com",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@memberjunction/core": "5.40.
|
|
21
|
-
"@memberjunction/global": "5.40.
|
|
22
|
-
"@memberjunction/core-entities": "5.40.
|
|
23
|
-
"@memberjunction/actions-base": "5.40.
|
|
24
|
-
"@memberjunction/ai": "5.40.
|
|
25
|
-
"@memberjunction/ai-core-plus": "5.40.
|
|
26
|
-
"@memberjunction/ai-engine-base": "5.40.
|
|
27
|
-
"@memberjunction/ai-vectors-memory": "5.40.
|
|
28
|
-
"@memberjunction/storage": "5.40.
|
|
20
|
+
"@memberjunction/core": "5.40.2",
|
|
21
|
+
"@memberjunction/global": "5.40.2",
|
|
22
|
+
"@memberjunction/core-entities": "5.40.2",
|
|
23
|
+
"@memberjunction/actions-base": "5.40.2",
|
|
24
|
+
"@memberjunction/ai": "5.40.2",
|
|
25
|
+
"@memberjunction/ai-core-plus": "5.40.2",
|
|
26
|
+
"@memberjunction/ai-engine-base": "5.40.2",
|
|
27
|
+
"@memberjunction/ai-vectors-memory": "5.40.2",
|
|
28
|
+
"@memberjunction/storage": "5.40.2",
|
|
29
29
|
"dotenv": "^17.2.4",
|
|
30
30
|
"rxjs": "^7.8.2"
|
|
31
31
|
},
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { SimpleVectorService } from '@memberjunction/ai-vectors-memory';
|
|
2
|
-
import { MJAIModelEntityExtended } from '@memberjunction/ai-core-plus';
|
|
3
|
-
import { QueryMatchResult, QueryEmbeddingMetadata } from '../types/QueryMatchResult.js';
|
|
4
|
-
import { EmbedTextResult } from '@memberjunction/ai';
|
|
5
|
-
import { UserInfo } from '@memberjunction/core';
|
|
6
|
-
/**
|
|
7
|
-
* Utility service for query catalog semantic search.
|
|
8
|
-
*
|
|
9
|
-
* Unlike AgentEmbeddingService (which generates embeddings at AIEngine startup),
|
|
10
|
-
* this service loads pre-computed embeddings from the database. Embeddings are
|
|
11
|
-
* generated by MJQueryEntityServer.Save() using composite text (Name + UserQuestion + Description)
|
|
12
|
-
* and stored in the Query entity's EmbeddingVector column.
|
|
13
|
-
*
|
|
14
|
-
* This follows the same pattern as RefreshNoteEmbeddings in AIEngine — parsing
|
|
15
|
-
* stored JSON vectors from DB records rather than calling the embedding API.
|
|
16
|
-
*
|
|
17
|
-
* All methods are static — no instance state required.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* const vectorService = await QueryEmbeddingService.LoadQueryEmbeddings(contextUser);
|
|
22
|
-
* const matches = await QueryEmbeddingService.FindSimilarQueries(
|
|
23
|
-
* vectorService,
|
|
24
|
-
* "monthly revenue by region",
|
|
25
|
-
* (text) => AIEngine.Instance.EmbedTextLocal(text),
|
|
26
|
-
* 10,
|
|
27
|
-
* 0.3
|
|
28
|
-
* );
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export declare class QueryEmbeddingService {
|
|
32
|
-
/**
|
|
33
|
-
* Load pre-computed query embeddings from the database into a SimpleVectorService.
|
|
34
|
-
* Only loads queries that have a non-null EmbeddingVector.
|
|
35
|
-
*
|
|
36
|
-
* Follows the same pattern as AIEngine.RefreshNoteEmbeddings() — parsing
|
|
37
|
-
* stored JSON vectors rather than generating embeddings at load time.
|
|
38
|
-
*
|
|
39
|
-
* @param contextUser - User context for RunView permissions
|
|
40
|
-
* @param filter - Optional additional SQL filter (e.g., "Reusable = 1 AND Status = 'Approved'")
|
|
41
|
-
* @returns SimpleVectorService loaded with query embeddings, ready for FindSimilarQueries()
|
|
42
|
-
*/
|
|
43
|
-
static LoadQueryEmbeddings(contextUser: UserInfo, filter?: string): Promise<SimpleVectorService<QueryEmbeddingMetadata>>;
|
|
44
|
-
/**
|
|
45
|
-
* Find queries semantically similar to a natural language search text.
|
|
46
|
-
*
|
|
47
|
-
* Follows the same pattern as AgentEmbeddingService.FindSimilarAgents() —
|
|
48
|
-
* embeds the search text, then uses FindNearest for cosine similarity.
|
|
49
|
-
*
|
|
50
|
-
* @param vectorService - Vector service from LoadQueryEmbeddings()
|
|
51
|
-
* @param searchText - Natural language description of what data is needed
|
|
52
|
-
* @param embedFunction - Function to generate embeddings (typically from AIEngine.EmbedTextLocal)
|
|
53
|
-
* @param topK - Maximum number of results to return (default: 10)
|
|
54
|
-
* @param minSimilarity - Minimum similarity score 0-1 (default: 0.3)
|
|
55
|
-
* @returns Array of matching queries sorted by similarity score (highest first)
|
|
56
|
-
*/
|
|
57
|
-
static FindSimilarQueries(vectorService: SimpleVectorService<QueryEmbeddingMetadata>, searchText: string, embedFunction: (text: string) => Promise<{
|
|
58
|
-
result: EmbedTextResult;
|
|
59
|
-
model: MJAIModelEntityExtended;
|
|
60
|
-
} | null>, topK?: number, minSimilarity?: number): Promise<QueryMatchResult[]>;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=QueryEmbeddingService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueryEmbeddingService.d.ts","sourceRoot":"","sources":["../../src/services/QueryEmbeddingService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAe,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAqB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,qBAAqB;IAC9B;;;;;;;;;;OAUG;WACiB,mBAAmB,CACnC,WAAW,EAAE,QAAQ,EACrB,MAAM,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;IA0DvD;;;;;;;;;;;;OAYG;WACiB,kBAAkB,CAClC,aAAa,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,EAC1D,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;QAAC,MAAM,EAAE,eAAe,CAAC;QAAC,KAAK,EAAE,uBAAuB,CAAA;KAAC,GAAG,IAAI,CAAC,EAC1G,IAAI,GAAE,MAAW,EACjB,aAAa,GAAE,MAAY,GAC5B,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAmCjC"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { SimpleVectorService } from '@memberjunction/ai-vectors-memory';
|
|
2
|
-
import { LogError, RunView } from '@memberjunction/core';
|
|
3
|
-
/**
|
|
4
|
-
* Utility service for query catalog semantic search.
|
|
5
|
-
*
|
|
6
|
-
* Unlike AgentEmbeddingService (which generates embeddings at AIEngine startup),
|
|
7
|
-
* this service loads pre-computed embeddings from the database. Embeddings are
|
|
8
|
-
* generated by MJQueryEntityServer.Save() using composite text (Name + UserQuestion + Description)
|
|
9
|
-
* and stored in the Query entity's EmbeddingVector column.
|
|
10
|
-
*
|
|
11
|
-
* This follows the same pattern as RefreshNoteEmbeddings in AIEngine — parsing
|
|
12
|
-
* stored JSON vectors from DB records rather than calling the embedding API.
|
|
13
|
-
*
|
|
14
|
-
* All methods are static — no instance state required.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const vectorService = await QueryEmbeddingService.LoadQueryEmbeddings(contextUser);
|
|
19
|
-
* const matches = await QueryEmbeddingService.FindSimilarQueries(
|
|
20
|
-
* vectorService,
|
|
21
|
-
* "monthly revenue by region",
|
|
22
|
-
* (text) => AIEngine.Instance.EmbedTextLocal(text),
|
|
23
|
-
* 10,
|
|
24
|
-
* 0.3
|
|
25
|
-
* );
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export class QueryEmbeddingService {
|
|
29
|
-
/**
|
|
30
|
-
* Load pre-computed query embeddings from the database into a SimpleVectorService.
|
|
31
|
-
* Only loads queries that have a non-null EmbeddingVector.
|
|
32
|
-
*
|
|
33
|
-
* Follows the same pattern as AIEngine.RefreshNoteEmbeddings() — parsing
|
|
34
|
-
* stored JSON vectors rather than generating embeddings at load time.
|
|
35
|
-
*
|
|
36
|
-
* @param contextUser - User context for RunView permissions
|
|
37
|
-
* @param filter - Optional additional SQL filter (e.g., "Reusable = 1 AND Status = 'Approved'")
|
|
38
|
-
* @returns SimpleVectorService loaded with query embeddings, ready for FindSimilarQueries()
|
|
39
|
-
*/
|
|
40
|
-
static async LoadQueryEmbeddings(contextUser, filter) {
|
|
41
|
-
const rv = new RunView();
|
|
42
|
-
const baseFilter = "EmbeddingVector IS NOT NULL";
|
|
43
|
-
const extraFilter = filter ? `${baseFilter} AND ${filter}` : baseFilter;
|
|
44
|
-
const result = await rv.RunView({
|
|
45
|
-
EntityName: 'MJ: Queries',
|
|
46
|
-
ExtraFilter: extraFilter,
|
|
47
|
-
Fields: ['ID', 'Name', 'Description', 'Category', 'Status', 'Reusable', 'SQL', 'UserQuestion', 'EmbeddingVector'],
|
|
48
|
-
ResultType: 'simple'
|
|
49
|
-
}, contextUser);
|
|
50
|
-
if (!result.Success) {
|
|
51
|
-
LogError(`QueryEmbeddingService: Failed to load query embeddings: ${result.ErrorMessage}`);
|
|
52
|
-
return new SimpleVectorService();
|
|
53
|
-
}
|
|
54
|
-
const entries = [];
|
|
55
|
-
for (const query of result.Results) {
|
|
56
|
-
try {
|
|
57
|
-
const vector = JSON.parse(query.EmbeddingVector);
|
|
58
|
-
if (!Array.isArray(vector) || vector.length === 0)
|
|
59
|
-
continue;
|
|
60
|
-
entries.push({
|
|
61
|
-
key: query.ID,
|
|
62
|
-
vector,
|
|
63
|
-
metadata: {
|
|
64
|
-
id: query.ID,
|
|
65
|
-
name: query.Name,
|
|
66
|
-
description: query.Description || '',
|
|
67
|
-
category: query.Category || '',
|
|
68
|
-
status: query.Status || '',
|
|
69
|
-
reusable: query.Reusable ?? false,
|
|
70
|
-
sql: query.SQL || '',
|
|
71
|
-
userQuestion: query.UserQuestion || ''
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
LogError(`QueryEmbeddingService: Failed to parse embedding for query ${query.Name}: ${error instanceof Error ? error.message : String(error)}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const vectorService = new SimpleVectorService();
|
|
80
|
-
vectorService.LoadVectors(entries);
|
|
81
|
-
return vectorService;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Find queries semantically similar to a natural language search text.
|
|
85
|
-
*
|
|
86
|
-
* Follows the same pattern as AgentEmbeddingService.FindSimilarAgents() —
|
|
87
|
-
* embeds the search text, then uses FindNearest for cosine similarity.
|
|
88
|
-
*
|
|
89
|
-
* @param vectorService - Vector service from LoadQueryEmbeddings()
|
|
90
|
-
* @param searchText - Natural language description of what data is needed
|
|
91
|
-
* @param embedFunction - Function to generate embeddings (typically from AIEngine.EmbedTextLocal)
|
|
92
|
-
* @param topK - Maximum number of results to return (default: 10)
|
|
93
|
-
* @param minSimilarity - Minimum similarity score 0-1 (default: 0.3)
|
|
94
|
-
* @returns Array of matching queries sorted by similarity score (highest first)
|
|
95
|
-
*/
|
|
96
|
-
static async FindSimilarQueries(vectorService, searchText, embedFunction, topK = 10, minSimilarity = 0.3) {
|
|
97
|
-
if (!searchText || searchText.trim().length === 0) {
|
|
98
|
-
throw new Error('searchText cannot be empty');
|
|
99
|
-
}
|
|
100
|
-
try {
|
|
101
|
-
const queryEmbedding = await embedFunction(searchText);
|
|
102
|
-
if (!queryEmbedding || !queryEmbedding.result || queryEmbedding.result.vector.length === 0) {
|
|
103
|
-
throw new Error('Failed to generate embedding for search text');
|
|
104
|
-
}
|
|
105
|
-
const results = vectorService.FindNearest(queryEmbedding.result.vector, topK, minSimilarity, 'cosine');
|
|
106
|
-
return results.map(r => ({
|
|
107
|
-
queryId: r.key,
|
|
108
|
-
queryName: r.metadata?.name || 'Unknown',
|
|
109
|
-
description: r.metadata?.description || '',
|
|
110
|
-
category: r.metadata?.category || '',
|
|
111
|
-
similarityScore: r.score,
|
|
112
|
-
status: r.metadata?.status || '',
|
|
113
|
-
reusable: r.metadata?.reusable ?? false,
|
|
114
|
-
sql: r.metadata?.sql,
|
|
115
|
-
userQuestion: r.metadata?.userQuestion
|
|
116
|
-
}));
|
|
117
|
-
}
|
|
118
|
-
catch (error) {
|
|
119
|
-
LogError(`QueryEmbeddingService: Error finding similar queries: ${error instanceof Error ? error.message : String(error)}`);
|
|
120
|
-
throw error;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
//# sourceMappingURL=QueryEmbeddingService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueryEmbeddingService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
|
-
/**
|
|
2
|
-
* Metadata about a query for embedding purposes
|
|
3
|
-
*/
|
|
4
|
-
export interface QueryEmbeddingMetadata {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
description: string;
|
|
8
|
-
category: string;
|
|
9
|
-
status: string;
|
|
10
|
-
reusable: boolean;
|
|
11
|
-
sql: string;
|
|
12
|
-
userQuestion: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Result from query similarity matching
|
|
16
|
-
*/
|
|
17
|
-
export interface QueryMatchResult {
|
|
18
|
-
/**
|
|
19
|
-
* The query's unique ID
|
|
20
|
-
*/
|
|
21
|
-
queryId: string;
|
|
22
|
-
/**
|
|
23
|
-
* The query's name
|
|
24
|
-
*/
|
|
25
|
-
queryName: string;
|
|
26
|
-
/**
|
|
27
|
-
* The query's description
|
|
28
|
-
*/
|
|
29
|
-
description: string;
|
|
30
|
-
/**
|
|
31
|
-
* The query's category name
|
|
32
|
-
*/
|
|
33
|
-
category: string;
|
|
34
|
-
/**
|
|
35
|
-
* Cosine similarity score (0-1, where 1 = perfect match)
|
|
36
|
-
*/
|
|
37
|
-
similarityScore: number;
|
|
38
|
-
/**
|
|
39
|
-
* Query status (Approved, Pending, etc.)
|
|
40
|
-
*/
|
|
41
|
-
status: string;
|
|
42
|
-
/**
|
|
43
|
-
* Whether the query is marked as reusable for composition
|
|
44
|
-
*/
|
|
45
|
-
reusable: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* The query's SQL (only populated when requested)
|
|
48
|
-
*/
|
|
49
|
-
sql?: string;
|
|
50
|
-
/**
|
|
51
|
-
* The natural language question this query answers
|
|
52
|
-
*/
|
|
53
|
-
userQuestion?: string;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=QueryMatchResult.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueryMatchResult.d.ts","sourceRoot":"","sources":["../../src/types/QueryMatchResult.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueryMatchResult.js","sourceRoot":"","sources":["../../src/types/QueryMatchResult.ts"],"names":[],"mappings":""}
|