@minded-ai/mindedjs 3.1.31 → 3.1.32
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/dist/agent.d.ts +3 -0
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +20 -0
- package/dist/agent.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/platform/mindedConnectionTypes.d.ts +152 -0
- package/dist/platform/mindedConnectionTypes.d.ts.map +1 -1
- package/dist/platform/mindedConnectionTypes.js +4 -0
- package/dist/platform/mindedConnectionTypes.js.map +1 -1
- package/dist/toolsLibrary/knowledgeBase.d.ts +123 -0
- package/dist/toolsLibrary/knowledgeBase.d.ts.map +1 -0
- package/dist/toolsLibrary/knowledgeBase.js +180 -0
- package/dist/toolsLibrary/knowledgeBase.js.map +1 -0
- package/dist/utils/rag.d.ts +16 -0
- package/dist/utils/rag.d.ts.map +1 -0
- package/dist/utils/rag.js +206 -0
- package/dist/utils/rag.js.map +1 -0
- package/docs/SUMMARY.md +8 -2
- package/docs/api/analytics.md +132 -0
- package/docs/api/knowledge.md +460 -0
- package/docs/api/overview.md +78 -0
- package/docs/platform/knowledge-bases.md +191 -0
- package/docs/platform/security-architecture.md +0 -1
- package/docs/sdk/agent-api.md +12 -0
- package/docs/sdk/events.md +77 -24
- package/docs/sdk/knowledge-base-rag.md +211 -0
- package/docs/sdk/vectorstore-query.md +2 -0
- package/package.json +1 -1
- package/src/agent.ts +33 -2
- package/src/index.ts +21 -1
- package/src/platform/mindedConnectionTypes.ts +162 -0
- package/src/toolsLibrary/knowledgeBase.ts +217 -0
- package/src/utils/rag.ts +252 -0
- package/docs/platform/api.md +0 -258
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mindedConnectionTypes.js","sourceRoot":"","sources":["../../src/platform/mindedConnectionTypes.ts"],"names":[],"mappings":";;;AAaA,IAAY,
|
|
1
|
+
{"version":3,"file":"mindedConnectionTypes.js","sourceRoot":"","sources":["../../src/platform/mindedConnectionTypes.ts"],"names":[],"mappings":";;;AAaA,IAAY,iCA6EX;AA7ED,WAAY,iCAAiC;IAC3C,kEAA6B,CAAA;IAC7B,gEAA2B,CAAA;IAC3B,gFAA2C,CAAA;IAC3C,gFAA2C,CAAA;IAC3C,oFAA+C,CAAA;IAC/C,wFAAmD,CAAA;IACnD,4DAAuB,CAAA;IACvB,oEAA+B,CAAA;IAC/B,sDAAiB,CAAA;IACjB,0EAAqC,CAAA;IACrC,cAAc;IACd,kFAA6C,CAAA;IAC7C,sEAAiC,CAAA;IACjC,wEAAmC,CAAA;IACnC,oFAA+C,CAAA;IAC/C,8EAAyC,CAAA;IACzC,QAAQ;IACR,0EAAqC,CAAA;IACrC,4EAAuC,CAAA;IACvC,gFAA2C,CAAA;IAC3C,4EAAuC,CAAA;IACvC,8EAAyC,CAAA;IACzC,8FAAyD,CAAA;IACzD,sEAAiC,CAAA;IACjC,eAAe;IACf,kEAA6B,CAAA;IAC7B,wFAAmD,CAAA;IACnD,gEAA2B,CAAA;IAC3B,kEAA6B,CAAA;IAC7B,oEAA+B,CAAA;IAC/B,gEAA2B,CAAA;IAC3B,wEAAmC,CAAA;IACnC,kFAA6C,CAAA;IAC7C,sFAAiD,CAAA;IACjD,gFAA2C,CAAA;IAC3C,wFAAmD,CAAA;IACnD,kFAA6C,CAAA;IAC7C,+BAA+B;IAC/B,sGAAiE,CAAA;IACjE,sFAAiD,CAAA;IACjD,4FAAuD,CAAA;IACvD,4FAAuD,CAAA;IACvD,oGAA+D,CAAA;IAC/D,4FAAuD,CAAA;IACvD,sGAAiE,CAAA;IACjE,sGAAiE,CAAA;IACjE,iBAAiB;IACjB,kEAA6B,CAAA;IAC7B,8FAA8F;IAC9F,4EAAuC,CAAA;IACvC,qBAAqB;IACrB,wFAAmD,CAAA;IACnD,kHAA6E,CAAA;IAC7E,YAAY;IACZ,wEAAmC,CAAA;IACnC,uBAAuB;IACvB,gEAA2B,CAAA;IAC3B,wBAAwB;IACxB,gGAA2D,CAAA;IAC3D,kBAAkB;IAClB,oFAA+C,CAAA;IAC/C,WAAW;IACX,wEAAmC,CAAA;IACnC,cAAc;IACd,gFAA2C,CAAA;IAC3C,sBAAsB;IACtB,0EAAqC,CAAA;IACrC,mBAAmB;IACnB,0EAAqC,CAAA;IACrC,8EAAyC,CAAA;IACzC,iBAAiB;IACjB,8EAAyC,CAAA;IACzC,4FAAuD,CAAA;IACvD,8EAAyC,CAAA;IACzC,yBAAyB;IACzB,4EAAuC,CAAA;AACzC,CAAC,EA7EW,iCAAiC,iDAAjC,iCAAiC,QA6E5C;AA8nBD,oBAAoB;AACpB,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,6DAA2C,CAAA;IAC3C,wCAAwC;AAC1C,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { KnowledgeBaseFilter, KnowledgeBaseRetrievalResult, KnowledgeBaseCitation } from '../platform/mindedConnectionTypes';
|
|
2
|
+
/**
|
|
3
|
+
* Retrieve relevant documents from a knowledge base without generation.
|
|
4
|
+
*
|
|
5
|
+
* This function queries a knowledge base and returns matching document chunks based on
|
|
6
|
+
* the given query, with support for filtering and controlling the number of results.
|
|
7
|
+
*
|
|
8
|
+
* @param params - The retrieval parameters
|
|
9
|
+
* @param params.knowledgeBaseId - Optional ID of the knowledge base to query. If omitted, the backend
|
|
10
|
+
* will auto-select the knowledge base if exactly one exists for the agent. If 0 or >1 knowledge bases
|
|
11
|
+
* exist, an error will be thrown requiring you to pass knowledgeBaseId explicitly.
|
|
12
|
+
* @param params.environment - The environment (e.g., 'development', 'production')
|
|
13
|
+
* @param params.query - The search query string
|
|
14
|
+
* @param params.numberOfResults - Optional number of results to return (default: 5)
|
|
15
|
+
* @param params.filters - Optional filters for metadata-based filtering
|
|
16
|
+
* @param timeoutMs - Optional timeout in milliseconds (default: 30000)
|
|
17
|
+
*
|
|
18
|
+
* @returns Promise that resolves with retrieval results including content, metadata, and scores
|
|
19
|
+
*
|
|
20
|
+
* @throws {Error} When the retrieval fails or when knowledgeBaseId is omitted and 0 or >1 KBs exist
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { retrieveFromKnowledgeBase } from '@minded-ai/mindedjs';
|
|
25
|
+
*
|
|
26
|
+
* // With explicit knowledgeBaseId
|
|
27
|
+
* const results = await retrieveFromKnowledgeBase({
|
|
28
|
+
* knowledgeBaseId: 'kb-123',
|
|
29
|
+
* environment: 'production',
|
|
30
|
+
* query: 'How do I reset my password?',
|
|
31
|
+
* numberOfResults: 10,
|
|
32
|
+
* filters: {
|
|
33
|
+
* equals: { key: 'category', value: 'support' }
|
|
34
|
+
* }
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* // Without knowledgeBaseId (auto-selects if agent has exactly 1 KB)
|
|
38
|
+
* const results2 = await retrieveFromKnowledgeBase({
|
|
39
|
+
* environment: 'production',
|
|
40
|
+
* query: 'What are the shipping options?',
|
|
41
|
+
* numberOfResults: 5
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* for (const result of results.retrievalResults) {
|
|
45
|
+
* console.log(result.content.text, result.score);
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function retrieveFromKnowledgeBase(params: {
|
|
50
|
+
knowledgeBaseId?: string;
|
|
51
|
+
environment: string;
|
|
52
|
+
query: string;
|
|
53
|
+
numberOfResults?: number;
|
|
54
|
+
filters?: KnowledgeBaseFilter;
|
|
55
|
+
}, timeoutMs?: number): Promise<{
|
|
56
|
+
retrievalResults: KnowledgeBaseRetrievalResult[];
|
|
57
|
+
nextToken?: string;
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Retrieve documents and generate a response using a knowledge base with citations.
|
|
61
|
+
*
|
|
62
|
+
* This function queries a knowledge base, retrieves relevant documents, and generates
|
|
63
|
+
* a response using an LLM, including citations that reference the source documents.
|
|
64
|
+
*
|
|
65
|
+
* @param params - The retrieval and generation parameters
|
|
66
|
+
* @param params.knowledgeBaseId - Optional ID of the knowledge base to query. If omitted, the backend
|
|
67
|
+
* will auto-select the knowledge base if exactly one exists for the agent. If 0 or >1 knowledge bases
|
|
68
|
+
* exist, an error will be thrown requiring you to pass knowledgeBaseId explicitly.
|
|
69
|
+
* @param params.environment - The environment (e.g., 'development', 'production')
|
|
70
|
+
* @param params.query - The search query string
|
|
71
|
+
* @param params.modelArn - Optional model ARN to use for generation (defaults to configured model)
|
|
72
|
+
* @param params.numberOfResults - Optional number of results to retrieve (default: 5)
|
|
73
|
+
* @param params.filters - Optional filters for metadata-based filtering
|
|
74
|
+
* @param timeoutMs - Optional timeout in milliseconds (default: 60000 for generation)
|
|
75
|
+
*
|
|
76
|
+
* @returns Promise that resolves with the generated output, citations, and optional session ID
|
|
77
|
+
*
|
|
78
|
+
* @throws {Error} When the retrieval or generation fails or when knowledgeBaseId is omitted and 0 or >1 KBs exist
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* import { retrieveAndGenerateFromKnowledgeBase } from '@minded-ai/mindedjs';
|
|
83
|
+
*
|
|
84
|
+
* // With explicit knowledgeBaseId
|
|
85
|
+
* const result = await retrieveAndGenerateFromKnowledgeBase({
|
|
86
|
+
* knowledgeBaseId: 'kb-123',
|
|
87
|
+
* environment: 'production',
|
|
88
|
+
* query: 'Summarize the refund policy',
|
|
89
|
+
* numberOfResults: 5
|
|
90
|
+
* });
|
|
91
|
+
*
|
|
92
|
+
* // Without knowledgeBaseId (auto-selects if agent has exactly 1 KB)
|
|
93
|
+
* const result2 = await retrieveAndGenerateFromKnowledgeBase({
|
|
94
|
+
* environment: 'production',
|
|
95
|
+
* query: 'What are the warranty terms?',
|
|
96
|
+
* numberOfResults: 5
|
|
97
|
+
* });
|
|
98
|
+
*
|
|
99
|
+
* console.log('Response:', result.output);
|
|
100
|
+
* console.log('Citations:', result.citations.length);
|
|
101
|
+
*
|
|
102
|
+
* // Access citation details
|
|
103
|
+
* for (const citation of result.citations) {
|
|
104
|
+
* console.log('Cited text:', citation.generatedResponsePart.textResponsePart.text);
|
|
105
|
+
* for (const ref of citation.retrievedReferences) {
|
|
106
|
+
* console.log('Source:', ref.location.s3Location.uri);
|
|
107
|
+
* }
|
|
108
|
+
* }
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare function retrieveAndGenerateFromKnowledgeBase(params: {
|
|
112
|
+
knowledgeBaseId?: string;
|
|
113
|
+
environment: string;
|
|
114
|
+
query: string;
|
|
115
|
+
modelArn?: string;
|
|
116
|
+
numberOfResults?: number;
|
|
117
|
+
filters?: KnowledgeBaseFilter;
|
|
118
|
+
}, timeoutMs?: number): Promise<{
|
|
119
|
+
output: string | null;
|
|
120
|
+
citations: KnowledgeBaseCitation[];
|
|
121
|
+
sessionId?: string;
|
|
122
|
+
}>;
|
|
123
|
+
//# sourceMappingURL=knowledgeBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledgeBase.d.ts","sourceRoot":"","sources":["../../src/toolsLibrary/knowledgeBase.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,mBAAmB,EACnB,4BAA4B,EAC5B,qBAAqB,EAKtB,MAAM,mCAAmC,CAAC;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE;IACN,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B,EACD,SAAS,GAAE,MAAc,GACxB,OAAO,CAAC;IAAE,gBAAgB,EAAE,4BAA4B,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAwCnF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAsB,oCAAoC,CACxD,MAAM,EAAE;IACN,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B,EACD,SAAS,GAAE,MAAc,GACxB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,SAAS,EAAE,qBAAqB,EAAE,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA2C5F"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.retrieveFromKnowledgeBase = retrieveFromKnowledgeBase;
|
|
4
|
+
exports.retrieveAndGenerateFromKnowledgeBase = retrieveAndGenerateFromKnowledgeBase;
|
|
5
|
+
const mindedConnection_1 = require("../platform/mindedConnection");
|
|
6
|
+
const mindedConnectionTypes_1 = require("../platform/mindedConnectionTypes");
|
|
7
|
+
const logger_1 = require("../utils/logger");
|
|
8
|
+
/**
|
|
9
|
+
* Retrieve relevant documents from a knowledge base without generation.
|
|
10
|
+
*
|
|
11
|
+
* This function queries a knowledge base and returns matching document chunks based on
|
|
12
|
+
* the given query, with support for filtering and controlling the number of results.
|
|
13
|
+
*
|
|
14
|
+
* @param params - The retrieval parameters
|
|
15
|
+
* @param params.knowledgeBaseId - Optional ID of the knowledge base to query. If omitted, the backend
|
|
16
|
+
* will auto-select the knowledge base if exactly one exists for the agent. If 0 or >1 knowledge bases
|
|
17
|
+
* exist, an error will be thrown requiring you to pass knowledgeBaseId explicitly.
|
|
18
|
+
* @param params.environment - The environment (e.g., 'development', 'production')
|
|
19
|
+
* @param params.query - The search query string
|
|
20
|
+
* @param params.numberOfResults - Optional number of results to return (default: 5)
|
|
21
|
+
* @param params.filters - Optional filters for metadata-based filtering
|
|
22
|
+
* @param timeoutMs - Optional timeout in milliseconds (default: 30000)
|
|
23
|
+
*
|
|
24
|
+
* @returns Promise that resolves with retrieval results including content, metadata, and scores
|
|
25
|
+
*
|
|
26
|
+
* @throws {Error} When the retrieval fails or when knowledgeBaseId is omitted and 0 or >1 KBs exist
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* import { retrieveFromKnowledgeBase } from '@minded-ai/mindedjs';
|
|
31
|
+
*
|
|
32
|
+
* // With explicit knowledgeBaseId
|
|
33
|
+
* const results = await retrieveFromKnowledgeBase({
|
|
34
|
+
* knowledgeBaseId: 'kb-123',
|
|
35
|
+
* environment: 'production',
|
|
36
|
+
* query: 'How do I reset my password?',
|
|
37
|
+
* numberOfResults: 10,
|
|
38
|
+
* filters: {
|
|
39
|
+
* equals: { key: 'category', value: 'support' }
|
|
40
|
+
* }
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // Without knowledgeBaseId (auto-selects if agent has exactly 1 KB)
|
|
44
|
+
* const results2 = await retrieveFromKnowledgeBase({
|
|
45
|
+
* environment: 'production',
|
|
46
|
+
* query: 'What are the shipping options?',
|
|
47
|
+
* numberOfResults: 5
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* for (const result of results.retrievalResults) {
|
|
51
|
+
* console.log(result.content.text, result.score);
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
async function retrieveFromKnowledgeBase(params, timeoutMs = 30000) {
|
|
56
|
+
var _a;
|
|
57
|
+
try {
|
|
58
|
+
const request = {
|
|
59
|
+
type: mindedConnectionTypes_1.mindedConnectionSocketMessageType.KNOWLEDGE_BASE_RETRIEVE,
|
|
60
|
+
...(params.knowledgeBaseId && { knowledgeBaseId: params.knowledgeBaseId }),
|
|
61
|
+
environment: params.environment,
|
|
62
|
+
query: params.query,
|
|
63
|
+
numberOfResults: params.numberOfResults,
|
|
64
|
+
filters: params.filters,
|
|
65
|
+
};
|
|
66
|
+
const response = await (0, mindedConnection_1.awaitEmit)(mindedConnectionTypes_1.mindedConnectionSocketMessageType.KNOWLEDGE_BASE_RETRIEVE, request, timeoutMs);
|
|
67
|
+
if (response.error) {
|
|
68
|
+
throw new Error(`Knowledge base retrieval failed: ${response.error}`);
|
|
69
|
+
}
|
|
70
|
+
logger_1.logger.debug({
|
|
71
|
+
msg: '[KnowledgeBase] Retrieval completed',
|
|
72
|
+
knowledgeBaseId: params.knowledgeBaseId,
|
|
73
|
+
resultsFound: ((_a = response.retrievalResults) === null || _a === void 0 ? void 0 : _a.length) || 0,
|
|
74
|
+
});
|
|
75
|
+
return {
|
|
76
|
+
retrievalResults: response.retrievalResults || [],
|
|
77
|
+
nextToken: response.nextToken,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
logger_1.logger.error({
|
|
82
|
+
msg: '[KnowledgeBase] Error retrieving from knowledge base',
|
|
83
|
+
err,
|
|
84
|
+
knowledgeBaseId: params.knowledgeBaseId,
|
|
85
|
+
query: params.query,
|
|
86
|
+
});
|
|
87
|
+
throw new Error(`Failed to retrieve from knowledge base: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Retrieve documents and generate a response using a knowledge base with citations.
|
|
92
|
+
*
|
|
93
|
+
* This function queries a knowledge base, retrieves relevant documents, and generates
|
|
94
|
+
* a response using an LLM, including citations that reference the source documents.
|
|
95
|
+
*
|
|
96
|
+
* @param params - The retrieval and generation parameters
|
|
97
|
+
* @param params.knowledgeBaseId - Optional ID of the knowledge base to query. If omitted, the backend
|
|
98
|
+
* will auto-select the knowledge base if exactly one exists for the agent. If 0 or >1 knowledge bases
|
|
99
|
+
* exist, an error will be thrown requiring you to pass knowledgeBaseId explicitly.
|
|
100
|
+
* @param params.environment - The environment (e.g., 'development', 'production')
|
|
101
|
+
* @param params.query - The search query string
|
|
102
|
+
* @param params.modelArn - Optional model ARN to use for generation (defaults to configured model)
|
|
103
|
+
* @param params.numberOfResults - Optional number of results to retrieve (default: 5)
|
|
104
|
+
* @param params.filters - Optional filters for metadata-based filtering
|
|
105
|
+
* @param timeoutMs - Optional timeout in milliseconds (default: 60000 for generation)
|
|
106
|
+
*
|
|
107
|
+
* @returns Promise that resolves with the generated output, citations, and optional session ID
|
|
108
|
+
*
|
|
109
|
+
* @throws {Error} When the retrieval or generation fails or when knowledgeBaseId is omitted and 0 or >1 KBs exist
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* import { retrieveAndGenerateFromKnowledgeBase } from '@minded-ai/mindedjs';
|
|
114
|
+
*
|
|
115
|
+
* // With explicit knowledgeBaseId
|
|
116
|
+
* const result = await retrieveAndGenerateFromKnowledgeBase({
|
|
117
|
+
* knowledgeBaseId: 'kb-123',
|
|
118
|
+
* environment: 'production',
|
|
119
|
+
* query: 'Summarize the refund policy',
|
|
120
|
+
* numberOfResults: 5
|
|
121
|
+
* });
|
|
122
|
+
*
|
|
123
|
+
* // Without knowledgeBaseId (auto-selects if agent has exactly 1 KB)
|
|
124
|
+
* const result2 = await retrieveAndGenerateFromKnowledgeBase({
|
|
125
|
+
* environment: 'production',
|
|
126
|
+
* query: 'What are the warranty terms?',
|
|
127
|
+
* numberOfResults: 5
|
|
128
|
+
* });
|
|
129
|
+
*
|
|
130
|
+
* console.log('Response:', result.output);
|
|
131
|
+
* console.log('Citations:', result.citations.length);
|
|
132
|
+
*
|
|
133
|
+
* // Access citation details
|
|
134
|
+
* for (const citation of result.citations) {
|
|
135
|
+
* console.log('Cited text:', citation.generatedResponsePart.textResponsePart.text);
|
|
136
|
+
* for (const ref of citation.retrievedReferences) {
|
|
137
|
+
* console.log('Source:', ref.location.s3Location.uri);
|
|
138
|
+
* }
|
|
139
|
+
* }
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
async function retrieveAndGenerateFromKnowledgeBase(params, timeoutMs = 60000) {
|
|
143
|
+
var _a, _b;
|
|
144
|
+
try {
|
|
145
|
+
const request = {
|
|
146
|
+
type: mindedConnectionTypes_1.mindedConnectionSocketMessageType.KNOWLEDGE_BASE_RETRIEVE_AND_GENERATE,
|
|
147
|
+
...(params.knowledgeBaseId && { knowledgeBaseId: params.knowledgeBaseId }),
|
|
148
|
+
environment: params.environment,
|
|
149
|
+
query: params.query,
|
|
150
|
+
modelArn: params.modelArn,
|
|
151
|
+
numberOfResults: params.numberOfResults,
|
|
152
|
+
filters: params.filters,
|
|
153
|
+
};
|
|
154
|
+
const response = await (0, mindedConnection_1.awaitEmit)(mindedConnectionTypes_1.mindedConnectionSocketMessageType.KNOWLEDGE_BASE_RETRIEVE_AND_GENERATE, request, timeoutMs);
|
|
155
|
+
if (response.error) {
|
|
156
|
+
throw new Error(`Knowledge base retrieve and generate failed: ${response.error}`);
|
|
157
|
+
}
|
|
158
|
+
logger_1.logger.debug({
|
|
159
|
+
msg: '[KnowledgeBase] Retrieve and generate completed',
|
|
160
|
+
knowledgeBaseId: params.knowledgeBaseId,
|
|
161
|
+
hasOutput: !!response.output,
|
|
162
|
+
citationsCount: ((_a = response.citations) === null || _a === void 0 ? void 0 : _a.length) || 0,
|
|
163
|
+
});
|
|
164
|
+
return {
|
|
165
|
+
output: (_b = response.output) !== null && _b !== void 0 ? _b : null,
|
|
166
|
+
citations: response.citations || [],
|
|
167
|
+
sessionId: response.sessionId,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
catch (err) {
|
|
171
|
+
logger_1.logger.error({
|
|
172
|
+
msg: '[KnowledgeBase] Error in retrieve and generate from knowledge base',
|
|
173
|
+
err,
|
|
174
|
+
knowledgeBaseId: params.knowledgeBaseId,
|
|
175
|
+
query: params.query,
|
|
176
|
+
});
|
|
177
|
+
throw new Error(`Failed to retrieve and generate from knowledge base: ${err instanceof Error ? err.message : 'Unknown error'}`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=knowledgeBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledgeBase.js","sourceRoot":"","sources":["../../src/toolsLibrary/knowledgeBase.ts"],"names":[],"mappings":";;AA4DA,8DAiDC;AAsDD,oFAqDC;AAxND,mEAAyD;AACzD,6EAS2C;AAC3C,4CAAyC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACI,KAAK,UAAU,yBAAyB,CAC7C,MAMC,EACD,YAAoB,KAAK;;IAEzB,IAAI,CAAC;QACH,MAAM,OAAO,GAAiC;YAC5C,IAAI,EAAE,yDAAiC,CAAC,uBAAuB;YAC/D,GAAG,CAAC,MAAM,CAAC,eAAe,IAAI,EAAE,eAAe,EAAE,MAAM,CAAC,eAAe,EAAE,CAAC;YAC1E,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,IAAA,4BAAS,EAC9B,yDAAiC,CAAC,uBAAuB,EACzD,OAAO,EACP,SAAS,CACV,CAAC;QAEF,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,oCAAoC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;QACxE,CAAC;QAED,eAAM,CAAC,KAAK,CAAC;YACX,GAAG,EAAE,qCAAqC;YAC1C,eAAe,EAAE,MAAM,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ACnB,MAAM,IAAI,KAAK,CAAC,gDAAgD,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;QACpF,CAAC;QAED,eAAM,CAAC,KAAK,CAAC;YACX,GAAG,EAAE,iDAAiD;YACtD,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM;YAC5B,cAAc,EAAE,CAAA,MAAA,QAAQ,CAAC,SAAS,0CAAE,MAAM,KAAI,CAAC;SAChD,CAAC,CAAC;QAEH,OAAO;YACL,MAAM,EAAE,MAAA,QAAQ,CAAC,MAAM,mCAAI,IAAI;YAC/B,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,EAAE;YACnC,SAAS,EAAE,QAAQ,CAAC,SAAS;SAC9B,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAM,CAAC,KAAK,CAAC;YACX,GAAG,EAAE,oEAAoE;YACzE,GAAG;YACH,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAC;QACH,MAAM,IAAI,KAAK,CAAC,wDAAwD,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;IAClI,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RagDefaultsConfig } from '../platform/mindedConnectionTypes';
|
|
2
|
+
import type { State } from '../types/LangGraph.types';
|
|
3
|
+
interface RetrieveAndInjectDefaultRagContextParams<Memory extends Record<string, any>> {
|
|
4
|
+
state: State<Memory>;
|
|
5
|
+
ragDefaults: RagDefaultsConfig | null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Retrieve context from default knowledge bases and inject as system message.
|
|
9
|
+
* Called after TRIGGER_EVENT.
|
|
10
|
+
*
|
|
11
|
+
* @param state - Current agent state
|
|
12
|
+
* @returns The updated state with injected context message, or original state if no results
|
|
13
|
+
*/
|
|
14
|
+
export declare const retrieveAndInjectDefaultRagContext: <Memory extends Record<string, any>>({ state, ragDefaults, }: RetrieveAndInjectDefaultRagContextParams<Memory>) => Promise<State<Memory>>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=rag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rag.d.ts","sourceRoot":"","sources":["../../src/utils/rag.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAqD,iBAAiB,EAAkB,MAAM,mCAAmC,CAAC;AAE9I,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAwHtD,UAAU,wCAAwC,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACnF,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACvC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kCAAkC,GAAU,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,yBAG1F,wCAAwC,CAAC,MAAM,CAAC,KAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CA8G1E,CAAC"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.retrieveAndInjectDefaultRagContext = void 0;
|
|
4
|
+
const messages_1 = require("@langchain/core/messages");
|
|
5
|
+
const uuid_1 = require("uuid");
|
|
6
|
+
const config_1 = require("../platform/config");
|
|
7
|
+
const knowledgeBase_1 = require("../toolsLibrary/knowledgeBase");
|
|
8
|
+
const logger_1 = require("./logger");
|
|
9
|
+
const getNestedValue = ({ obj, path }) => {
|
|
10
|
+
return path.split('.').reduce((current, key) => {
|
|
11
|
+
if (current === undefined || current === null)
|
|
12
|
+
return undefined;
|
|
13
|
+
return current[key];
|
|
14
|
+
}, obj);
|
|
15
|
+
};
|
|
16
|
+
const resolveRagFilters = ({ filters, memory }) => {
|
|
17
|
+
if (!filters || filters.length === 0) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
const resolvedFilters = [];
|
|
21
|
+
for (const filter of filters) {
|
|
22
|
+
// Check if value is a chip pattern like {state.memory.language}
|
|
23
|
+
const chipPattern = /^\{state\.memory\.([^}]+)\}$/;
|
|
24
|
+
const match = filter.value.match(chipPattern);
|
|
25
|
+
let resolvedValue;
|
|
26
|
+
if (match) {
|
|
27
|
+
// Extract the memory path (e.g., "language" or "user.preferences.lang")
|
|
28
|
+
const memoryPath = match[1];
|
|
29
|
+
const memoryValue = getNestedValue({ obj: memory, path: memoryPath });
|
|
30
|
+
if (memoryValue === undefined || memoryValue === null) {
|
|
31
|
+
// Skip this filter entry if memory value is missing
|
|
32
|
+
logger_1.logger.debug({
|
|
33
|
+
msg: '[Agent] Skipping RAG filter - memory value not found',
|
|
34
|
+
filterKey: filter.key,
|
|
35
|
+
memoryPath,
|
|
36
|
+
});
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
resolvedValue = String(memoryValue);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// Plain string value
|
|
43
|
+
resolvedValue = filter.value;
|
|
44
|
+
}
|
|
45
|
+
// Create the knowledge base filter based on operator
|
|
46
|
+
const knowledgeBaseFilter = {};
|
|
47
|
+
switch (filter.operator) {
|
|
48
|
+
case 'equals':
|
|
49
|
+
knowledgeBaseFilter.equals = { key: filter.key, value: resolvedValue };
|
|
50
|
+
break;
|
|
51
|
+
case 'notEquals':
|
|
52
|
+
knowledgeBaseFilter.notEquals = { key: filter.key, value: resolvedValue };
|
|
53
|
+
break;
|
|
54
|
+
case 'greaterThan':
|
|
55
|
+
knowledgeBaseFilter.greaterThan = { key: filter.key, value: resolvedValue };
|
|
56
|
+
break;
|
|
57
|
+
case 'lessThan':
|
|
58
|
+
knowledgeBaseFilter.lessThan = { key: filter.key, value: resolvedValue };
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
resolvedFilters.push(knowledgeBaseFilter);
|
|
62
|
+
}
|
|
63
|
+
if (resolvedFilters.length === 0) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
// Combine all filters with andAll
|
|
67
|
+
if (resolvedFilters.length === 1) {
|
|
68
|
+
return resolvedFilters[0];
|
|
69
|
+
}
|
|
70
|
+
return { andAll: resolvedFilters };
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Get the source name from a retrieval result.
|
|
74
|
+
* Uses documentName from metadata, falling back to the last path segment of s3Location.uri.
|
|
75
|
+
*/
|
|
76
|
+
const getSourceName = (result) => {
|
|
77
|
+
var _a, _b, _c;
|
|
78
|
+
if ((_a = result.metadata) === null || _a === void 0 ? void 0 : _a.documentName) {
|
|
79
|
+
return result.metadata.documentName;
|
|
80
|
+
}
|
|
81
|
+
// Fallback to last segment of S3 URI
|
|
82
|
+
const uri = ((_c = (_b = result.location) === null || _b === void 0 ? void 0 : _b.s3Location) === null || _c === void 0 ? void 0 : _c.uri) || '';
|
|
83
|
+
const segments = uri.split('/');
|
|
84
|
+
return segments[segments.length - 1] || 'Unknown Source';
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Format RAG retrieval results into a markdown string for injection.
|
|
88
|
+
*/
|
|
89
|
+
const formatRagResultsToMarkdown = (allResults) => {
|
|
90
|
+
if (allResults.length === 0) {
|
|
91
|
+
return '';
|
|
92
|
+
}
|
|
93
|
+
let markdown = '### Below are details that may be related to the query:\n\n';
|
|
94
|
+
for (const result of allResults) {
|
|
95
|
+
markdown += `#### Source: ${result.source}\n`;
|
|
96
|
+
markdown += `${result.content}\n\n`;
|
|
97
|
+
}
|
|
98
|
+
return markdown.trim();
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Retrieve context from default knowledge bases and inject as system message.
|
|
102
|
+
* Called after TRIGGER_EVENT.
|
|
103
|
+
*
|
|
104
|
+
* @param state - Current agent state
|
|
105
|
+
* @returns The updated state with injected context message, or original state if no results
|
|
106
|
+
*/
|
|
107
|
+
const retrieveAndInjectDefaultRagContext = async ({ state, ragDefaults, }) => {
|
|
108
|
+
var _a, _b;
|
|
109
|
+
// Get query from the last user message or triggerBody content
|
|
110
|
+
let query;
|
|
111
|
+
try {
|
|
112
|
+
const lastUserMessage = state.messages.filter((m) => m.getType() === 'human').slice(-1)[0];
|
|
113
|
+
query = typeof (lastUserMessage === null || lastUserMessage === void 0 ? void 0 : lastUserMessage.content) === 'string' ? lastUserMessage.content : JSON.stringify(lastUserMessage.content);
|
|
114
|
+
if (!query) {
|
|
115
|
+
return state;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
logger_1.logger.error({ msg: '[Agent] Error retrieving and injecting default RAG context', err });
|
|
120
|
+
return state;
|
|
121
|
+
}
|
|
122
|
+
const { runLocally, env } = (0, config_1.getConfig)();
|
|
123
|
+
// Determine which environment's config to use
|
|
124
|
+
// For production runtime, always use production config
|
|
125
|
+
// For local/dev, use the configured environment
|
|
126
|
+
const configEnv = !runLocally && env === 'production' ? 'production' : env || 'development';
|
|
127
|
+
const envConfig = ragDefaults === null || ragDefaults === void 0 ? void 0 : ragDefaults[configEnv];
|
|
128
|
+
// Check if RAG defaults are configured and enabled for this environment
|
|
129
|
+
if (!(envConfig === null || envConfig === void 0 ? void 0 : envConfig.enabled) || !((_a = envConfig.knowledgeBases) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
130
|
+
return state;
|
|
131
|
+
}
|
|
132
|
+
// Collect all retrieval results across all KBs
|
|
133
|
+
const allResults = [];
|
|
134
|
+
for (const kbConfig of envConfig.knowledgeBases) {
|
|
135
|
+
try {
|
|
136
|
+
// Use the KB-specific environment for retrieval
|
|
137
|
+
// This allows querying a different KB environment than the config environment
|
|
138
|
+
const targetEnvironment = kbConfig.environment || configEnv;
|
|
139
|
+
// Resolve filters with memory values
|
|
140
|
+
const resolvedFilters = resolveRagFilters({ filters: kbConfig.filters, memory: state.memory });
|
|
141
|
+
logger_1.logger.debug({
|
|
142
|
+
msg: '[Agent] Retrieving from default knowledge base',
|
|
143
|
+
knowledgeBaseId: kbConfig.knowledgeBaseId,
|
|
144
|
+
environment: targetEnvironment,
|
|
145
|
+
numberOfResults: kbConfig.numberOfResults,
|
|
146
|
+
minScore: kbConfig.minScore,
|
|
147
|
+
hasFilters: !!resolvedFilters,
|
|
148
|
+
configuredFilters: ((_b = kbConfig.filters) === null || _b === void 0 ? void 0 : _b.length) || 0,
|
|
149
|
+
resolvedFilters: resolvedFilters ? JSON.stringify(resolvedFilters) : undefined,
|
|
150
|
+
});
|
|
151
|
+
// Call the retrieval API
|
|
152
|
+
const response = await (0, knowledgeBase_1.retrieveFromKnowledgeBase)({
|
|
153
|
+
knowledgeBaseId: kbConfig.knowledgeBaseId,
|
|
154
|
+
environment: targetEnvironment,
|
|
155
|
+
query,
|
|
156
|
+
numberOfResults: kbConfig.numberOfResults,
|
|
157
|
+
filters: resolvedFilters,
|
|
158
|
+
});
|
|
159
|
+
// Filter by minScore and format results
|
|
160
|
+
for (const result of response.retrievalResults || []) {
|
|
161
|
+
// Skip results below minScore threshold
|
|
162
|
+
if (kbConfig.minScore !== undefined && result.score < kbConfig.minScore) {
|
|
163
|
+
logger_1.logger.debug({
|
|
164
|
+
msg: '[Agent] Skipping RAG result below minScore',
|
|
165
|
+
score: result.score,
|
|
166
|
+
minScore: kbConfig.minScore,
|
|
167
|
+
});
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
allResults.push({
|
|
171
|
+
source: getSourceName(result),
|
|
172
|
+
content: result.content.text,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
// Log error but continue with other KBs
|
|
178
|
+
logger_1.logger.error({
|
|
179
|
+
msg: '[Agent] Error retrieving from default knowledge base',
|
|
180
|
+
knowledgeBaseId: kbConfig.knowledgeBaseId,
|
|
181
|
+
err,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// If no results, return original state
|
|
186
|
+
if (allResults.length === 0) {
|
|
187
|
+
logger_1.logger.debug({ msg: '[Agent] No RAG results to inject' });
|
|
188
|
+
return state;
|
|
189
|
+
}
|
|
190
|
+
// Format results to markdown
|
|
191
|
+
const contextMarkdown = formatRagResultsToMarkdown(allResults);
|
|
192
|
+
// Inject as a separate system message
|
|
193
|
+
const contextMessage = new messages_1.SystemMessage({
|
|
194
|
+
content: contextMarkdown,
|
|
195
|
+
id: (0, uuid_1.v4)(),
|
|
196
|
+
});
|
|
197
|
+
// Add the context message to the state
|
|
198
|
+
state.messages.push(contextMessage);
|
|
199
|
+
logger_1.logger.debug({
|
|
200
|
+
msg: '[Agent] Injected RAG context as system message',
|
|
201
|
+
resultsCount: allResults.length,
|
|
202
|
+
});
|
|
203
|
+
return state;
|
|
204
|
+
};
|
|
205
|
+
exports.retrieveAndInjectDefaultRagContext = retrieveAndInjectDefaultRagContext;
|
|
206
|
+
//# sourceMappingURL=rag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rag.js","sourceRoot":"","sources":["../../src/utils/rag.ts"],"names":[],"mappings":";;;AAAA,uDAAyD;AACzD,+BAAoC;AACpC,+CAA+C;AAE/C,iEAA0E;AAE1E,qCAAkC;AAOlC,MAAM,cAAc,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,EAAwB,EAAO,EAAE;IAClE,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE;QAC7C,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI;YAAE,OAAO,SAAS,CAAC;QAChE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC,EA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EAAE,kCAAkC,EAAE,CAAC,CAAC;QAC1D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,6BAA6B;IAC7B,MAAM,eAAe,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;IAE/D,sCAAsC;IACtC,MAAM,cAAc,GAAG,IAAI,wBAAa,CAAC;QACvC,OAAO,EAAE,eAAe;QACxB,EAAE,EAAE,IAAA,SAAM,GAAE;KACb,CAAC,CAAC;IAEH,uCAAuC;IACvC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAEpC,eAAM,CAAC,KAAK,CAAC;QACX,GAAG,EAAE,gDAAgD;QACrD,YAAY,EAAE,UAAU,CAAC,MAAM;KAChC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAjHW,QAAA,kCAAkC,sCAiH7C"}
|
package/docs/SUMMARY.md
CHANGED
|
@@ -25,16 +25,22 @@
|
|
|
25
25
|
- [Debugging](sdk/debugging.md)
|
|
26
26
|
- [Memory](sdk/memory.md)
|
|
27
27
|
- [Events](sdk/events.md)
|
|
28
|
+
- [Knowledge Base RAG API](sdk/knowledge-base-rag.md)
|
|
28
29
|
- [Logging](sdk/logging.md)
|
|
29
30
|
- [Parallel LLM Requests](sdk/parallel-llm.md)
|
|
30
31
|
|
|
32
|
+
## API
|
|
33
|
+
|
|
34
|
+
- [Overview](api/overview.md)
|
|
35
|
+
- [Analytics API](api/analytics.md)
|
|
36
|
+
- [Knowledge API](api/knowledge.md)
|
|
37
|
+
|
|
31
38
|
## Platform
|
|
32
39
|
|
|
33
40
|
- [Secrets](platform/secrets.md)
|
|
34
|
-
- [
|
|
41
|
+
- [Knowledge Bases](platform/knowledge-bases.md)
|
|
35
42
|
- [PII Masking](platform/pii-masking.md)
|
|
36
43
|
- [Operator](platform/operator.md)
|
|
37
|
-
- [Browser Task](platform/browserTask.md)
|
|
38
44
|
- [SSO (Single Sign-On)](platform/sso.md)
|
|
39
45
|
- [On-prem Deployment](platform/on-prem.md)
|
|
40
46
|
- [Security Architecture](platform/security-architecture.md)
|