@usecortex_ai/node 0.4.0 → 0.5.1
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/Client.d.ts +0 -2
- package/dist/Client.js +0 -2
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/resources/dashboard/client/Client.d.ts +2 -16
- package/dist/api/resources/dashboard/client/Client.js +2 -16
- package/dist/api/resources/dashboard/client/requests/ListSourcesDashboardSourcesGetRequest.d.ts +2 -2
- package/dist/api/resources/embeddings/client/Client.d.ts +20 -33
- package/dist/api/resources/embeddings/client/Client.js +28 -41
- package/dist/api/resources/embeddings/client/requests/BodyFilterRawEmbeddingsEndpointEmbeddingsFilterRawEmbeddingsPost.d.ts +2 -2
- package/dist/api/resources/embeddings/client/requests/BodyInsertRawEmbeddingsEndpointEmbeddingsInsertRawEmbeddingsPost.d.ts +15 -3
- package/dist/api/resources/embeddings/client/requests/BodySearchRawEmbeddingsEndpointEmbeddingsSearchRawEmbeddingsPost.d.ts +2 -2
- package/dist/api/resources/embeddings/client/requests/EmbeddingsDeleteRequest.d.ts +1 -1
- package/dist/api/resources/fetch/client/Client.d.ts +9 -60
- package/dist/api/resources/fetch/client/Client.js +16 -129
- package/dist/api/resources/fetch/client/requests/FetchGraphRelationsBySourceIdRequest.d.ts +2 -1
- package/dist/api/resources/fetch/client/requests/ListContentRequest.d.ts +20 -0
- package/dist/api/resources/fetch/client/requests/SourceFetchRequest.d.ts +2 -2
- package/dist/api/resources/fetch/client/requests/index.d.ts +1 -2
- package/dist/api/resources/fetch/index.d.ts +1 -0
- package/dist/api/resources/fetch/index.js +1 -0
- package/dist/api/resources/fetch/types/FetchListKnowledgeResponse.d.ts +5 -0
- package/dist/api/resources/fetch/types/index.d.ts +1 -0
- package/dist/api/resources/fetch/types/index.js +17 -0
- package/dist/api/resources/index.d.ts +2 -1
- package/dist/api/resources/index.js +3 -2
- package/dist/api/resources/search/client/Client.d.ts +6 -40
- package/dist/api/resources/search/client/Client.js +12 -46
- package/dist/api/resources/search/client/requests/FullTextSearchRequest.d.ts +3 -3
- package/dist/api/resources/search/client/requests/HybridSearchRequest.d.ts +7 -7
- package/dist/api/resources/search/client/requests/QnASearchRequest.d.ts +2 -2
- package/dist/api/resources/sources/client/Client.d.ts +2 -9
- package/dist/api/resources/sources/client/Client.js +4 -11
- package/dist/api/resources/sources/client/requests/SourceDeleteRequest.d.ts +2 -2
- package/dist/api/resources/tenant/client/Client.d.ts +2 -54
- package/dist/api/resources/tenant/client/Client.js +4 -56
- package/dist/api/resources/tenant/client/requests/TenantCreateRequest.d.ts +1 -1
- package/dist/api/resources/tenant/client/requests/TenantStatsRequest.d.ts +1 -1
- package/dist/api/resources/upload/client/Client.d.ts +9 -73
- package/dist/api/resources/upload/client/Client.js +22 -140
- package/dist/api/resources/upload/client/requests/BodyAddMemoryMemoriesAddMemoryPost.d.ts +1 -1
- package/dist/api/resources/upload/client/requests/{BodyUploadDocumentIngestionUploadDocumentPost.d.ts → BodyUploadKnowledgeIngestionUploadKnowledgePost.d.ts} +7 -5
- package/dist/api/resources/upload/client/requests/UploadDeleteMemoryRequest.d.ts +2 -2
- package/dist/api/resources/upload/client/requests/UploadVerifyProcessingRequest.d.ts +2 -1
- package/dist/api/resources/upload/client/requests/index.d.ts +1 -2
- package/dist/api/types/ForcefulRelationsPayload.d.ts +9 -0
- package/dist/api/types/ListContentKind.d.ts +8 -0
- package/dist/api/types/ListContentKind.js +10 -0
- package/dist/api/types/ListUserMemoriesResponse.d.ts +13 -0
- package/dist/api/types/MemoryItem.d.ts +3 -1
- package/dist/api/types/RetrievalResult.d.ts +2 -0
- package/dist/api/types/RetrieveMode.d.ts +2 -2
- package/dist/api/types/RetrieveMode.js +1 -1
- package/dist/api/types/UserMemory.d.ts +12 -0
- package/dist/api/types/UserMemory.js +5 -0
- package/dist/api/types/VectorStoreChunk.d.ts +2 -0
- package/dist/api/types/index.d.ts +4 -1
- package/dist/api/types/index.js +4 -1
- package/package.json +33 -30
- package/dist/api/resources/fetch/client/requests/FetchSourcesRequest.d.ts +0 -15
- package/dist/api/resources/fetch/client/requests/ListSourcesByIdRequest.d.ts +0 -18
- package/dist/api/resources/upload/client/requests/BodyUploadAppIngestionUploadAppPost.d.ts +0 -31
- package/dist/api/types/AppSourcesUploadData.d.ts +0 -17
- /package/dist/api/resources/fetch/client/requests/{FetchSourcesRequest.js → ListContentRequest.js} +0 -0
- /package/dist/api/resources/fetch/{client/requests/ListSourcesByIdRequest.js → types/FetchListKnowledgeResponse.js} +0 -0
- /package/dist/api/resources/upload/client/requests/{BodyUploadAppIngestionUploadAppPost.js → BodyUploadKnowledgeIngestionUploadKnowledgePost.js} +0 -0
- /package/dist/api/{resources/upload/client/requests/BodyUploadDocumentIngestionUploadDocumentPost.js → types/ForcefulRelationsPayload.js} +0 -0
- /package/dist/api/types/{AppSourcesUploadData.js → ListUserMemoriesResponse.js} +0 -0
|
@@ -37,106 +37,7 @@ class Fetch {
|
|
|
37
37
|
this._options = _options;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* Use this endpoint to fetch a complete list of all sources associated
|
|
43
|
-
* with your tenant. This includes documents, files, and other content
|
|
44
|
-
* you've uploaded for processing.
|
|
45
|
-
*
|
|
46
|
-
* You can optionally specify a sub-tenant to narrow down the results to
|
|
47
|
-
* sources within that specific sub-tenant scope.
|
|
48
|
-
*
|
|
49
|
-
* @param {CortexAI.FetchSourcesRequest} request
|
|
50
|
-
* @param {Fetch.RequestOptions} requestOptions - Request-specific configuration.
|
|
51
|
-
*
|
|
52
|
-
* @throws {@link CortexAI.BadRequestError}
|
|
53
|
-
* @throws {@link CortexAI.UnauthorizedError}
|
|
54
|
-
* @throws {@link CortexAI.ForbiddenError}
|
|
55
|
-
* @throws {@link CortexAI.NotFoundError}
|
|
56
|
-
* @throws {@link CortexAI.UnprocessableEntityError}
|
|
57
|
-
* @throws {@link CortexAI.InternalServerError}
|
|
58
|
-
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* await client.fetch.sources({
|
|
62
|
-
* tenant_id: "tenant_id"
|
|
63
|
-
* })
|
|
64
|
-
*/
|
|
65
|
-
sources(request, requestOptions) {
|
|
66
|
-
return core.HttpResponsePromise.fromPromise(this.__sources(request, requestOptions));
|
|
67
|
-
}
|
|
68
|
-
async __sources(request, requestOptions) {
|
|
69
|
-
var _a, _b, _c;
|
|
70
|
-
const { tenant_id: tenantId, sub_tenant_id: subTenantId } = request;
|
|
71
|
-
const _queryParams = {};
|
|
72
|
-
_queryParams["tenant_id"] = tenantId;
|
|
73
|
-
if (subTenantId != null) {
|
|
74
|
-
_queryParams["sub_tenant_id"] = subTenantId;
|
|
75
|
-
}
|
|
76
|
-
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
77
|
-
const _response = await core.fetcher({
|
|
78
|
-
url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "list/list-sources"),
|
|
79
|
-
method: "GET",
|
|
80
|
-
headers: _headers,
|
|
81
|
-
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
82
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
83
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
84
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
85
|
-
});
|
|
86
|
-
if (_response.ok) {
|
|
87
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
88
|
-
}
|
|
89
|
-
if (_response.error.reason === "status-code") {
|
|
90
|
-
switch (_response.error.statusCode) {
|
|
91
|
-
case 400:
|
|
92
|
-
throw new CortexAI.BadRequestError(_response.error.body, _response.rawResponse);
|
|
93
|
-
case 401:
|
|
94
|
-
throw new CortexAI.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
95
|
-
case 403:
|
|
96
|
-
throw new CortexAI.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
97
|
-
case 404:
|
|
98
|
-
throw new CortexAI.NotFoundError(_response.error.body, _response.rawResponse);
|
|
99
|
-
case 422:
|
|
100
|
-
throw new CortexAI.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
101
|
-
case 500:
|
|
102
|
-
throw new CortexAI.InternalServerError(_response.error.body, _response.rawResponse);
|
|
103
|
-
case 503:
|
|
104
|
-
throw new CortexAI.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
105
|
-
default:
|
|
106
|
-
throw new errors.CortexAIError({
|
|
107
|
-
statusCode: _response.error.statusCode,
|
|
108
|
-
body: _response.error.body,
|
|
109
|
-
rawResponse: _response.rawResponse,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
switch (_response.error.reason) {
|
|
114
|
-
case "non-json":
|
|
115
|
-
throw new errors.CortexAIError({
|
|
116
|
-
statusCode: _response.error.statusCode,
|
|
117
|
-
body: _response.error.rawBody,
|
|
118
|
-
rawResponse: _response.rawResponse,
|
|
119
|
-
});
|
|
120
|
-
case "timeout":
|
|
121
|
-
throw new errors.CortexAITimeoutError("Timeout exceeded when calling GET /list/list-sources.");
|
|
122
|
-
case "unknown":
|
|
123
|
-
throw new errors.CortexAIError({
|
|
124
|
-
message: _response.error.errorMessage,
|
|
125
|
-
rawResponse: _response.rawResponse,
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Retrieve specific sources by their IDs.
|
|
131
|
-
*
|
|
132
|
-
* Use this endpoint to fetch one or more sources by providing their
|
|
133
|
-
* unique identifiers. This is useful when you need detailed information
|
|
134
|
-
* about specific documents or content you've previously uploaded.
|
|
135
|
-
*
|
|
136
|
-
* Provide the source IDs in the request body along with your tenant
|
|
137
|
-
* information to get the exact sources you need.
|
|
138
|
-
*
|
|
139
|
-
* @param {CortexAI.ListSourcesByIdRequest} request
|
|
40
|
+
* @param {CortexAI.ListContentRequest} request
|
|
140
41
|
* @param {Fetch.RequestOptions} requestOptions - Request-specific configuration.
|
|
141
42
|
*
|
|
142
43
|
* @throws {@link CortexAI.BadRequestError}
|
|
@@ -148,19 +49,18 @@ class Fetch {
|
|
|
148
49
|
* @throws {@link CortexAI.ServiceUnavailableError}
|
|
149
50
|
*
|
|
150
51
|
* @example
|
|
151
|
-
* await client.fetch.
|
|
152
|
-
*
|
|
153
|
-
* tenant_id: "tenant_id"
|
|
52
|
+
* await client.fetch.listKnowledge({
|
|
53
|
+
* tenant_id: "tenant_1234"
|
|
154
54
|
* })
|
|
155
55
|
*/
|
|
156
|
-
|
|
157
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
56
|
+
listKnowledge(request, requestOptions) {
|
|
57
|
+
return core.HttpResponsePromise.fromPromise(this.__listKnowledge(request, requestOptions));
|
|
158
58
|
}
|
|
159
|
-
async
|
|
59
|
+
async __listKnowledge(request, requestOptions) {
|
|
160
60
|
var _a, _b, _c;
|
|
161
61
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
162
62
|
const _response = await core.fetcher({
|
|
163
|
-
url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "list/
|
|
63
|
+
url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "list/data"),
|
|
164
64
|
method: "POST",
|
|
165
65
|
headers: _headers,
|
|
166
66
|
contentType: "application/json",
|
|
@@ -206,7 +106,7 @@ class Fetch {
|
|
|
206
106
|
rawResponse: _response.rawResponse,
|
|
207
107
|
});
|
|
208
108
|
case "timeout":
|
|
209
|
-
throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /list/
|
|
109
|
+
throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /list/data.");
|
|
210
110
|
case "unknown":
|
|
211
111
|
throw new errors.CortexAIError({
|
|
212
112
|
message: _response.error.errorMessage,
|
|
@@ -215,13 +115,6 @@ class Fetch {
|
|
|
215
115
|
}
|
|
216
116
|
}
|
|
217
117
|
/**
|
|
218
|
-
* Retrieve relations for a specific source.
|
|
219
|
-
*
|
|
220
|
-
* Use this endpoint to fetch all relations associated with a specific source.
|
|
221
|
-
* This is useful when you need to understand the relationships between entities within a source.
|
|
222
|
-
*
|
|
223
|
-
* Provide the source ID in the request body along with your tenant information to get the relations for that source.
|
|
224
|
-
*
|
|
225
118
|
* @param {CortexAI.FetchGraphRelationsBySourceIdRequest} request
|
|
226
119
|
* @param {Fetch.RequestOptions} requestOptions - Request-specific configuration.
|
|
227
120
|
*
|
|
@@ -235,7 +128,8 @@ class Fetch {
|
|
|
235
128
|
*
|
|
236
129
|
* @example
|
|
237
130
|
* await client.fetch.graphRelationsBySourceId({
|
|
238
|
-
* source_id: "
|
|
131
|
+
* source_id: "<str>",
|
|
132
|
+
* tenant_id: "tenant_1234"
|
|
239
133
|
* })
|
|
240
134
|
*/
|
|
241
135
|
graphRelationsBySourceId(request, requestOptions) {
|
|
@@ -254,7 +148,7 @@ class Fetch {
|
|
|
254
148
|
}
|
|
255
149
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
256
150
|
const _response = await core.fetcher({
|
|
257
|
-
url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "list/
|
|
151
|
+
url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "list/graph_relations_by_id"),
|
|
258
152
|
method: "GET",
|
|
259
153
|
headers: _headers,
|
|
260
154
|
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
@@ -300,7 +194,7 @@ class Fetch {
|
|
|
300
194
|
rawResponse: _response.rawResponse,
|
|
301
195
|
});
|
|
302
196
|
case "timeout":
|
|
303
|
-
throw new errors.CortexAITimeoutError("Timeout exceeded when calling GET /list/
|
|
197
|
+
throw new errors.CortexAITimeoutError("Timeout exceeded when calling GET /list/graph_relations_by_id.");
|
|
304
198
|
case "unknown":
|
|
305
199
|
throw new errors.CortexAIError({
|
|
306
200
|
message: _response.error.errorMessage,
|
|
@@ -309,13 +203,6 @@ class Fetch {
|
|
|
309
203
|
}
|
|
310
204
|
}
|
|
311
205
|
/**
|
|
312
|
-
* Fetch the content of a source ingested.
|
|
313
|
-
*
|
|
314
|
-
* This endpoint can return:
|
|
315
|
-
* - File content directly (as string or base64)
|
|
316
|
-
* - A presigned URL to access the file
|
|
317
|
-
* - Both content and presigned URL
|
|
318
|
-
*
|
|
319
206
|
* @param {CortexAI.SourceFetchRequest} request
|
|
320
207
|
* @param {Fetch.RequestOptions} requestOptions - Request-specific configuration.
|
|
321
208
|
*
|
|
@@ -329,8 +216,8 @@ class Fetch {
|
|
|
329
216
|
*
|
|
330
217
|
* @example
|
|
331
218
|
* await client.fetch.sourceContent({
|
|
332
|
-
* tenant_id: "
|
|
333
|
-
* source_id: "source_id"
|
|
219
|
+
* tenant_id: "tenant_1234",
|
|
220
|
+
* source_id: "<source_id>"
|
|
334
221
|
* })
|
|
335
222
|
*/
|
|
336
223
|
sourceContent(request, requestOptions) {
|
|
@@ -340,7 +227,7 @@ class Fetch {
|
|
|
340
227
|
var _a, _b, _c;
|
|
341
228
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
342
229
|
const _response = await core.fetcher({
|
|
343
|
-
url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "fetch/
|
|
230
|
+
url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "fetch/content"),
|
|
344
231
|
method: "POST",
|
|
345
232
|
headers: _headers,
|
|
346
233
|
contentType: "application/json",
|
|
@@ -386,7 +273,7 @@ class Fetch {
|
|
|
386
273
|
rawResponse: _response.rawResponse,
|
|
387
274
|
});
|
|
388
275
|
case "timeout":
|
|
389
|
-
throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /fetch/
|
|
276
|
+
throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /fetch/content.");
|
|
390
277
|
case "unknown":
|
|
391
278
|
throw new errors.CortexAIError({
|
|
392
279
|
message: _response.error.errorMessage,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as CortexAI from "../../../../index.js";
|
|
5
|
+
/**
|
|
6
|
+
* @example
|
|
7
|
+
* {
|
|
8
|
+
* tenant_id: "tenant_1234"
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export interface ListContentRequest {
|
|
12
|
+
/** Tenant ID */
|
|
13
|
+
tenant_id: string;
|
|
14
|
+
/** Sub-tenant ID */
|
|
15
|
+
sub_tenant_id?: string;
|
|
16
|
+
/** Whether to list normal sources or user memories. */
|
|
17
|
+
kind?: CortexAI.ListContentKind;
|
|
18
|
+
/** Optional list of IDs to fetch. If omitted, returns all. */
|
|
19
|
+
source_ids?: string[];
|
|
20
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { type
|
|
2
|
-
export { type ListSourcesByIdRequest } from "./ListSourcesByIdRequest.js";
|
|
1
|
+
export { type ListContentRequest } from "./ListContentRequest.js";
|
|
3
2
|
export { type FetchGraphRelationsBySourceIdRequest } from "./FetchGraphRelationsBySourceIdRequest.js";
|
|
4
3
|
export { type SourceFetchRequest } from "./SourceFetchRequest.js";
|
|
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types/index.js"), exports);
|
|
17
18
|
__exportStar(require("./client/index.js"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./FetchListKnowledgeResponse.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./FetchListKnowledgeResponse.js"), exports);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
export * as fetch from "./fetch/index.js";
|
|
2
|
+
export * from "./fetch/types/index.js";
|
|
1
3
|
export * as upload from "./upload/index.js";
|
|
2
4
|
export * as tenant from "./tenant/index.js";
|
|
3
5
|
export * as embeddings from "./embeddings/index.js";
|
|
4
|
-
export * as fetch from "./fetch/index.js";
|
|
5
6
|
export * as sources from "./sources/index.js";
|
|
6
7
|
export * as search from "./search/index.js";
|
|
7
8
|
export * as dashboard from "./dashboard/index.js";
|
|
@@ -26,11 +26,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
26
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.dashboard = exports.search = exports.sources = exports.
|
|
29
|
+
exports.dashboard = exports.search = exports.sources = exports.embeddings = exports.tenant = exports.upload = exports.fetch = void 0;
|
|
30
|
+
exports.fetch = __importStar(require("./fetch/index.js"));
|
|
31
|
+
__exportStar(require("./fetch/types/index.js"), exports);
|
|
30
32
|
exports.upload = __importStar(require("./upload/index.js"));
|
|
31
33
|
exports.tenant = __importStar(require("./tenant/index.js"));
|
|
32
34
|
exports.embeddings = __importStar(require("./embeddings/index.js"));
|
|
33
|
-
exports.fetch = __importStar(require("./fetch/index.js"));
|
|
34
35
|
exports.sources = __importStar(require("./sources/index.js"));
|
|
35
36
|
exports.search = __importStar(require("./search/index.js"));
|
|
36
37
|
exports.dashboard = __importStar(require("./dashboard/index.js"));
|
|
@@ -30,19 +30,6 @@ export declare class Search {
|
|
|
30
30
|
protected readonly _options: Search.Options;
|
|
31
31
|
constructor(_options?: Search.Options);
|
|
32
32
|
/**
|
|
33
|
-
* Search for relevant content within your indexed sources or user memories.
|
|
34
|
-
*
|
|
35
|
-
* Results are ranked by relevance and can be customized with parameters like
|
|
36
|
-
* result limits, alpha weighting, and recency preferences.
|
|
37
|
-
*
|
|
38
|
-
* Use `search_mode` to specify what to search:
|
|
39
|
-
* - "sources" (default): Search over indexed documents
|
|
40
|
-
* - "memories": Search over user memories (uses inferred content)
|
|
41
|
-
*
|
|
42
|
-
* Use `mode` to control retrieval quality:
|
|
43
|
-
* - "fast" (default): Single query, faster response
|
|
44
|
-
* - "accurate": Multi-query generation with reranking, higher quality
|
|
45
|
-
*
|
|
46
33
|
* @param {CortexAI.HybridSearchRequest} request
|
|
47
34
|
* @param {Search.RequestOptions} requestOptions - Request-specific configuration.
|
|
48
35
|
*
|
|
@@ -57,21 +44,13 @@ export declare class Search {
|
|
|
57
44
|
*
|
|
58
45
|
* @example
|
|
59
46
|
* await client.search.retrieve({
|
|
60
|
-
* tenant_id: "
|
|
61
|
-
* query: "
|
|
47
|
+
* tenant_id: "tenant_1234",
|
|
48
|
+
* query: "Which mode does user prefer"
|
|
62
49
|
* })
|
|
63
50
|
*/
|
|
64
51
|
retrieve(request: CortexAI.HybridSearchRequest, requestOptions?: Search.RequestOptions): core.HttpResponsePromise<CortexAI.RetrievalResult>;
|
|
65
52
|
private __retrieve;
|
|
66
53
|
/**
|
|
67
|
-
* Perform full text search for exact matches within your indexed sources or memories.
|
|
68
|
-
* Choose between 'OR' and 'AND' operators to control how search terms are combined
|
|
69
|
-
* for precise text matching.
|
|
70
|
-
*
|
|
71
|
-
* Use `search_mode` to specify what to search:
|
|
72
|
-
* - "sources" (default): Search over indexed documents
|
|
73
|
-
* - "memories": Search over user memories
|
|
74
|
-
*
|
|
75
54
|
* @param {CortexAI.FullTextSearchRequest} request
|
|
76
55
|
* @param {Search.RequestOptions} requestOptions - Request-specific configuration.
|
|
77
56
|
*
|
|
@@ -86,26 +65,13 @@ export declare class Search {
|
|
|
86
65
|
*
|
|
87
66
|
* @example
|
|
88
67
|
* await client.search.fullTextSearch({
|
|
89
|
-
* tenant_id: "
|
|
90
|
-
* query: "
|
|
68
|
+
* tenant_id: "tenant_1234",
|
|
69
|
+
* query: "John Smith Jake"
|
|
91
70
|
* })
|
|
92
71
|
*/
|
|
93
72
|
fullTextSearch(request: CortexAI.FullTextSearchRequest, requestOptions?: Search.RequestOptions): core.HttpResponsePromise<CortexAI.RetrievalResult>;
|
|
94
73
|
private __fullTextSearch;
|
|
95
74
|
/**
|
|
96
|
-
* Ask a question and get an AI-generated answer based on your indexed sources or memories.
|
|
97
|
-
*
|
|
98
|
-
* The response includes both the AI answer and the source chunks used to generate it,
|
|
99
|
-
* enabling full transparency and citation capabilities.
|
|
100
|
-
*
|
|
101
|
-
* Use `search_mode` to specify what to search:
|
|
102
|
-
* - "sources" (default): Search over indexed documents
|
|
103
|
-
* - "memories": Search over user memories
|
|
104
|
-
*
|
|
105
|
-
* Use `mode` to control retrieval quality:
|
|
106
|
-
* - "fast" (default): Single query, faster response
|
|
107
|
-
* - "accurate": Multi-query generation with reranking, higher quality
|
|
108
|
-
*
|
|
109
75
|
* @param {CortexAI.QnASearchRequest} request
|
|
110
76
|
* @param {Search.RequestOptions} requestOptions - Request-specific configuration.
|
|
111
77
|
*
|
|
@@ -120,8 +86,8 @@ export declare class Search {
|
|
|
120
86
|
*
|
|
121
87
|
* @example
|
|
122
88
|
* await client.search.qna({
|
|
123
|
-
* tenant_id: "
|
|
124
|
-
* question: "
|
|
89
|
+
* tenant_id: "tenant_1234",
|
|
90
|
+
* question: "What is Cortex AI"
|
|
125
91
|
* })
|
|
126
92
|
*/
|
|
127
93
|
qna(request: CortexAI.QnASearchRequest, requestOptions?: Search.RequestOptions): core.HttpResponsePromise<CortexAI.QnASearchResponse>;
|
|
@@ -37,19 +37,6 @@ class Search {
|
|
|
37
37
|
this._options = _options;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* Search for relevant content within your indexed sources or user memories.
|
|
41
|
-
*
|
|
42
|
-
* Results are ranked by relevance and can be customized with parameters like
|
|
43
|
-
* result limits, alpha weighting, and recency preferences.
|
|
44
|
-
*
|
|
45
|
-
* Use `search_mode` to specify what to search:
|
|
46
|
-
* - "sources" (default): Search over indexed documents
|
|
47
|
-
* - "memories": Search over user memories (uses inferred content)
|
|
48
|
-
*
|
|
49
|
-
* Use `mode` to control retrieval quality:
|
|
50
|
-
* - "fast" (default): Single query, faster response
|
|
51
|
-
* - "accurate": Multi-query generation with reranking, higher quality
|
|
52
|
-
*
|
|
53
40
|
* @param {CortexAI.HybridSearchRequest} request
|
|
54
41
|
* @param {Search.RequestOptions} requestOptions - Request-specific configuration.
|
|
55
42
|
*
|
|
@@ -64,8 +51,8 @@ class Search {
|
|
|
64
51
|
*
|
|
65
52
|
* @example
|
|
66
53
|
* await client.search.retrieve({
|
|
67
|
-
* tenant_id: "
|
|
68
|
-
* query: "
|
|
54
|
+
* tenant_id: "tenant_1234",
|
|
55
|
+
* query: "Which mode does user prefer"
|
|
69
56
|
* })
|
|
70
57
|
*/
|
|
71
58
|
retrieve(request, requestOptions) {
|
|
@@ -75,7 +62,7 @@ class Search {
|
|
|
75
62
|
var _a, _b, _c;
|
|
76
63
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
77
64
|
const _response = await core.fetcher({
|
|
78
|
-
url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "
|
|
65
|
+
url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "recall/full_recall"),
|
|
79
66
|
method: "POST",
|
|
80
67
|
headers: _headers,
|
|
81
68
|
contentType: "application/json",
|
|
@@ -123,7 +110,7 @@ class Search {
|
|
|
123
110
|
rawResponse: _response.rawResponse,
|
|
124
111
|
});
|
|
125
112
|
case "timeout":
|
|
126
|
-
throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /
|
|
113
|
+
throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /recall/full_recall.");
|
|
127
114
|
case "unknown":
|
|
128
115
|
throw new errors.CortexAIError({
|
|
129
116
|
message: _response.error.errorMessage,
|
|
@@ -132,14 +119,6 @@ class Search {
|
|
|
132
119
|
}
|
|
133
120
|
}
|
|
134
121
|
/**
|
|
135
|
-
* Perform full text search for exact matches within your indexed sources or memories.
|
|
136
|
-
* Choose between 'OR' and 'AND' operators to control how search terms are combined
|
|
137
|
-
* for precise text matching.
|
|
138
|
-
*
|
|
139
|
-
* Use `search_mode` to specify what to search:
|
|
140
|
-
* - "sources" (default): Search over indexed documents
|
|
141
|
-
* - "memories": Search over user memories
|
|
142
|
-
*
|
|
143
122
|
* @param {CortexAI.FullTextSearchRequest} request
|
|
144
123
|
* @param {Search.RequestOptions} requestOptions - Request-specific configuration.
|
|
145
124
|
*
|
|
@@ -154,8 +133,8 @@ class Search {
|
|
|
154
133
|
*
|
|
155
134
|
* @example
|
|
156
135
|
* await client.search.fullTextSearch({
|
|
157
|
-
* tenant_id: "
|
|
158
|
-
* query: "
|
|
136
|
+
* tenant_id: "tenant_1234",
|
|
137
|
+
* query: "John Smith Jake"
|
|
159
138
|
* })
|
|
160
139
|
*/
|
|
161
140
|
fullTextSearch(request, requestOptions) {
|
|
@@ -165,7 +144,7 @@ class Search {
|
|
|
165
144
|
var _a, _b, _c;
|
|
166
145
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
167
146
|
const _response = await core.fetcher({
|
|
168
|
-
url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "
|
|
147
|
+
url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "recall/boolean_recall"),
|
|
169
148
|
method: "POST",
|
|
170
149
|
headers: _headers,
|
|
171
150
|
contentType: "application/json",
|
|
@@ -213,7 +192,7 @@ class Search {
|
|
|
213
192
|
rawResponse: _response.rawResponse,
|
|
214
193
|
});
|
|
215
194
|
case "timeout":
|
|
216
|
-
throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /
|
|
195
|
+
throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /recall/boolean_recall.");
|
|
217
196
|
case "unknown":
|
|
218
197
|
throw new errors.CortexAIError({
|
|
219
198
|
message: _response.error.errorMessage,
|
|
@@ -222,19 +201,6 @@ class Search {
|
|
|
222
201
|
}
|
|
223
202
|
}
|
|
224
203
|
/**
|
|
225
|
-
* Ask a question and get an AI-generated answer based on your indexed sources or memories.
|
|
226
|
-
*
|
|
227
|
-
* The response includes both the AI answer and the source chunks used to generate it,
|
|
228
|
-
* enabling full transparency and citation capabilities.
|
|
229
|
-
*
|
|
230
|
-
* Use `search_mode` to specify what to search:
|
|
231
|
-
* - "sources" (default): Search over indexed documents
|
|
232
|
-
* - "memories": Search over user memories
|
|
233
|
-
*
|
|
234
|
-
* Use `mode` to control retrieval quality:
|
|
235
|
-
* - "fast" (default): Single query, faster response
|
|
236
|
-
* - "accurate": Multi-query generation with reranking, higher quality
|
|
237
|
-
*
|
|
238
204
|
* @param {CortexAI.QnASearchRequest} request
|
|
239
205
|
* @param {Search.RequestOptions} requestOptions - Request-specific configuration.
|
|
240
206
|
*
|
|
@@ -249,8 +215,8 @@ class Search {
|
|
|
249
215
|
*
|
|
250
216
|
* @example
|
|
251
217
|
* await client.search.qna({
|
|
252
|
-
* tenant_id: "
|
|
253
|
-
* question: "
|
|
218
|
+
* tenant_id: "tenant_1234",
|
|
219
|
+
* question: "What is Cortex AI"
|
|
254
220
|
* })
|
|
255
221
|
*/
|
|
256
222
|
qna(request, requestOptions) {
|
|
@@ -260,7 +226,7 @@ class Search {
|
|
|
260
226
|
var _a, _b, _c;
|
|
261
227
|
let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
262
228
|
const _response = await core.fetcher({
|
|
263
|
-
url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "
|
|
229
|
+
url: core.url.join((_c = (_b = (await core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (await core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CortexAIEnvironment.CortexProd, "recall/qna"),
|
|
264
230
|
method: "POST",
|
|
265
231
|
headers: _headers,
|
|
266
232
|
contentType: "application/json",
|
|
@@ -308,7 +274,7 @@ class Search {
|
|
|
308
274
|
rawResponse: _response.rawResponse,
|
|
309
275
|
});
|
|
310
276
|
case "timeout":
|
|
311
|
-
throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /
|
|
277
|
+
throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /recall/qna.");
|
|
312
278
|
case "unknown":
|
|
313
279
|
throw new errors.CortexAIError({
|
|
314
280
|
message: _response.error.errorMessage,
|
|
@@ -5,8 +5,8 @@ import * as CortexAI from "../../../../index.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
* tenant_id: "
|
|
9
|
-
* query: "
|
|
8
|
+
* tenant_id: "tenant_1234",
|
|
9
|
+
* query: "John Smith Jake"
|
|
10
10
|
* }
|
|
11
11
|
*/
|
|
12
12
|
export interface FullTextSearchRequest {
|
|
@@ -19,7 +19,7 @@ export interface FullTextSearchRequest {
|
|
|
19
19
|
/** How to combine search terms (OR or AND) */
|
|
20
20
|
operator?: CortexAI.Bm25OperatorType;
|
|
21
21
|
/** Maximum number of results to return */
|
|
22
|
-
|
|
22
|
+
max_results?: number;
|
|
23
23
|
/** What to search: 'sources' for documents or 'memories' for user memories */
|
|
24
24
|
search_mode?: CortexAI.SearchMode;
|
|
25
25
|
}
|
|
@@ -5,8 +5,8 @@ import * as CortexAI from "../../../../index.js";
|
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
* tenant_id: "
|
|
9
|
-
* query: "
|
|
8
|
+
* tenant_id: "tenant_1234",
|
|
9
|
+
* query: "Which mode does user prefer"
|
|
10
10
|
* }
|
|
11
11
|
*/
|
|
12
12
|
export interface HybridSearchRequest {
|
|
@@ -17,23 +17,23 @@ export interface HybridSearchRequest {
|
|
|
17
17
|
/** Search terms to find relevant content */
|
|
18
18
|
query: string;
|
|
19
19
|
/** Maximum number of results to return */
|
|
20
|
-
|
|
20
|
+
max_results?: number;
|
|
21
21
|
/** Retrieval mode to use ('fast' or 'accurate') */
|
|
22
22
|
mode?: CortexAI.RetrieveMode;
|
|
23
23
|
/** Search ranking algorithm parameter (0.0-1.0 or 'auto') */
|
|
24
24
|
alpha?: HybridSearchRequest.Alpha;
|
|
25
25
|
/** Preference for newer content (0.0 = no bias, 1.0 = strong recency preference) */
|
|
26
26
|
recency_bias?: number;
|
|
27
|
-
/** Number of related content chunks to include */
|
|
28
|
-
num_related_chunks?: number;
|
|
29
27
|
/** Enable personalized search results based on user preferences */
|
|
30
|
-
|
|
28
|
+
personalise_recall?: boolean;
|
|
31
29
|
/** Enable graph context for search results */
|
|
32
30
|
graph_context?: boolean;
|
|
33
31
|
/** Additional context provided by the user to guide retrieval */
|
|
34
|
-
|
|
32
|
+
additional_context?: string;
|
|
35
33
|
/** What to search: 'sources' for documents or 'memories' for user memories */
|
|
36
34
|
search_mode?: CortexAI.SearchMode;
|
|
35
|
+
/** Optional key-value pairs to filter search results by tenant metadata fields. Keys must match fields defined in tenant_metadata_schema during tenant creation. Supports exact match filtering on indexed metadata fields. Example: {'category': 'engineering', 'priority': 'high'} */
|
|
36
|
+
metadata_filters?: Record<string, unknown>;
|
|
37
37
|
}
|
|
38
38
|
export declare namespace HybridSearchRequest {
|
|
39
39
|
/**
|