@credal/sdk 0.1.10 → 0.1.12
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/cjs/BaseClient.d.ts +6 -1
- package/dist/cjs/BaseClient.js +47 -0
- package/dist/cjs/Client.d.ts +16 -16
- package/dist/cjs/Client.js +8 -49
- package/dist/cjs/api/resources/copilots/client/Client.d.ts +21 -21
- package/dist/cjs/api/resources/copilots/client/Client.js +41 -22
- package/dist/cjs/api/resources/documentCatalog/client/Client.d.ts +12 -12
- package/dist/cjs/api/resources/documentCatalog/client/Client.js +22 -13
- package/dist/cjs/api/resources/documentCollections/client/Client.d.ts +18 -18
- package/dist/cjs/api/resources/documentCollections/client/Client.js +34 -19
- package/dist/cjs/api/resources/search/client/Client.d.ts +6 -6
- package/dist/cjs/api/resources/search/client/Client.js +10 -7
- package/dist/cjs/api/resources/users/client/Client.d.ts +6 -6
- package/dist/cjs/api/resources/users/client/Client.js +10 -7
- package/dist/cjs/core/exports.d.ts +1 -0
- package/dist/cjs/core/exports.js +1 -0
- package/dist/cjs/core/fetcher/Fetcher.d.ts +4 -1
- package/dist/cjs/core/fetcher/Fetcher.js +202 -9
- package/dist/cjs/core/fetcher/getRequestBody.d.ts +1 -1
- package/dist/cjs/core/fetcher/getRequestBody.js +4 -0
- package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
- package/dist/cjs/core/fetcher/makeRequest.js +0 -2
- package/dist/cjs/core/fetcher/requestWithRetries.js +0 -9
- package/dist/cjs/core/fetcher/signals.d.ts +0 -6
- package/dist/cjs/core/fetcher/signals.js +0 -12
- package/dist/cjs/core/headers.js +6 -4
- package/dist/cjs/core/index.d.ts +1 -0
- package/dist/cjs/core/index.js +2 -1
- package/dist/cjs/core/logging/exports.d.ts +18 -0
- package/dist/cjs/core/logging/exports.js +45 -0
- package/dist/cjs/core/logging/index.d.ts +1 -0
- package/dist/cjs/core/logging/index.js +17 -0
- package/dist/cjs/core/logging/logger.d.ts +126 -0
- package/dist/cjs/core/logging/logger.js +144 -0
- package/dist/cjs/core/url/join.js +0 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +6 -1
- package/dist/esm/BaseClient.mjs +13 -1
- package/dist/esm/Client.d.mts +16 -16
- package/dist/esm/Client.mjs +13 -21
- package/dist/esm/api/resources/copilots/client/Client.d.mts +21 -21
- package/dist/esm/api/resources/copilots/client/Client.mjs +39 -20
- package/dist/esm/api/resources/documentCatalog/client/Client.d.mts +12 -12
- package/dist/esm/api/resources/documentCatalog/client/Client.mjs +20 -11
- package/dist/esm/api/resources/documentCollections/client/Client.d.mts +18 -18
- package/dist/esm/api/resources/documentCollections/client/Client.mjs +32 -17
- package/dist/esm/api/resources/search/client/Client.d.mts +6 -6
- package/dist/esm/api/resources/search/client/Client.mjs +8 -5
- package/dist/esm/api/resources/users/client/Client.d.mts +6 -6
- package/dist/esm/api/resources/users/client/Client.mjs +8 -5
- package/dist/esm/core/exports.d.mts +1 -0
- package/dist/esm/core/exports.mjs +1 -0
- package/dist/esm/core/fetcher/Fetcher.d.mts +4 -1
- package/dist/esm/core/fetcher/Fetcher.mjs +202 -9
- package/dist/esm/core/fetcher/getRequestBody.d.mts +1 -1
- package/dist/esm/core/fetcher/getRequestBody.mjs +4 -0
- package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
- package/dist/esm/core/fetcher/makeRequest.mjs +0 -2
- package/dist/esm/core/fetcher/requestWithRetries.mjs +0 -9
- package/dist/esm/core/fetcher/signals.d.mts +0 -6
- package/dist/esm/core/fetcher/signals.mjs +0 -12
- package/dist/esm/core/headers.mjs +6 -4
- package/dist/esm/core/index.d.mts +1 -0
- package/dist/esm/core/index.mjs +1 -0
- package/dist/esm/core/logging/exports.d.mts +18 -0
- package/dist/esm/core/logging/exports.mjs +9 -0
- package/dist/esm/core/logging/index.d.mts +1 -0
- package/dist/esm/core/logging/index.mjs +1 -0
- package/dist/esm/core/logging/logger.d.mts +126 -0
- package/dist/esm/core/logging/logger.mjs +138 -0
- package/dist/esm/core/url/join.mjs +0 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +3 -2
- package/reference.md +21 -21
package/dist/cjs/BaseClient.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as core from "./core/index.js";
|
|
2
2
|
import type * as environments from "./environments.js";
|
|
3
3
|
export interface BaseClientOptions {
|
|
4
4
|
environment?: core.Supplier<environments.CredalEnvironment | string>;
|
|
@@ -11,7 +11,11 @@ export interface BaseClientOptions {
|
|
|
11
11
|
timeoutInSeconds?: number;
|
|
12
12
|
/** The default number of times to retry the request. Defaults to 2. */
|
|
13
13
|
maxRetries?: number;
|
|
14
|
+
/** Provide a custom fetch implementation. Useful for platforms that don't have a built-in fetch or need a custom implementation. */
|
|
15
|
+
fetch?: typeof fetch;
|
|
14
16
|
fetcher?: core.FetchFunction;
|
|
17
|
+
/** Configure logging for the client. */
|
|
18
|
+
logging?: core.logging.LogConfig | core.logging.Logger;
|
|
15
19
|
}
|
|
16
20
|
export interface BaseRequestOptions {
|
|
17
21
|
/** The maximum time to wait for a response in seconds. */
|
|
@@ -25,3 +29,4 @@ export interface BaseRequestOptions {
|
|
|
25
29
|
/** Additional headers to include in the request. */
|
|
26
30
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
27
31
|
}
|
|
32
|
+
export declare function normalizeClientOptions<T extends BaseClientOptions>(options: T): T;
|
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -1,3 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.normalizeClientOptions = normalizeClientOptions;
|
|
38
|
+
const headers_js_1 = require("./core/headers.js");
|
|
39
|
+
const core = __importStar(require("./core/index.js"));
|
|
40
|
+
function normalizeClientOptions(options) {
|
|
41
|
+
const headers = (0, headers_js_1.mergeHeaders)({
|
|
42
|
+
"X-Fern-Language": "JavaScript",
|
|
43
|
+
"X-Fern-SDK-Name": "@credal/sdk",
|
|
44
|
+
"X-Fern-SDK-Version": "0.1.12",
|
|
45
|
+
"User-Agent": "@credal/sdk/0.1.12",
|
|
46
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
47
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
48
|
+
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
49
|
+
return Object.assign(Object.assign({}, options), { logging: core.logging.createLogger(options === null || options === void 0 ? void 0 : options.logging), headers });
|
|
50
|
+
}
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { CopilotsClient } from "./api/resources/copilots/client/Client.js";
|
|
2
|
+
import { DocumentCatalogClient } from "./api/resources/documentCatalog/client/Client.js";
|
|
3
|
+
import { DocumentCollectionsClient } from "./api/resources/documentCollections/client/Client.js";
|
|
4
|
+
import { SearchClient } from "./api/resources/search/client/Client.js";
|
|
5
|
+
import { UsersClient } from "./api/resources/users/client/Client.js";
|
|
6
6
|
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
7
7
|
export declare namespace CredalClient {
|
|
8
8
|
interface Options extends BaseClientOptions {
|
|
@@ -12,15 +12,15 @@ export declare namespace CredalClient {
|
|
|
12
12
|
}
|
|
13
13
|
export declare class CredalClient {
|
|
14
14
|
protected readonly _options: CredalClient.Options;
|
|
15
|
-
protected _copilots:
|
|
16
|
-
protected _documentCatalog:
|
|
17
|
-
protected _documentCollections:
|
|
18
|
-
protected _search:
|
|
19
|
-
protected _users:
|
|
20
|
-
constructor(
|
|
21
|
-
get copilots():
|
|
22
|
-
get documentCatalog():
|
|
23
|
-
get documentCollections():
|
|
24
|
-
get search():
|
|
25
|
-
get users():
|
|
15
|
+
protected _copilots: CopilotsClient | undefined;
|
|
16
|
+
protected _documentCatalog: DocumentCatalogClient | undefined;
|
|
17
|
+
protected _documentCollections: DocumentCollectionsClient | undefined;
|
|
18
|
+
protected _search: SearchClient | undefined;
|
|
19
|
+
protected _users: UsersClient | undefined;
|
|
20
|
+
constructor(options?: CredalClient.Options);
|
|
21
|
+
get copilots(): CopilotsClient;
|
|
22
|
+
get documentCatalog(): DocumentCatalogClient;
|
|
23
|
+
get documentCollections(): DocumentCollectionsClient;
|
|
24
|
+
get search(): SearchClient;
|
|
25
|
+
get users(): UsersClient;
|
|
26
26
|
}
|
package/dist/cjs/Client.js
CHANGED
|
@@ -1,38 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
4
|
exports.CredalClient = void 0;
|
|
38
5
|
const Client_js_1 = require("./api/resources/copilots/client/Client.js");
|
|
@@ -40,38 +7,30 @@ const Client_js_2 = require("./api/resources/documentCatalog/client/Client.js");
|
|
|
40
7
|
const Client_js_3 = require("./api/resources/documentCollections/client/Client.js");
|
|
41
8
|
const Client_js_4 = require("./api/resources/search/client/Client.js");
|
|
42
9
|
const Client_js_5 = require("./api/resources/users/client/Client.js");
|
|
43
|
-
const
|
|
44
|
-
const core = __importStar(require("./core/index.js"));
|
|
10
|
+
const BaseClient_js_1 = require("./BaseClient.js");
|
|
45
11
|
class CredalClient {
|
|
46
|
-
constructor(
|
|
47
|
-
this._options =
|
|
48
|
-
"X-Fern-Language": "JavaScript",
|
|
49
|
-
"X-Fern-SDK-Name": "@credal/sdk",
|
|
50
|
-
"X-Fern-SDK-Version": "0.1.10",
|
|
51
|
-
"User-Agent": "@credal/sdk/0.1.10",
|
|
52
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
53
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
54
|
-
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
12
|
+
constructor(options = {}) {
|
|
13
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
|
|
55
14
|
}
|
|
56
15
|
get copilots() {
|
|
57
16
|
var _a;
|
|
58
|
-
return ((_a = this._copilots) !== null && _a !== void 0 ? _a : (this._copilots = new Client_js_1.
|
|
17
|
+
return ((_a = this._copilots) !== null && _a !== void 0 ? _a : (this._copilots = new Client_js_1.CopilotsClient(this._options)));
|
|
59
18
|
}
|
|
60
19
|
get documentCatalog() {
|
|
61
20
|
var _a;
|
|
62
|
-
return ((_a = this._documentCatalog) !== null && _a !== void 0 ? _a : (this._documentCatalog = new Client_js_2.
|
|
21
|
+
return ((_a = this._documentCatalog) !== null && _a !== void 0 ? _a : (this._documentCatalog = new Client_js_2.DocumentCatalogClient(this._options)));
|
|
63
22
|
}
|
|
64
23
|
get documentCollections() {
|
|
65
24
|
var _a;
|
|
66
|
-
return ((_a = this._documentCollections) !== null && _a !== void 0 ? _a : (this._documentCollections = new Client_js_3.
|
|
25
|
+
return ((_a = this._documentCollections) !== null && _a !== void 0 ? _a : (this._documentCollections = new Client_js_3.DocumentCollectionsClient(this._options)));
|
|
67
26
|
}
|
|
68
27
|
get search() {
|
|
69
28
|
var _a;
|
|
70
|
-
return ((_a = this._search) !== null && _a !== void 0 ? _a : (this._search = new Client_js_4.
|
|
29
|
+
return ((_a = this._search) !== null && _a !== void 0 ? _a : (this._search = new Client_js_4.SearchClient(this._options)));
|
|
71
30
|
}
|
|
72
31
|
get users() {
|
|
73
32
|
var _a;
|
|
74
|
-
return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_js_5.
|
|
33
|
+
return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_js_5.UsersClient(this._options)));
|
|
75
34
|
}
|
|
76
35
|
}
|
|
77
36
|
exports.CredalClient = CredalClient;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
2
|
import * as core from "../../../../core/index.js";
|
|
3
3
|
import type * as Credal from "../../../index.js";
|
|
4
|
-
export declare namespace
|
|
4
|
+
export declare namespace CopilotsClient {
|
|
5
5
|
interface Options extends BaseClientOptions {
|
|
6
6
|
}
|
|
7
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export declare class
|
|
11
|
-
protected readonly _options:
|
|
12
|
-
constructor(
|
|
10
|
+
export declare class CopilotsClient {
|
|
11
|
+
protected readonly _options: CopilotsClient.Options;
|
|
12
|
+
constructor(options?: CopilotsClient.Options);
|
|
13
13
|
/**
|
|
14
14
|
* Create a new agent. The API key used will be added to the agent for future Requests
|
|
15
15
|
*
|
|
16
16
|
* @param {Credal.CreateCopilotRequest} request
|
|
17
|
-
* @param {
|
|
17
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* await client.copilots.createCopilot({
|
|
@@ -26,13 +26,13 @@ export declare class Copilots {
|
|
|
26
26
|
* }]
|
|
27
27
|
* })
|
|
28
28
|
*/
|
|
29
|
-
createCopilot(request: Credal.CreateCopilotRequest, requestOptions?:
|
|
29
|
+
createCopilot(request: Credal.CreateCopilotRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<Credal.CreateCopilotResponse>;
|
|
30
30
|
private __createCopilot;
|
|
31
31
|
/**
|
|
32
32
|
* OPTIONAL. Create a new conversation with the Agent. The conversation ID can be used in the `sendMessage` endpoint. The `sendMessage` endpoint automatically creates new conversations upon first request, but calling this endpoint can simplify certain use cases where it is helpful for the application to have the conversation ID before the first message is sent.
|
|
33
33
|
*
|
|
34
34
|
* @param {Credal.CreateConversationRequest} request
|
|
35
|
-
* @param {
|
|
35
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
36
36
|
*
|
|
37
37
|
* @example
|
|
38
38
|
* await client.copilots.createConversation({
|
|
@@ -40,11 +40,11 @@ export declare class Copilots {
|
|
|
40
40
|
* userEmail: "ravin@credal.ai"
|
|
41
41
|
* })
|
|
42
42
|
*/
|
|
43
|
-
createConversation(request: Credal.CreateConversationRequest, requestOptions?:
|
|
43
|
+
createConversation(request: Credal.CreateConversationRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<Credal.CreateConversationResponse>;
|
|
44
44
|
private __createConversation;
|
|
45
45
|
/**
|
|
46
46
|
* @param {Credal.ProvideMessageFeedbackRequest} request
|
|
47
|
-
* @param {
|
|
47
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
48
48
|
*
|
|
49
49
|
* @example
|
|
50
50
|
* await client.copilots.provideMessageFeedback({
|
|
@@ -58,11 +58,11 @@ export declare class Copilots {
|
|
|
58
58
|
* }
|
|
59
59
|
* })
|
|
60
60
|
*/
|
|
61
|
-
provideMessageFeedback(request: Credal.ProvideMessageFeedbackRequest, requestOptions?:
|
|
61
|
+
provideMessageFeedback(request: Credal.ProvideMessageFeedbackRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
62
62
|
private __provideMessageFeedback;
|
|
63
63
|
/**
|
|
64
64
|
* @param {Credal.SendMessageRequest} request
|
|
65
|
-
* @param {
|
|
65
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
66
66
|
*
|
|
67
67
|
* @example
|
|
68
68
|
* await client.copilots.sendMessage({
|
|
@@ -78,18 +78,18 @@ export declare class Copilots {
|
|
|
78
78
|
* }]
|
|
79
79
|
* })
|
|
80
80
|
*/
|
|
81
|
-
sendMessage(request: Credal.SendMessageRequest, requestOptions?:
|
|
81
|
+
sendMessage(request: Credal.SendMessageRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<Credal.SendAgentMessageResponse>;
|
|
82
82
|
private __sendMessage;
|
|
83
83
|
/**
|
|
84
84
|
* This endpoint allows you to send a message to a specific agent and get the response back as a streamed set of Server-Sent Events.
|
|
85
85
|
*/
|
|
86
|
-
streamMessage(request: Credal.StreamMessageRequest, requestOptions?:
|
|
86
|
+
streamMessage(request: Credal.StreamMessageRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<core.Stream<Credal.StreamingChunk>>;
|
|
87
87
|
private __streamMessage;
|
|
88
88
|
/**
|
|
89
89
|
* Link a collection with a agent. The API Key used must be added to both the collection and the agent beforehand.
|
|
90
90
|
*
|
|
91
91
|
* @param {Credal.AddCollectionToCopilotRequest} request
|
|
92
|
-
* @param {
|
|
92
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
93
93
|
*
|
|
94
94
|
* @example
|
|
95
95
|
* await client.copilots.addCollectionToCopilot({
|
|
@@ -97,13 +97,13 @@ export declare class Copilots {
|
|
|
97
97
|
* collectionId: "def1055f-83c5-43d6-b558-f7a38e7b299e"
|
|
98
98
|
* })
|
|
99
99
|
*/
|
|
100
|
-
addCollectionToCopilot(request: Credal.AddCollectionToCopilotRequest, requestOptions?:
|
|
100
|
+
addCollectionToCopilot(request: Credal.AddCollectionToCopilotRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
101
101
|
private __addCollectionToCopilot;
|
|
102
102
|
/**
|
|
103
103
|
* Unlink a collection with a agent. The API Key used must be added to both the collection and the agent beforehand.
|
|
104
104
|
*
|
|
105
105
|
* @param {Credal.RemoveCollectionFromCopilotRequest} request
|
|
106
|
-
* @param {
|
|
106
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
107
107
|
*
|
|
108
108
|
* @example
|
|
109
109
|
* await client.copilots.removeCollectionFromCopilot({
|
|
@@ -111,13 +111,13 @@ export declare class Copilots {
|
|
|
111
111
|
* collectionId: "def1055f-83c5-43d6-b558-f7a38e7b299e"
|
|
112
112
|
* })
|
|
113
113
|
*/
|
|
114
|
-
removeCollectionFromCopilot(request: Credal.RemoveCollectionFromCopilotRequest, requestOptions?:
|
|
114
|
+
removeCollectionFromCopilot(request: Credal.RemoveCollectionFromCopilotRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
115
115
|
private __removeCollectionFromCopilot;
|
|
116
116
|
/**
|
|
117
117
|
* Update the configuration for a agent
|
|
118
118
|
*
|
|
119
119
|
* @param {Credal.UpdateConfigurationRequest} request
|
|
120
|
-
* @param {
|
|
120
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
121
121
|
*
|
|
122
122
|
* @example
|
|
123
123
|
* await client.copilots.updateConfiguration({
|
|
@@ -133,18 +133,18 @@ export declare class Copilots {
|
|
|
133
133
|
* }
|
|
134
134
|
* })
|
|
135
135
|
*/
|
|
136
|
-
updateConfiguration(request: Credal.UpdateConfigurationRequest, requestOptions?:
|
|
136
|
+
updateConfiguration(request: Credal.UpdateConfigurationRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
137
137
|
private __updateConfiguration;
|
|
138
138
|
/**
|
|
139
139
|
* @param {Credal.DeleteCopilotRequest} request
|
|
140
|
-
* @param {
|
|
140
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
141
141
|
*
|
|
142
142
|
* @example
|
|
143
143
|
* await client.copilots.deleteCopilot({
|
|
144
144
|
* id: "ac20e6ba-0bae-11ef-b25a-efca73df4c3a"
|
|
145
145
|
* })
|
|
146
146
|
*/
|
|
147
|
-
deleteCopilot(request: Credal.DeleteCopilotRequest, requestOptions?:
|
|
147
|
+
deleteCopilot(request: Credal.DeleteCopilotRequest, requestOptions?: CopilotsClient.RequestOptions): core.HttpResponsePromise<Credal.DeleteCopilotResponse>;
|
|
148
148
|
private __deleteCopilot;
|
|
149
149
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
150
150
|
}
|
|
@@ -43,20 +43,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.
|
|
46
|
+
exports.CopilotsClient = void 0;
|
|
47
|
+
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
47
48
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
48
49
|
const core = __importStar(require("../../../../core/index.js"));
|
|
49
50
|
const environments = __importStar(require("../../../../environments.js"));
|
|
50
51
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
51
|
-
class
|
|
52
|
-
constructor(
|
|
53
|
-
this._options =
|
|
52
|
+
class CopilotsClient {
|
|
53
|
+
constructor(options = {}) {
|
|
54
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
|
|
54
55
|
}
|
|
55
56
|
/**
|
|
56
57
|
* Create a new agent. The API key used will be added to the agent for future Requests
|
|
57
58
|
*
|
|
58
59
|
* @param {Credal.CreateCopilotRequest} request
|
|
59
|
-
* @param {
|
|
60
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
60
61
|
*
|
|
61
62
|
* @example
|
|
62
63
|
* await client.copilots.createCopilot({
|
|
@@ -73,7 +74,7 @@ class Copilots {
|
|
|
73
74
|
}
|
|
74
75
|
__createCopilot(request, requestOptions) {
|
|
75
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
77
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
77
78
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
78
79
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
79
80
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/createCopilot"),
|
|
@@ -86,6 +87,8 @@ class Copilots {
|
|
|
86
87
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
87
88
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
88
89
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
90
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
91
|
+
logging: this._options.logging,
|
|
89
92
|
});
|
|
90
93
|
if (_response.ok) {
|
|
91
94
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -118,7 +121,7 @@ class Copilots {
|
|
|
118
121
|
* OPTIONAL. Create a new conversation with the Agent. The conversation ID can be used in the `sendMessage` endpoint. The `sendMessage` endpoint automatically creates new conversations upon first request, but calling this endpoint can simplify certain use cases where it is helpful for the application to have the conversation ID before the first message is sent.
|
|
119
122
|
*
|
|
120
123
|
* @param {Credal.CreateConversationRequest} request
|
|
121
|
-
* @param {
|
|
124
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
122
125
|
*
|
|
123
126
|
* @example
|
|
124
127
|
* await client.copilots.createConversation({
|
|
@@ -131,7 +134,7 @@ class Copilots {
|
|
|
131
134
|
}
|
|
132
135
|
__createConversation(request, requestOptions) {
|
|
133
136
|
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
137
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
135
138
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
136
139
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
137
140
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/createConversation"),
|
|
@@ -144,6 +147,8 @@ class Copilots {
|
|
|
144
147
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
145
148
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
146
149
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
150
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
151
|
+
logging: this._options.logging,
|
|
147
152
|
});
|
|
148
153
|
if (_response.ok) {
|
|
149
154
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -174,7 +179,7 @@ class Copilots {
|
|
|
174
179
|
}
|
|
175
180
|
/**
|
|
176
181
|
* @param {Credal.ProvideMessageFeedbackRequest} request
|
|
177
|
-
* @param {
|
|
182
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
178
183
|
*
|
|
179
184
|
* @example
|
|
180
185
|
* await client.copilots.provideMessageFeedback({
|
|
@@ -193,7 +198,7 @@ class Copilots {
|
|
|
193
198
|
}
|
|
194
199
|
__provideMessageFeedback(request, requestOptions) {
|
|
195
200
|
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
201
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
197
202
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
198
203
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
199
204
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/provideMessageFeedback"),
|
|
@@ -206,6 +211,8 @@ class Copilots {
|
|
|
206
211
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
207
212
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
208
213
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
214
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
215
|
+
logging: this._options.logging,
|
|
209
216
|
});
|
|
210
217
|
if (_response.ok) {
|
|
211
218
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -236,7 +243,7 @@ class Copilots {
|
|
|
236
243
|
}
|
|
237
244
|
/**
|
|
238
245
|
* @param {Credal.SendMessageRequest} request
|
|
239
|
-
* @param {
|
|
246
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
240
247
|
*
|
|
241
248
|
* @example
|
|
242
249
|
* await client.copilots.sendMessage({
|
|
@@ -257,7 +264,7 @@ class Copilots {
|
|
|
257
264
|
}
|
|
258
265
|
__sendMessage(request, requestOptions) {
|
|
259
266
|
return __awaiter(this, void 0, void 0, function* () {
|
|
260
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
267
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
261
268
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
262
269
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
263
270
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/sendMessage"),
|
|
@@ -270,6 +277,8 @@ class Copilots {
|
|
|
270
277
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
271
278
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
272
279
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
280
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
281
|
+
logging: this._options.logging,
|
|
273
282
|
});
|
|
274
283
|
if (_response.ok) {
|
|
275
284
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -306,7 +315,7 @@ class Copilots {
|
|
|
306
315
|
}
|
|
307
316
|
__streamMessage(request, requestOptions) {
|
|
308
317
|
return __awaiter(this, void 0, void 0, function* () {
|
|
309
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
318
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
310
319
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
311
320
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
312
321
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/streamMessage"),
|
|
@@ -320,6 +329,8 @@ class Copilots {
|
|
|
320
329
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
321
330
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
322
331
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
332
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
333
|
+
logging: this._options.logging,
|
|
323
334
|
});
|
|
324
335
|
if (_response.ok) {
|
|
325
336
|
return {
|
|
@@ -363,7 +374,7 @@ class Copilots {
|
|
|
363
374
|
* Link a collection with a agent. The API Key used must be added to both the collection and the agent beforehand.
|
|
364
375
|
*
|
|
365
376
|
* @param {Credal.AddCollectionToCopilotRequest} request
|
|
366
|
-
* @param {
|
|
377
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
367
378
|
*
|
|
368
379
|
* @example
|
|
369
380
|
* await client.copilots.addCollectionToCopilot({
|
|
@@ -376,7 +387,7 @@ class Copilots {
|
|
|
376
387
|
}
|
|
377
388
|
__addCollectionToCopilot(request, requestOptions) {
|
|
378
389
|
return __awaiter(this, void 0, void 0, function* () {
|
|
379
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
390
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
380
391
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
381
392
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
382
393
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/addCollectionToCopilot"),
|
|
@@ -389,6 +400,8 @@ class Copilots {
|
|
|
389
400
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
390
401
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
391
402
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
403
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
404
|
+
logging: this._options.logging,
|
|
392
405
|
});
|
|
393
406
|
if (_response.ok) {
|
|
394
407
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -421,7 +434,7 @@ class Copilots {
|
|
|
421
434
|
* Unlink a collection with a agent. The API Key used must be added to both the collection and the agent beforehand.
|
|
422
435
|
*
|
|
423
436
|
* @param {Credal.RemoveCollectionFromCopilotRequest} request
|
|
424
|
-
* @param {
|
|
437
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
425
438
|
*
|
|
426
439
|
* @example
|
|
427
440
|
* await client.copilots.removeCollectionFromCopilot({
|
|
@@ -434,7 +447,7 @@ class Copilots {
|
|
|
434
447
|
}
|
|
435
448
|
__removeCollectionFromCopilot(request, requestOptions) {
|
|
436
449
|
return __awaiter(this, void 0, void 0, function* () {
|
|
437
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
450
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
438
451
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
439
452
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
440
453
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/removeCollectionFromCopilot"),
|
|
@@ -447,6 +460,8 @@ class Copilots {
|
|
|
447
460
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
448
461
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
449
462
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
463
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
464
|
+
logging: this._options.logging,
|
|
450
465
|
});
|
|
451
466
|
if (_response.ok) {
|
|
452
467
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -479,7 +494,7 @@ class Copilots {
|
|
|
479
494
|
* Update the configuration for a agent
|
|
480
495
|
*
|
|
481
496
|
* @param {Credal.UpdateConfigurationRequest} request
|
|
482
|
-
* @param {
|
|
497
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
483
498
|
*
|
|
484
499
|
* @example
|
|
485
500
|
* await client.copilots.updateConfiguration({
|
|
@@ -500,7 +515,7 @@ class Copilots {
|
|
|
500
515
|
}
|
|
501
516
|
__updateConfiguration(request, requestOptions) {
|
|
502
517
|
return __awaiter(this, void 0, void 0, function* () {
|
|
503
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
518
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
504
519
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
505
520
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
506
521
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/updateConfiguration"),
|
|
@@ -513,6 +528,8 @@ class Copilots {
|
|
|
513
528
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
514
529
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
515
530
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
531
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
532
|
+
logging: this._options.logging,
|
|
516
533
|
});
|
|
517
534
|
if (_response.ok) {
|
|
518
535
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
@@ -543,7 +560,7 @@ class Copilots {
|
|
|
543
560
|
}
|
|
544
561
|
/**
|
|
545
562
|
* @param {Credal.DeleteCopilotRequest} request
|
|
546
|
-
* @param {
|
|
563
|
+
* @param {CopilotsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
547
564
|
*
|
|
548
565
|
* @example
|
|
549
566
|
* await client.copilots.deleteCopilot({
|
|
@@ -555,7 +572,7 @@ class Copilots {
|
|
|
555
572
|
}
|
|
556
573
|
__deleteCopilot(request, requestOptions) {
|
|
557
574
|
return __awaiter(this, void 0, void 0, function* () {
|
|
558
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
575
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
559
576
|
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
560
577
|
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
561
578
|
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.CredalEnvironment.Production, "/v0/copilots/deleteCopilot"),
|
|
@@ -568,6 +585,8 @@ class Copilots {
|
|
|
568
585
|
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
569
586
|
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
570
587
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
588
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
589
|
+
logging: this._options.logging,
|
|
571
590
|
});
|
|
572
591
|
if (_response.ok) {
|
|
573
592
|
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
@@ -609,4 +628,4 @@ class Copilots {
|
|
|
609
628
|
});
|
|
610
629
|
}
|
|
611
630
|
}
|
|
612
|
-
exports.
|
|
631
|
+
exports.CopilotsClient = CopilotsClient;
|