@usecortex_ai/node 0.2.1 → 0.3.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.
Files changed (79) hide show
  1. package/README.md +6 -18
  2. package/dist/Client.d.ts +14 -5
  3. package/dist/Client.js +68 -12
  4. package/dist/api/resources/document/client/Client.d.ts +5 -5
  5. package/dist/api/resources/document/client/Client.js +8 -4
  6. package/dist/api/resources/embeddings/client/Client.d.ts +9 -9
  7. package/dist/api/resources/embeddings/client/Client.js +16 -12
  8. package/dist/api/resources/embeddings/client/requests/EmbeddingsCreateCollectionRequest.d.ts +1 -1
  9. package/dist/api/resources/embeddings/client/requests/EmbeddingsDeleteRequest.d.ts +3 -3
  10. package/dist/api/resources/embeddings/client/requests/EmbeddingsSearchRequest.d.ts +2 -2
  11. package/dist/api/resources/embeddings/client/requests/GetEmbeddingsBasedOnChunkIdsRequest.d.ts +3 -3
  12. package/dist/api/resources/fetch/client/Client.d.ts +6 -6
  13. package/dist/api/resources/fetch/client/Client.js +9 -5
  14. package/dist/api/resources/fetch/client/requests/FetchContentRequest.d.ts +3 -8
  15. package/dist/api/resources/index.d.ts +1 -1
  16. package/dist/api/resources/index.js +2 -2
  17. package/dist/api/resources/search/client/Client.d.ts +11 -11
  18. package/dist/api/resources/search/client/Client.js +14 -10
  19. package/dist/api/resources/search/client/requests/FullTextSearchRequest.d.ts +3 -3
  20. package/dist/api/resources/search/client/requests/QnARequest.d.ts +3 -3
  21. package/dist/api/resources/search/client/requests/SearchRequest.d.ts +5 -3
  22. package/dist/api/resources/sources/client/Client.d.ts +7 -6
  23. package/dist/api/resources/sources/client/Client.js +10 -5
  24. package/dist/api/resources/sources/client/requests/SourceBodyParams.d.ts +6 -2
  25. package/dist/api/resources/sources/client/requests/SourcesGetAllRequest.d.ts +3 -2
  26. package/dist/api/resources/tenant/client/Client.d.ts +8 -7
  27. package/dist/api/resources/tenant/client/Client.js +11 -6
  28. package/dist/api/resources/tenant/client/requests/TenantDeleteSubTenantRequest.d.ts +2 -2
  29. package/dist/api/resources/tenant/client/requests/TenantGetSubTenantIdsRequest.d.ts +1 -1
  30. package/dist/api/resources/tenant/client/requests/TenantStatsRequest.d.ts +3 -2
  31. package/dist/api/resources/upload/client/Client.d.ts +47 -32
  32. package/dist/api/resources/upload/client/Client.js +56 -31
  33. package/dist/api/resources/upload/client/requests/BodyBatchUpdateUploadBatchUpdatePatch.d.ts +3 -2
  34. package/dist/api/resources/upload/client/requests/BodyBatchUploadUploadBatchUploadPost.d.ts +5 -2
  35. package/dist/api/resources/upload/client/requests/BodyUpdateFileUploadUpdateDocumentPatch.d.ts +4 -3
  36. package/dist/api/resources/upload/client/requests/BodyUploadFilesUploadUploadDocumentPost.d.ts +5 -2
  37. package/dist/api/resources/upload/client/requests/EmbeddingsUpdateRequest.d.ts +3 -2
  38. package/dist/api/resources/upload/client/requests/EmbeddingsUploadRequest.d.ts +4 -3
  39. package/dist/api/resources/upload/client/requests/UploadScrapeWebpageRequest.d.ts +5 -3
  40. package/dist/api/resources/upload/client/requests/UploadUpdateMarkdownRequest.d.ts +5 -4
  41. package/dist/api/resources/upload/client/requests/UploadUpdateTextRequest.d.ts +5 -4
  42. package/dist/api/resources/upload/client/requests/UploadUpdateWebpageRequest.d.ts +5 -4
  43. package/dist/api/resources/upload/client/requests/UploadUploadAppSourcesRequest.d.ts +3 -2
  44. package/dist/api/resources/upload/client/requests/UploadUploadMarkdownRequest.d.ts +4 -3
  45. package/dist/api/resources/upload/client/requests/UploadUploadTextRequest.d.ts +4 -3
  46. package/dist/api/resources/upload/client/requests/UploadVerifyProcessingRequest.d.ts +2 -1
  47. package/dist/api/resources/user/client/Client.d.ts +6 -4
  48. package/dist/api/resources/user/client/Client.js +13 -4
  49. package/dist/api/resources/user/client/requests/BodyCreateTenantUserCreateTenantPost.d.ts +4 -1
  50. package/dist/api/resources/userMemory/client/Client.d.ts +19 -13
  51. package/dist/api/resources/userMemory/client/Client.js +22 -12
  52. package/dist/api/resources/userMemory/client/requests/AddUserMemoryRequest.d.ts +4 -3
  53. package/dist/api/resources/userMemory/client/requests/GenerateUserMemoryRequest.d.ts +6 -5
  54. package/dist/api/resources/userMemory/client/requests/RetrieveUserMemoryRequest.d.ts +7 -3
  55. package/dist/api/resources/userMemory/client/requests/UserMemoryDeleteUserMemoryRequest.d.ts +4 -3
  56. package/dist/api/resources/userMemory/client/requests/UserMemoryListUserMemoriesRequest.d.ts +3 -2
  57. package/dist/api/types/DeleteMemoryRequest.d.ts +1 -1
  58. package/dist/api/types/MarkdownUploadRequest.d.ts +2 -0
  59. package/dist/api/types/SubTenantIdsData.d.ts +2 -0
  60. package/dist/api/types/TenantStats.d.ts +2 -2
  61. package/package.json +1 -1
  62. package/dist/api/resources/sources/client/requests/SourcesGetSubTenantIdsRequest.d.ts +0 -12
  63. package/dist/api/resources/sources/client/requests/SourcesGetSubTenantIdsRequest.js +0 -5
  64. package/dist/api/resources/upload/client/requests/BodyUpdateMarkdownUploadUpdateMarkdownPatch.d.ts +0 -21
  65. package/dist/api/resources/upload/client/requests/BodyUpdateMarkdownUploadUpdateMarkdownPatch.js +0 -5
  66. package/dist/api/resources/upload/client/requests/BodyUpdateMarkdownUploadUpdateTextPatch.d.ts +0 -21
  67. package/dist/api/resources/upload/client/requests/BodyUpdateMarkdownUploadUpdateTextPatch.js +0 -5
  68. package/dist/api/resources/upload/client/requests/BodyUploadMarkdownUploadUploadMarkdownPost.d.ts +0 -19
  69. package/dist/api/resources/upload/client/requests/BodyUploadMarkdownUploadUploadMarkdownPost.js +0 -5
  70. package/dist/api/resources/upload/client/requests/BodyUploadMarkdownUploadUploadTextPost.d.ts +0 -19
  71. package/dist/api/resources/upload/client/requests/BodyUploadMarkdownUploadUploadTextPost.js +0 -5
  72. package/dist/api/resources/userMemory/client/requests/UserMemoryAddUserMemoryRequest.d.ts +0 -16
  73. package/dist/api/resources/userMemory/client/requests/UserMemoryAddUserMemoryRequest.js +0 -5
  74. package/dist/api/resources/userMemory/client/requests/UserMemoryGenerateUserMemoryRequest.d.ts +0 -18
  75. package/dist/api/resources/userMemory/client/requests/UserMemoryGenerateUserMemoryRequest.js +0 -5
  76. package/dist/api/resources/userMemory/client/requests/UserMemoryRetrieveUserMemoryRequest.d.ts +0 -17
  77. package/dist/api/resources/userMemory/client/requests/UserMemoryRetrieveUserMemoryRequest.js +0 -5
  78. package/dist/api/types/SourceContent.d.ts +0 -11
  79. package/dist/api/types/SourceContent.js +0 -5
package/README.md CHANGED
@@ -2,27 +2,15 @@
2
2
 
3
3
  The official TypeScript SDK for the Cortex AI platform. Build powerful, context-aware AI applications in your Node.js or TypeScript projects.
4
4
 
5
- * **Homepage:** [usecortex.ai](https://www.usecortex.ai/ "null")
6
- * **Documentation:** [docs.usecortex.ai](https://docs.usecortex.ai/ "null")
5
+ ## Links
7
6
 
8
- ## Getting Started
9
-
10
- To use the SDK, you'll need an API key from your Cortex AI dashboard.
11
-
12
- ### Initialize the Client
7
+ - **Homepage:** [usecortex.ai](https://www.usecortex.ai/)
8
+ - **Documentation:** [docs.usecortex.ai](https://docs.usecortex.ai/)
13
9
 
14
- Initialize the client with your API key. It's recommended to use an environment variable for security.
15
-
16
- ```
17
- import { CortexAI } from "@usecortex/ai";
18
-
19
- const client = new CortexAI({
20
- // Defaults to process.env.CORTEX_API_KEY
21
- apiKey: "YOUR_API_KEY",
22
- });
10
+ ## Getting Started
23
11
 
24
- ```
12
+ Please refer to our [SDK documentation](https://docs.usecortex.ai/api-reference/sdks) and [API reference](https://docs.usecortex.ai/api-reference/introduction) to get started.
25
13
 
26
14
  ## Support
27
15
 
28
- If you have any questions or need help, please reach out to our support team at [founders@usecortex.ai](mailto:founders@usecortex.ai "null").
16
+ If you have any questions or need help, please reach out to our support team at [founders@usecortex.ai](mailto:founders@usecortex.ai).
package/dist/Client.d.ts CHANGED
@@ -8,16 +8,16 @@ import { Sources } from "./api/resources/sources/client/Client.js";
8
8
  import { UserMemory } from "./api/resources/userMemory/client/Client.js";
9
9
  import { Fetch } from "./api/resources/fetch/client/Client.js";
10
10
  import { Upload } from "./api/resources/upload/client/Client.js";
11
- import { Document } from "./api/resources/document/client/Client.js";
12
11
  import { Embeddings } from "./api/resources/embeddings/client/Client.js";
13
12
  import { User } from "./api/resources/user/client/Client.js";
14
13
  import { Tenant } from "./api/resources/tenant/client/Client.js";
14
+ import { Document } from "./api/resources/document/client/Client.js";
15
15
  export declare namespace CortexAIClient {
16
16
  interface Options {
17
17
  environment?: core.Supplier<environments.CortexAIEnvironment | string>;
18
18
  /** Specify a custom URL to connect the client to. */
19
19
  baseUrl?: core.Supplier<string>;
20
- token: core.Supplier<core.BearerToken>;
20
+ token?: core.Supplier<core.BearerToken | undefined>;
21
21
  /** Additional headers to include in requests. */
22
22
  headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
23
23
  }
@@ -41,18 +41,27 @@ export declare class CortexAIClient {
41
41
  protected _userMemory: UserMemory | undefined;
42
42
  protected _fetch: Fetch | undefined;
43
43
  protected _upload: Upload | undefined;
44
- protected _document: Document | undefined;
45
44
  protected _embeddings: Embeddings | undefined;
46
45
  protected _user: User | undefined;
47
46
  protected _tenant: Tenant | undefined;
48
- constructor(_options: CortexAIClient.Options);
47
+ protected _document: Document | undefined;
48
+ constructor(_options?: CortexAIClient.Options);
49
49
  get search(): Search;
50
50
  get sources(): Sources;
51
51
  get userMemory(): UserMemory;
52
52
  get fetch(): Fetch;
53
53
  get upload(): Upload;
54
- get document(): Document;
55
54
  get embeddings(): Embeddings;
56
55
  get user(): User;
57
56
  get tenant(): Tenant;
57
+ get document(): Document;
58
+ /**
59
+ * @param {CortexAIClient.RequestOptions} requestOptions - Request-specific configuration.
60
+ *
61
+ * @example
62
+ * await client.rootGet()
63
+ */
64
+ rootGet(requestOptions?: CortexAIClient.RequestOptions): core.HttpResponsePromise<unknown>;
65
+ private __rootGet;
66
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
58
67
  }
package/dist/Client.js CHANGED
@@ -27,19 +27,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.CortexAIClient = void 0;
30
+ const environments = __importStar(require("./environments.js"));
30
31
  const core = __importStar(require("./core/index.js"));
31
32
  const headers_js_1 = require("./core/headers.js");
33
+ const errors = __importStar(require("./errors/index.js"));
32
34
  const Client_js_1 = require("./api/resources/search/client/Client.js");
33
35
  const Client_js_2 = require("./api/resources/sources/client/Client.js");
34
36
  const Client_js_3 = require("./api/resources/userMemory/client/Client.js");
35
37
  const Client_js_4 = require("./api/resources/fetch/client/Client.js");
36
38
  const Client_js_5 = require("./api/resources/upload/client/Client.js");
37
- const Client_js_6 = require("./api/resources/document/client/Client.js");
38
- const Client_js_7 = require("./api/resources/embeddings/client/Client.js");
39
- const Client_js_8 = require("./api/resources/user/client/Client.js");
40
- const Client_js_9 = require("./api/resources/tenant/client/Client.js");
39
+ const Client_js_6 = require("./api/resources/embeddings/client/Client.js");
40
+ const Client_js_7 = require("./api/resources/user/client/Client.js");
41
+ const Client_js_8 = require("./api/resources/tenant/client/Client.js");
42
+ const Client_js_9 = require("./api/resources/document/client/Client.js");
41
43
  class CortexAIClient {
42
- constructor(_options) {
44
+ constructor(_options = {}) {
43
45
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
44
46
  "X-Fern-Language": "JavaScript",
45
47
  "X-Fern-Runtime": core.RUNTIME.type,
@@ -66,21 +68,75 @@ class CortexAIClient {
66
68
  var _a;
67
69
  return ((_a = this._upload) !== null && _a !== void 0 ? _a : (this._upload = new Client_js_5.Upload(this._options)));
68
70
  }
69
- get document() {
70
- var _a;
71
- return ((_a = this._document) !== null && _a !== void 0 ? _a : (this._document = new Client_js_6.Document(this._options)));
72
- }
73
71
  get embeddings() {
74
72
  var _a;
75
- return ((_a = this._embeddings) !== null && _a !== void 0 ? _a : (this._embeddings = new Client_js_7.Embeddings(this._options)));
73
+ return ((_a = this._embeddings) !== null && _a !== void 0 ? _a : (this._embeddings = new Client_js_6.Embeddings(this._options)));
76
74
  }
77
75
  get user() {
78
76
  var _a;
79
- return ((_a = this._user) !== null && _a !== void 0 ? _a : (this._user = new Client_js_8.User(this._options)));
77
+ return ((_a = this._user) !== null && _a !== void 0 ? _a : (this._user = new Client_js_7.User(this._options)));
80
78
  }
81
79
  get tenant() {
82
80
  var _a;
83
- return ((_a = this._tenant) !== null && _a !== void 0 ? _a : (this._tenant = new Client_js_9.Tenant(this._options)));
81
+ return ((_a = this._tenant) !== null && _a !== void 0 ? _a : (this._tenant = new Client_js_8.Tenant(this._options)));
82
+ }
83
+ get document() {
84
+ var _a;
85
+ return ((_a = this._document) !== null && _a !== void 0 ? _a : (this._document = new Client_js_9.Document(this._options)));
86
+ }
87
+ /**
88
+ * @param {CortexAIClient.RequestOptions} requestOptions - Request-specific configuration.
89
+ *
90
+ * @example
91
+ * await client.rootGet()
92
+ */
93
+ rootGet(requestOptions) {
94
+ return core.HttpResponsePromise.fromPromise(this.__rootGet(requestOptions));
95
+ }
96
+ async __rootGet(requestOptions) {
97
+ var _a, _b, _c;
98
+ 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);
99
+ const _response = await core.fetcher({
100
+ url: (_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,
101
+ method: "GET",
102
+ headers: _headers,
103
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
104
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
105
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
106
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
107
+ });
108
+ if (_response.ok) {
109
+ return { data: _response.body, rawResponse: _response.rawResponse };
110
+ }
111
+ if (_response.error.reason === "status-code") {
112
+ throw new errors.CortexAIError({
113
+ statusCode: _response.error.statusCode,
114
+ body: _response.error.body,
115
+ rawResponse: _response.rawResponse,
116
+ });
117
+ }
118
+ switch (_response.error.reason) {
119
+ case "non-json":
120
+ throw new errors.CortexAIError({
121
+ statusCode: _response.error.statusCode,
122
+ body: _response.error.rawBody,
123
+ rawResponse: _response.rawResponse,
124
+ });
125
+ case "timeout":
126
+ throw new errors.CortexAITimeoutError("Timeout exceeded when calling GET /.");
127
+ case "unknown":
128
+ throw new errors.CortexAIError({
129
+ message: _response.error.errorMessage,
130
+ rawResponse: _response.rawResponse,
131
+ });
132
+ }
133
+ }
134
+ async _getAuthorizationHeader() {
135
+ const bearer = await core.Supplier.get(this._options.token);
136
+ if (bearer != null) {
137
+ return `Bearer ${bearer}`;
138
+ }
139
+ return undefined;
84
140
  }
85
141
  }
86
142
  exports.CortexAIClient = CortexAIClient;
@@ -9,7 +9,7 @@ export declare namespace Document {
9
9
  environment?: core.Supplier<environments.CortexAIEnvironment | string>;
10
10
  /** Specify a custom URL to connect the client to. */
11
11
  baseUrl?: core.Supplier<string>;
12
- token: core.Supplier<core.BearerToken>;
12
+ token?: core.Supplier<core.BearerToken | undefined>;
13
13
  /** Additional headers to include in requests. */
14
14
  headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
15
  }
@@ -28,7 +28,7 @@ export declare namespace Document {
28
28
  }
29
29
  export declare class Document {
30
30
  protected readonly _options: Document.Options;
31
- constructor(_options: Document.Options);
31
+ constructor(_options?: Document.Options);
32
32
  /**
33
33
  * Remove documents and content from your knowledge base.
34
34
  *
@@ -49,11 +49,11 @@ export declare class Document {
49
49
  *
50
50
  * @example
51
51
  * await client.document.delete({
52
- * tenant_id: "tenant_id",
53
- * source_ids: ["source_ids"]
52
+ * tenant_id: "tenant_1234",
53
+ * source_ids: ["CortexDoc1234", "CortexDoc4567"]
54
54
  * })
55
55
  */
56
56
  delete(request: CortexAI.DeleteMemoryRequest, requestOptions?: Document.RequestOptions): core.HttpResponsePromise<CortexAI.DeleteSources>;
57
57
  private __delete;
58
- protected _getAuthorizationHeader(): Promise<string>;
58
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
59
59
  }
@@ -33,7 +33,7 @@ const CortexAI = __importStar(require("../../../index.js"));
33
33
  const headers_js_1 = require("../../../../core/headers.js");
34
34
  const errors = __importStar(require("../../../../errors/index.js"));
35
35
  class Document {
36
- constructor(_options) {
36
+ constructor(_options = {}) {
37
37
  this._options = _options;
38
38
  }
39
39
  /**
@@ -56,8 +56,8 @@ class Document {
56
56
  *
57
57
  * @example
58
58
  * await client.document.delete({
59
- * tenant_id: "tenant_id",
60
- * source_ids: ["source_ids"]
59
+ * tenant_id: "tenant_1234",
60
+ * source_ids: ["CortexDoc1234", "CortexDoc4567"]
61
61
  * })
62
62
  */
63
63
  delete(request, requestOptions) {
@@ -122,7 +122,11 @@ class Document {
122
122
  }
123
123
  }
124
124
  async _getAuthorizationHeader() {
125
- return `Bearer ${await core.Supplier.get(this._options.token)}`;
125
+ const bearer = await core.Supplier.get(this._options.token);
126
+ if (bearer != null) {
127
+ return `Bearer ${bearer}`;
128
+ }
129
+ return undefined;
126
130
  }
127
131
  }
128
132
  exports.Document = Document;
@@ -9,7 +9,7 @@ export declare namespace Embeddings {
9
9
  environment?: core.Supplier<environments.CortexAIEnvironment | string>;
10
10
  /** Specify a custom URL to connect the client to. */
11
11
  baseUrl?: core.Supplier<string>;
12
- token: core.Supplier<core.BearerToken>;
12
+ token?: core.Supplier<core.BearerToken | undefined>;
13
13
  /** Additional headers to include in requests. */
14
14
  headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
15
  }
@@ -28,7 +28,7 @@ export declare namespace Embeddings {
28
28
  }
29
29
  export declare class Embeddings {
30
30
  protected readonly _options: Embeddings.Options;
31
- constructor(_options: Embeddings.Options);
31
+ constructor(_options?: Embeddings.Options);
32
32
  /**
33
33
  * Delete embedding chunks by chunk ID.
34
34
  *
@@ -47,8 +47,8 @@ export declare class Embeddings {
47
47
  *
48
48
  * @example
49
49
  * await client.embeddings.delete({
50
- * chunk_ids: ["chunk_ids"],
51
- * tenant_id: "tenant_id"
50
+ * chunk_ids: ["CortexEmbeddings123_0", "CortexEmbeddings123_1"],
51
+ * tenant_id: "tenant_1234"
52
52
  * })
53
53
  */
54
54
  delete(request: CortexAI.EmbeddingsDeleteRequest, requestOptions?: Embeddings.RequestOptions): core.HttpResponsePromise<CortexAI.EmbeddingsDeleteData>;
@@ -75,7 +75,7 @@ export declare class Embeddings {
75
75
  *
76
76
  * @example
77
77
  * await client.embeddings.search({
78
- * tenant_id: "tenant_id"
78
+ * tenant_id: "tenant_1234"
79
79
  * })
80
80
  */
81
81
  search(request: CortexAI.EmbeddingsSearchRequest, requestOptions?: Embeddings.RequestOptions): core.HttpResponsePromise<CortexAI.EmbeddingsSearchData>;
@@ -98,8 +98,8 @@ export declare class Embeddings {
98
98
  *
99
99
  * @example
100
100
  * await client.embeddings.getByChunkIds({
101
- * chunk_ids: ["chunk_ids"],
102
- * tenant_id: "tenant_id"
101
+ * chunk_ids: ["CortexEmbeddings123_0", "CortexEmbeddings123_1"],
102
+ * tenant_id: "tenant_1234"
103
103
  * })
104
104
  */
105
105
  getByChunkIds(request: CortexAI.GetEmbeddingsBasedOnChunkIdsRequest, requestOptions?: Embeddings.RequestOptions): core.HttpResponsePromise<CortexAI.EmbeddingsGetData>;
@@ -122,10 +122,10 @@ export declare class Embeddings {
122
122
  *
123
123
  * @example
124
124
  * await client.embeddings.createCollection({
125
- * tenant_id: "tenant_id"
125
+ * tenant_id: "tenant_1234"
126
126
  * })
127
127
  */
128
128
  createCollection(request: CortexAI.EmbeddingsCreateCollectionRequest, requestOptions?: Embeddings.RequestOptions): core.HttpResponsePromise<CortexAI.EmbeddingsCreateCollectionData>;
129
129
  private __createCollection;
130
- protected _getAuthorizationHeader(): Promise<string>;
130
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
131
131
  }
@@ -33,7 +33,7 @@ const CortexAI = __importStar(require("../../../index.js"));
33
33
  const headers_js_1 = require("../../../../core/headers.js");
34
34
  const errors = __importStar(require("../../../../errors/index.js"));
35
35
  class Embeddings {
36
- constructor(_options) {
36
+ constructor(_options = {}) {
37
37
  this._options = _options;
38
38
  }
39
39
  /**
@@ -54,8 +54,8 @@ class Embeddings {
54
54
  *
55
55
  * @example
56
56
  * await client.embeddings.delete({
57
- * chunk_ids: ["chunk_ids"],
58
- * tenant_id: "tenant_id"
57
+ * chunk_ids: ["CortexEmbeddings123_0", "CortexEmbeddings123_1"],
58
+ * tenant_id: "tenant_1234"
59
59
  * })
60
60
  */
61
61
  delete(request, requestOptions) {
@@ -141,7 +141,7 @@ class Embeddings {
141
141
  *
142
142
  * @example
143
143
  * await client.embeddings.search({
144
- * tenant_id: "tenant_id"
144
+ * tenant_id: "tenant_1234"
145
145
  * })
146
146
  */
147
147
  search(request, requestOptions) {
@@ -223,8 +223,8 @@ class Embeddings {
223
223
  *
224
224
  * @example
225
225
  * await client.embeddings.getByChunkIds({
226
- * chunk_ids: ["chunk_ids"],
227
- * tenant_id: "tenant_id"
226
+ * chunk_ids: ["CortexEmbeddings123_0", "CortexEmbeddings123_1"],
227
+ * tenant_id: "tenant_1234"
228
228
  * })
229
229
  */
230
230
  getByChunkIds(request, requestOptions) {
@@ -234,7 +234,7 @@ class Embeddings {
234
234
  var _a, _b, _c;
235
235
  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);
236
236
  const _response = await core.fetcher({
237
- 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, "embeddings/by-chunk-ids"),
237
+ 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, "embeddings/retrieve_by_ids"),
238
238
  method: "POST",
239
239
  headers: _headers,
240
240
  contentType: "application/json",
@@ -280,7 +280,7 @@ class Embeddings {
280
280
  rawResponse: _response.rawResponse,
281
281
  });
282
282
  case "timeout":
283
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /embeddings/by-chunk-ids.");
283
+ throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /embeddings/retrieve_by_ids.");
284
284
  case "unknown":
285
285
  throw new errors.CortexAIError({
286
286
  message: _response.error.errorMessage,
@@ -306,7 +306,7 @@ class Embeddings {
306
306
  *
307
307
  * @example
308
308
  * await client.embeddings.createCollection({
309
- * tenant_id: "tenant_id"
309
+ * tenant_id: "tenant_1234"
310
310
  * })
311
311
  */
312
312
  createCollection(request, requestOptions) {
@@ -319,7 +319,7 @@ class Embeddings {
319
319
  _queryParams["tenant_id"] = tenantId;
320
320
  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);
321
321
  const _response = await core.fetcher({
322
- 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, "embeddings/create_embeddings_tenant"),
322
+ 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, "embeddings/create_tenant"),
323
323
  method: "POST",
324
324
  headers: _headers,
325
325
  queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
@@ -365,7 +365,7 @@ class Embeddings {
365
365
  rawResponse: _response.rawResponse,
366
366
  });
367
367
  case "timeout":
368
- throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /embeddings/create_embeddings_tenant.");
368
+ throw new errors.CortexAITimeoutError("Timeout exceeded when calling POST /embeddings/create_tenant.");
369
369
  case "unknown":
370
370
  throw new errors.CortexAIError({
371
371
  message: _response.error.errorMessage,
@@ -374,7 +374,11 @@ class Embeddings {
374
374
  }
375
375
  }
376
376
  async _getAuthorizationHeader() {
377
- return `Bearer ${await core.Supplier.get(this._options.token)}`;
377
+ const bearer = await core.Supplier.get(this._options.token);
378
+ if (bearer != null) {
379
+ return `Bearer ${bearer}`;
380
+ }
381
+ return undefined;
378
382
  }
379
383
  }
380
384
  exports.Embeddings = Embeddings;
@@ -4,7 +4,7 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * tenant_id: "tenant_id"
7
+ * tenant_id: "tenant_1234"
8
8
  * }
9
9
  */
10
10
  export interface EmbeddingsCreateCollectionRequest {
@@ -4,8 +4,8 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * chunk_ids: ["chunk_ids"],
8
- * tenant_id: "tenant_id"
7
+ * chunk_ids: ["CortexEmbeddings123_0", "CortexEmbeddings123_1"],
8
+ * tenant_id: "tenant_1234"
9
9
  * }
10
10
  */
11
11
  export interface EmbeddingsDeleteRequest {
@@ -13,6 +13,6 @@ export interface EmbeddingsDeleteRequest {
13
13
  chunk_ids: string[];
14
14
  /** Unique identifier for the tenant/organization */
15
15
  tenant_id: string;
16
- /** Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id */
16
+ /** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
17
17
  sub_tenant_id?: string;
18
18
  }
@@ -4,7 +4,7 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * tenant_id: "tenant_id"
7
+ * tenant_id: "tenant_1234"
8
8
  * }
9
9
  */
10
10
  export interface EmbeddingsSearchRequest {
@@ -12,7 +12,7 @@ export interface EmbeddingsSearchRequest {
12
12
  tenant_id: string;
13
13
  /** The embedding vector for search */
14
14
  embeddings?: number[];
15
- /** Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id */
15
+ /** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
16
16
  sub_tenant_id?: string;
17
17
  max_chunks?: number;
18
18
  }
@@ -4,8 +4,8 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * chunk_ids: ["chunk_ids"],
8
- * tenant_id: "tenant_id"
7
+ * chunk_ids: ["CortexEmbeddings123_0", "CortexEmbeddings123_1"],
8
+ * tenant_id: "tenant_1234"
9
9
  * }
10
10
  */
11
11
  export interface GetEmbeddingsBasedOnChunkIdsRequest {
@@ -13,6 +13,6 @@ export interface GetEmbeddingsBasedOnChunkIdsRequest {
13
13
  chunk_ids: string[];
14
14
  /** Unique identifier for the tenant/organization */
15
15
  tenant_id: string;
16
- /** Optional sub-tenant identifier for organizing data within a tenant. If not provided, defaults to tenant_id */
16
+ /** Optional sub-tenant identifier used to organize data within a tenant. If omitted, the default sub-tenant created during tenant setup will be used. */
17
17
  sub_tenant_id?: string;
18
18
  }
@@ -9,7 +9,7 @@ export declare namespace Fetch {
9
9
  environment?: core.Supplier<environments.CortexAIEnvironment | string>;
10
10
  /** Specify a custom URL to connect the client to. */
11
11
  baseUrl?: core.Supplier<string>;
12
- token: core.Supplier<core.BearerToken>;
12
+ token?: core.Supplier<core.BearerToken | undefined>;
13
13
  /** Additional headers to include in requests. */
14
14
  headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
15
15
  }
@@ -28,7 +28,7 @@ export declare namespace Fetch {
28
28
  }
29
29
  export declare class Fetch {
30
30
  protected readonly _options: Fetch.Options;
31
- constructor(_options: Fetch.Options);
31
+ constructor(_options?: Fetch.Options);
32
32
  /**
33
33
  * @param {CortexAI.FetchContentRequest} request
34
34
  * @param {Fetch.RequestOptions} requestOptions - Request-specific configuration.
@@ -43,12 +43,12 @@ export declare class Fetch {
43
43
  *
44
44
  * @example
45
45
  * await client.fetch.fetchContent({
46
- * file_id: "file_id",
47
- * file_type: "file_type",
48
- * tenant_id: "tenant_id"
46
+ * file_id: "CortexDoc1234",
47
+ * file_type: "<file_type>",
48
+ * tenant_id: "tenant_1234"
49
49
  * })
50
50
  */
51
51
  fetchContent(request: CortexAI.FetchContentRequest, requestOptions?: Fetch.RequestOptions): core.HttpResponsePromise<CortexAI.FetchContentData>;
52
52
  private __fetchContent;
53
- protected _getAuthorizationHeader(): Promise<string>;
53
+ protected _getAuthorizationHeader(): Promise<string | undefined>;
54
54
  }
@@ -33,7 +33,7 @@ const CortexAI = __importStar(require("../../../index.js"));
33
33
  const headers_js_1 = require("../../../../core/headers.js");
34
34
  const errors = __importStar(require("../../../../errors/index.js"));
35
35
  class Fetch {
36
- constructor(_options) {
36
+ constructor(_options = {}) {
37
37
  this._options = _options;
38
38
  }
39
39
  /**
@@ -50,9 +50,9 @@ class Fetch {
50
50
  *
51
51
  * @example
52
52
  * await client.fetch.fetchContent({
53
- * file_id: "file_id",
54
- * file_type: "file_type",
55
- * tenant_id: "tenant_id"
53
+ * file_id: "CortexDoc1234",
54
+ * file_type: "<file_type>",
55
+ * tenant_id: "tenant_1234"
56
56
  * })
57
57
  */
58
58
  fetchContent(request, requestOptions) {
@@ -117,7 +117,11 @@ class Fetch {
117
117
  }
118
118
  }
119
119
  async _getAuthorizationHeader() {
120
- return `Bearer ${await core.Supplier.get(this._options.token)}`;
120
+ const bearer = await core.Supplier.get(this._options.token);
121
+ if (bearer != null) {
122
+ return `Bearer ${bearer}`;
123
+ }
124
+ return undefined;
121
125
  }
122
126
  }
123
127
  exports.Fetch = Fetch;
@@ -4,20 +4,15 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * file_id: "file_id",
8
- * file_type: "file_type",
9
- * tenant_id: "tenant_id"
7
+ * file_id: "CortexDoc1234",
8
+ * file_type: "<file_type>",
9
+ * tenant_id: "tenant_1234"
10
10
  * }
11
11
  */
12
12
  export interface FetchContentRequest {
13
- /** Unique identifier for the file to fetch */
14
13
  file_id: string;
15
- /** Type of file (e.g., 'app', 'file', or other) */
16
14
  file_type: string;
17
- /** Tenant identifier for multi-tenancy */
18
15
  tenant_id: string;
19
- /** Whether to return the file content along with the URL */
20
16
  return_content?: boolean;
21
- /** Sub-tenant identifier, defaults to tenant_id if not provided */
22
17
  sub_tenant_id?: string;
23
18
  }
@@ -3,10 +3,10 @@ export * as sources from "./sources/index.js";
3
3
  export * as userMemory from "./userMemory/index.js";
4
4
  export * as fetch from "./fetch/index.js";
5
5
  export * as upload from "./upload/index.js";
6
- export * as document from "./document/index.js";
7
6
  export * as embeddings from "./embeddings/index.js";
8
7
  export * as user from "./user/index.js";
9
8
  export * as tenant from "./tenant/index.js";
9
+ export * as document from "./document/index.js";
10
10
  export * from "./search/client/requests/index.js";
11
11
  export * from "./sources/client/requests/index.js";
12
12
  export * from "./userMemory/client/requests/index.js";
@@ -26,16 +26,16 @@ 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.tenant = exports.user = exports.embeddings = exports.document = exports.upload = exports.fetch = exports.userMemory = exports.sources = exports.search = void 0;
29
+ exports.document = exports.tenant = exports.user = exports.embeddings = exports.upload = exports.fetch = exports.userMemory = exports.sources = exports.search = void 0;
30
30
  exports.search = __importStar(require("./search/index.js"));
31
31
  exports.sources = __importStar(require("./sources/index.js"));
32
32
  exports.userMemory = __importStar(require("./userMemory/index.js"));
33
33
  exports.fetch = __importStar(require("./fetch/index.js"));
34
34
  exports.upload = __importStar(require("./upload/index.js"));
35
- exports.document = __importStar(require("./document/index.js"));
36
35
  exports.embeddings = __importStar(require("./embeddings/index.js"));
37
36
  exports.user = __importStar(require("./user/index.js"));
38
37
  exports.tenant = __importStar(require("./tenant/index.js"));
38
+ exports.document = __importStar(require("./document/index.js"));
39
39
  __exportStar(require("./search/client/requests/index.js"), exports);
40
40
  __exportStar(require("./sources/client/requests/index.js"), exports);
41
41
  __exportStar(require("./userMemory/client/requests/index.js"), exports);