echo-ai-sdk-ts 2.5.0 → 2.6.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/index.js +422 -29
- package/dist/index.mjs +416 -28
- package/package.json +11 -3
package/dist/index.js
CHANGED
|
@@ -36,6 +36,10 @@ __export(index_exports, {
|
|
|
36
36
|
AgentIterationLimitError: () => AgentIterationLimitError,
|
|
37
37
|
AgentPipeline: () => AgentPipeline,
|
|
38
38
|
AgentRouter: () => AgentRouter,
|
|
39
|
+
AwsBedrockProvider: () => AwsBedrockProvider,
|
|
40
|
+
AwsSageMakerDeployer: () => AwsSageMakerDeployer,
|
|
41
|
+
AzureMlDeployer: () => AzureMlDeployer,
|
|
42
|
+
AzureOpenAiProvider: () => AzureOpenAiProvider,
|
|
39
43
|
BaseProvider: () => BaseProvider,
|
|
40
44
|
BaseSTTProvider: () => BaseSTTProvider,
|
|
41
45
|
BaseSpeakerRecognizer: () => BaseSpeakerRecognizer,
|
|
@@ -53,9 +57,10 @@ __export(index_exports, {
|
|
|
53
57
|
DEFAULT_REDACTION_RULES: () => DEFAULT_REDACTION_RULES,
|
|
54
58
|
EchoAI: () => EchoAI,
|
|
55
59
|
EchoVoice: () => EchoVoice,
|
|
56
|
-
ExperimentManager: () => ExperimentManager,
|
|
57
60
|
FileSessionStore: () => FileSessionStore,
|
|
58
61
|
GatewayRoutingError: () => GatewayRoutingError,
|
|
62
|
+
GcpVertexManager: () => GcpVertexManager,
|
|
63
|
+
GcpVertexProvider: () => GcpVertexProvider,
|
|
59
64
|
HandoffManager: () => HandoffManager,
|
|
60
65
|
HuggingFaceImageGen: () => HuggingFaceImageGen,
|
|
61
66
|
HuggingFaceTTS: () => HuggingFaceTTS,
|
|
@@ -1764,23 +1769,23 @@ function getName(value) {
|
|
|
1764
1769
|
return (typeof value === "object" && value !== null && ("name" in value && value.name && String(value.name) || "url" in value && value.url && String(value.url) || "filename" in value && value.filename && String(value.filename) || "path" in value && value.path && String(value.path)) || "").split(/[\\/]/).pop() || void 0;
|
|
1765
1770
|
}
|
|
1766
1771
|
var isAsyncIterable = (value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function";
|
|
1767
|
-
var maybeMultipartFormRequestOptions = async (opts,
|
|
1772
|
+
var maybeMultipartFormRequestOptions = async (opts, fetch7) => {
|
|
1768
1773
|
if (!hasUploadableValue(opts.body))
|
|
1769
1774
|
return opts;
|
|
1770
|
-
return { ...opts, body: await createForm(opts.body,
|
|
1775
|
+
return { ...opts, body: await createForm(opts.body, fetch7) };
|
|
1771
1776
|
};
|
|
1772
|
-
var multipartFormRequestOptions = async (opts,
|
|
1773
|
-
return { ...opts, body: await createForm(opts.body,
|
|
1777
|
+
var multipartFormRequestOptions = async (opts, fetch7) => {
|
|
1778
|
+
return { ...opts, body: await createForm(opts.body, fetch7) };
|
|
1774
1779
|
};
|
|
1775
1780
|
var supportsFormDataMap = /* @__PURE__ */ new WeakMap();
|
|
1776
1781
|
function supportsFormData(fetchObject) {
|
|
1777
|
-
const
|
|
1778
|
-
const cached = supportsFormDataMap.get(
|
|
1782
|
+
const fetch7 = typeof fetchObject === "function" ? fetchObject : fetchObject.fetch;
|
|
1783
|
+
const cached = supportsFormDataMap.get(fetch7);
|
|
1779
1784
|
if (cached)
|
|
1780
1785
|
return cached;
|
|
1781
1786
|
const promise = (async () => {
|
|
1782
1787
|
try {
|
|
1783
|
-
const FetchResponse = "Response" in
|
|
1788
|
+
const FetchResponse = "Response" in fetch7 ? fetch7.Response : (await fetch7("data:,")).constructor;
|
|
1784
1789
|
const data = new FormData();
|
|
1785
1790
|
if (data.toString() === await new FetchResponse(data).text()) {
|
|
1786
1791
|
return false;
|
|
@@ -1790,11 +1795,11 @@ function supportsFormData(fetchObject) {
|
|
|
1790
1795
|
return true;
|
|
1791
1796
|
}
|
|
1792
1797
|
})();
|
|
1793
|
-
supportsFormDataMap.set(
|
|
1798
|
+
supportsFormDataMap.set(fetch7, promise);
|
|
1794
1799
|
return promise;
|
|
1795
1800
|
}
|
|
1796
|
-
var createForm = async (body,
|
|
1797
|
-
if (!await supportsFormData(
|
|
1801
|
+
var createForm = async (body, fetch7) => {
|
|
1802
|
+
if (!await supportsFormData(fetch7)) {
|
|
1798
1803
|
throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");
|
|
1799
1804
|
}
|
|
1800
1805
|
const form = new FormData();
|
|
@@ -8427,18 +8432,18 @@ function getName2(value, stripPath) {
|
|
|
8427
8432
|
return stripPath ? val.split(/[\\/]/).pop() || void 0 : val;
|
|
8428
8433
|
}
|
|
8429
8434
|
var isAsyncIterable2 = (value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function";
|
|
8430
|
-
var multipartFormRequestOptions2 = async (opts,
|
|
8431
|
-
return { ...opts, body: await createForm2(opts.body,
|
|
8435
|
+
var multipartFormRequestOptions2 = async (opts, fetch7, stripFilenames = true) => {
|
|
8436
|
+
return { ...opts, body: await createForm2(opts.body, fetch7, stripFilenames) };
|
|
8432
8437
|
};
|
|
8433
8438
|
var supportsFormDataMap2 = /* @__PURE__ */ new WeakMap();
|
|
8434
8439
|
function supportsFormData2(fetchObject) {
|
|
8435
|
-
const
|
|
8436
|
-
const cached = supportsFormDataMap2.get(
|
|
8440
|
+
const fetch7 = typeof fetchObject === "function" ? fetchObject : fetchObject.fetch;
|
|
8441
|
+
const cached = supportsFormDataMap2.get(fetch7);
|
|
8437
8442
|
if (cached)
|
|
8438
8443
|
return cached;
|
|
8439
8444
|
const promise = (async () => {
|
|
8440
8445
|
try {
|
|
8441
|
-
const FetchResponse = "Response" in
|
|
8446
|
+
const FetchResponse = "Response" in fetch7 ? fetch7.Response : (await fetch7("data:,")).constructor;
|
|
8442
8447
|
const data = new FormData();
|
|
8443
8448
|
if (data.toString() === await new FetchResponse(data).text()) {
|
|
8444
8449
|
return false;
|
|
@@ -8448,11 +8453,11 @@ function supportsFormData2(fetchObject) {
|
|
|
8448
8453
|
return true;
|
|
8449
8454
|
}
|
|
8450
8455
|
})();
|
|
8451
|
-
supportsFormDataMap2.set(
|
|
8456
|
+
supportsFormDataMap2.set(fetch7, promise);
|
|
8452
8457
|
return promise;
|
|
8453
8458
|
}
|
|
8454
|
-
var createForm2 = async (body,
|
|
8455
|
-
if (!await supportsFormData2(
|
|
8459
|
+
var createForm2 = async (body, fetch7, stripFilenames = true) => {
|
|
8460
|
+
if (!await supportsFormData2(fetch7)) {
|
|
8456
8461
|
throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");
|
|
8457
8462
|
}
|
|
8458
8463
|
const form = new FormData();
|
|
@@ -12970,6 +12975,7 @@ var EchoVoice = class {
|
|
|
12970
12975
|
};
|
|
12971
12976
|
|
|
12972
12977
|
// src/widget/connector.ts
|
|
12978
|
+
var import_cross_fetch = __toESM(require("cross-fetch"));
|
|
12973
12979
|
var APIConnector = class {
|
|
12974
12980
|
baseUrl;
|
|
12975
12981
|
headers;
|
|
@@ -12997,7 +13003,7 @@ var APIConnector = class {
|
|
|
12997
13003
|
const controller = new AbortController();
|
|
12998
13004
|
const timer = setTimeout(() => controller.abort(), this.timeout);
|
|
12999
13005
|
try {
|
|
13000
|
-
const response = await
|
|
13006
|
+
const response = await (0, import_cross_fetch.default)(url, {
|
|
13001
13007
|
method,
|
|
13002
13008
|
headers: this.headers,
|
|
13003
13009
|
body: body ? JSON.stringify(body) : void 0,
|
|
@@ -13017,6 +13023,7 @@ var APIConnector = class {
|
|
|
13017
13023
|
var import_zod4 = require("zod");
|
|
13018
13024
|
|
|
13019
13025
|
// src/rag/knowledge.ts
|
|
13026
|
+
var import_cross_fetch2 = __toESM(require("cross-fetch"));
|
|
13020
13027
|
var fs = __toESM(require("fs/promises"));
|
|
13021
13028
|
function cosineSimilarity(a, b) {
|
|
13022
13029
|
if (a.length !== b.length) return 0;
|
|
@@ -13145,7 +13152,7 @@ var KnowledgeBase = class {
|
|
|
13145
13152
|
return chunks.length;
|
|
13146
13153
|
}
|
|
13147
13154
|
async ingestURL(url) {
|
|
13148
|
-
const response = await
|
|
13155
|
+
const response = await (0, import_cross_fetch2.default)(url);
|
|
13149
13156
|
const html = await response.text();
|
|
13150
13157
|
const text = html.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<style[^>]*>[\s\S]*?<\/style>/gi, "").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
13151
13158
|
return this.ingestText(text, url);
|
|
@@ -13350,6 +13357,7 @@ var ConversationAnalytics = class {
|
|
|
13350
13357
|
};
|
|
13351
13358
|
|
|
13352
13359
|
// src/analytics/handoff.ts
|
|
13360
|
+
var import_cross_fetch3 = __toESM(require("cross-fetch"));
|
|
13353
13361
|
var crypto2 = __toESM(require("crypto"));
|
|
13354
13362
|
var HandoffManager = class {
|
|
13355
13363
|
webhookUrl;
|
|
@@ -13458,7 +13466,7 @@ var HandoffManager = class {
|
|
|
13458
13466
|
headers["X-Webhook-Signature"] = `sha256=${hmac.digest("hex")}`;
|
|
13459
13467
|
}
|
|
13460
13468
|
try {
|
|
13461
|
-
await
|
|
13469
|
+
await (0, import_cross_fetch3.default)(this.webhookUrl, { method: "POST", headers, body });
|
|
13462
13470
|
} catch (e) {
|
|
13463
13471
|
console.error(`[HandoffManager] Webhook dispatch failed: ${e.message}`);
|
|
13464
13472
|
}
|
|
@@ -14144,6 +14152,7 @@ var SlackAdapter = class extends ChannelAdapter {
|
|
|
14144
14152
|
};
|
|
14145
14153
|
|
|
14146
14154
|
// src/channels/telegram.ts
|
|
14155
|
+
var import_cross_fetch4 = __toESM(require("cross-fetch"));
|
|
14147
14156
|
var TelegramAdapter = class extends ChannelAdapter {
|
|
14148
14157
|
token;
|
|
14149
14158
|
polling = false;
|
|
@@ -14163,7 +14172,7 @@ var TelegramAdapter = class extends ChannelAdapter {
|
|
|
14163
14172
|
async runPollingLoop() {
|
|
14164
14173
|
while (this.polling) {
|
|
14165
14174
|
try {
|
|
14166
|
-
const response = await
|
|
14175
|
+
const response = await (0, import_cross_fetch4.default)(`https://api.telegram.org/bot${this.token}/getUpdates?offset=${this.offset}&timeout=30`);
|
|
14167
14176
|
const data = await response.json();
|
|
14168
14177
|
if (data.ok && data.result && data.result.length > 0) {
|
|
14169
14178
|
for (const update of data.result) {
|
|
@@ -14182,7 +14191,7 @@ var TelegramAdapter = class extends ChannelAdapter {
|
|
|
14182
14191
|
}
|
|
14183
14192
|
}
|
|
14184
14193
|
async sendMessage(chatId, text) {
|
|
14185
|
-
await
|
|
14194
|
+
await (0, import_cross_fetch4.default)(`https://api.telegram.org/bot${this.token}/sendMessage`, {
|
|
14186
14195
|
method: "POST",
|
|
14187
14196
|
headers: { "Content-Type": "application/json" },
|
|
14188
14197
|
body: JSON.stringify({ chat_id: chatId, text })
|
|
@@ -14191,6 +14200,7 @@ var TelegramAdapter = class extends ChannelAdapter {
|
|
|
14191
14200
|
};
|
|
14192
14201
|
|
|
14193
14202
|
// src/deployment/huggingface_manager.ts
|
|
14203
|
+
var import_cross_fetch5 = __toESM(require("cross-fetch"));
|
|
14194
14204
|
var InferenceEndpointManager = class {
|
|
14195
14205
|
token;
|
|
14196
14206
|
baseUrl = "https://api.endpoints.huggingface.cloud/v2";
|
|
@@ -14227,7 +14237,7 @@ var InferenceEndpointManager = class {
|
|
|
14227
14237
|
}
|
|
14228
14238
|
}
|
|
14229
14239
|
};
|
|
14230
|
-
const res = await
|
|
14240
|
+
const res = await (0, import_cross_fetch5.default)(url, {
|
|
14231
14241
|
method: "POST",
|
|
14232
14242
|
headers: this.headers,
|
|
14233
14243
|
body: JSON.stringify(payload)
|
|
@@ -14243,7 +14253,7 @@ var InferenceEndpointManager = class {
|
|
|
14243
14253
|
*/
|
|
14244
14254
|
async getEndpointStatus(accountId, endpointName) {
|
|
14245
14255
|
const url = `${this.baseUrl}/endpoint/${accountId}/${endpointName}`;
|
|
14246
|
-
const res = await
|
|
14256
|
+
const res = await (0, import_cross_fetch5.default)(url, { headers: this.headers });
|
|
14247
14257
|
if (!res.ok) throw new Error("Could not fetch endpoint status");
|
|
14248
14258
|
const data = await res.json();
|
|
14249
14259
|
return data.status.state;
|
|
@@ -14253,7 +14263,7 @@ var InferenceEndpointManager = class {
|
|
|
14253
14263
|
*/
|
|
14254
14264
|
async pauseEndpoint(accountId, endpointName) {
|
|
14255
14265
|
const url = `${this.baseUrl}/endpoint/${accountId}/${endpointName}/pause`;
|
|
14256
|
-
const res = await
|
|
14266
|
+
const res = await (0, import_cross_fetch5.default)(url, { method: "POST", headers: this.headers });
|
|
14257
14267
|
if (!res.ok) throw new Error("Failed to pause endpoint");
|
|
14258
14268
|
}
|
|
14259
14269
|
/**
|
|
@@ -14261,10 +14271,388 @@ var InferenceEndpointManager = class {
|
|
|
14261
14271
|
*/
|
|
14262
14272
|
async resumeEndpoint(accountId, endpointName) {
|
|
14263
14273
|
const url = `${this.baseUrl}/endpoint/${accountId}/${endpointName}/resume`;
|
|
14264
|
-
const res = await
|
|
14274
|
+
const res = await (0, import_cross_fetch5.default)(url, { method: "POST", headers: this.headers });
|
|
14265
14275
|
if (!res.ok) throw new Error("Failed to resume endpoint");
|
|
14266
14276
|
}
|
|
14267
14277
|
};
|
|
14278
|
+
|
|
14279
|
+
// src/deployment/aws_sagemaker.ts
|
|
14280
|
+
var import_client_sagemaker = require("@aws-sdk/client-sagemaker");
|
|
14281
|
+
var AwsSageMakerDeployer = class {
|
|
14282
|
+
client;
|
|
14283
|
+
constructor(config) {
|
|
14284
|
+
this.client = new import_client_sagemaker.SageMakerClient({
|
|
14285
|
+
region: config.region,
|
|
14286
|
+
credentials: config.credentials
|
|
14287
|
+
});
|
|
14288
|
+
}
|
|
14289
|
+
/**
|
|
14290
|
+
* Orchestrates the 3-step SageMaker deployment process.
|
|
14291
|
+
*/
|
|
14292
|
+
async deployEndpoint(params) {
|
|
14293
|
+
const configName = `${params.modelName}-config-${Date.now()}`;
|
|
14294
|
+
const endpointName = `${params.modelName}-endpoint`;
|
|
14295
|
+
try {
|
|
14296
|
+
await this.client.send(new import_client_sagemaker.CreateModelCommand({
|
|
14297
|
+
ModelName: params.modelName,
|
|
14298
|
+
PrimaryContainer: {
|
|
14299
|
+
Image: params.primaryContainerImage,
|
|
14300
|
+
ModelDataUrl: params.modelDataUrl,
|
|
14301
|
+
Environment: {
|
|
14302
|
+
// HF specific deployment variables if using Hugging Face DLC
|
|
14303
|
+
"HF_MODEL_ID": params.modelName,
|
|
14304
|
+
"HF_TASK": "text-generation"
|
|
14305
|
+
}
|
|
14306
|
+
},
|
|
14307
|
+
ExecutionRoleArn: params.executionRoleArn
|
|
14308
|
+
}));
|
|
14309
|
+
await this.client.send(new import_client_sagemaker.CreateEndpointConfigCommand({
|
|
14310
|
+
EndpointConfigName: configName,
|
|
14311
|
+
ProductionVariants: [{
|
|
14312
|
+
VariantName: "AllTraffic",
|
|
14313
|
+
ModelName: params.modelName,
|
|
14314
|
+
InitialInstanceCount: params.initialInstanceCount || 1,
|
|
14315
|
+
InstanceType: params.instanceType || "ml.g5.xlarge"
|
|
14316
|
+
}]
|
|
14317
|
+
}));
|
|
14318
|
+
await this.client.send(new import_client_sagemaker.CreateEndpointCommand({
|
|
14319
|
+
EndpointName: endpointName,
|
|
14320
|
+
EndpointConfigName: configName
|
|
14321
|
+
}));
|
|
14322
|
+
return endpointName;
|
|
14323
|
+
} catch (e) {
|
|
14324
|
+
throw new Error(`AWS SageMaker deployment failed: ${e.message}`);
|
|
14325
|
+
}
|
|
14326
|
+
}
|
|
14327
|
+
/**
|
|
14328
|
+
* Checks the provisioning status of a SageMaker Endpoint.
|
|
14329
|
+
*/
|
|
14330
|
+
async getEndpointStatus(endpointName) {
|
|
14331
|
+
const res = await this.client.send(new import_client_sagemaker.DescribeEndpointCommand({ EndpointName: endpointName }));
|
|
14332
|
+
return res.EndpointStatus || "Unknown";
|
|
14333
|
+
}
|
|
14334
|
+
};
|
|
14335
|
+
|
|
14336
|
+
// src/deployment/gcp_vertex_manager.ts
|
|
14337
|
+
var import_aiplatform = require("@google-cloud/aiplatform");
|
|
14338
|
+
var GcpVertexManager = class {
|
|
14339
|
+
client;
|
|
14340
|
+
project;
|
|
14341
|
+
location;
|
|
14342
|
+
constructor(config) {
|
|
14343
|
+
this.client = new import_aiplatform.EndpointServiceClient({
|
|
14344
|
+
apiEndpoint: `${config.location}-aiplatform.googleapis.com`
|
|
14345
|
+
});
|
|
14346
|
+
this.project = config.project;
|
|
14347
|
+
this.location = config.location;
|
|
14348
|
+
}
|
|
14349
|
+
/**
|
|
14350
|
+
* Deploys an uploaded Vertex AI Model Resource to a newly created Endpoint.
|
|
14351
|
+
*/
|
|
14352
|
+
async deployModel(params) {
|
|
14353
|
+
const parent = `projects/${this.project}/locations/${this.location}`;
|
|
14354
|
+
const [endpointLro] = await this.client.createEndpoint({
|
|
14355
|
+
parent,
|
|
14356
|
+
endpoint: { displayName: `${params.displayName}-endpoint` }
|
|
14357
|
+
});
|
|
14358
|
+
const [endpointResponse] = await endpointLro.promise();
|
|
14359
|
+
const endpointName = endpointResponse.name;
|
|
14360
|
+
const [deployLro] = await this.client.deployModel({
|
|
14361
|
+
endpoint: endpointName,
|
|
14362
|
+
deployedModel: {
|
|
14363
|
+
model: params.modelName,
|
|
14364
|
+
displayName: `${params.displayName}-deployment`,
|
|
14365
|
+
dedicatedResources: {
|
|
14366
|
+
machineSpec: {
|
|
14367
|
+
machineType: params.machineType || "n1-standard-4",
|
|
14368
|
+
acceleratorType: params.acceleratorType || void 0,
|
|
14369
|
+
acceleratorCount: params.acceleratorCount || 0
|
|
14370
|
+
},
|
|
14371
|
+
minReplicaCount: 1,
|
|
14372
|
+
maxReplicaCount: 1
|
|
14373
|
+
}
|
|
14374
|
+
}
|
|
14375
|
+
});
|
|
14376
|
+
console.log("Waiting for Vertex AI deployment LRO to finish...");
|
|
14377
|
+
await deployLro.promise();
|
|
14378
|
+
return endpointName;
|
|
14379
|
+
}
|
|
14380
|
+
};
|
|
14381
|
+
|
|
14382
|
+
// src/deployment/azure_ml.ts
|
|
14383
|
+
var import_arm_machinelearning = require("@azure/arm-machinelearning");
|
|
14384
|
+
var import_identity = require("@azure/identity");
|
|
14385
|
+
var AzureMlDeployer = class {
|
|
14386
|
+
client;
|
|
14387
|
+
config;
|
|
14388
|
+
constructor(config) {
|
|
14389
|
+
const credential = new import_identity.DefaultAzureCredential();
|
|
14390
|
+
this.client = new import_arm_machinelearning.AzureMachineLearningServicesManagementClient(credential, config.subscriptionId);
|
|
14391
|
+
this.config = config;
|
|
14392
|
+
}
|
|
14393
|
+
/**
|
|
14394
|
+
* Orchestrates the creation of an Azure Managed Online Endpoint and Deployment.
|
|
14395
|
+
*/
|
|
14396
|
+
async deployEndpoint(params) {
|
|
14397
|
+
const { resourceGroupName, workspaceName } = this.config;
|
|
14398
|
+
try {
|
|
14399
|
+
const endpointLro = await this.client.onlineEndpoints.beginCreateOrUpdateAndWait(
|
|
14400
|
+
resourceGroupName,
|
|
14401
|
+
workspaceName,
|
|
14402
|
+
params.endpointName,
|
|
14403
|
+
{
|
|
14404
|
+
location: "eastus",
|
|
14405
|
+
// Would ideally be dynamic based on workspace location
|
|
14406
|
+
properties: {
|
|
14407
|
+
authMode: "Key",
|
|
14408
|
+
compute: "Managed"
|
|
14409
|
+
}
|
|
14410
|
+
}
|
|
14411
|
+
);
|
|
14412
|
+
await this.client.onlineDeployments.beginCreateOrUpdateAndWait(
|
|
14413
|
+
resourceGroupName,
|
|
14414
|
+
workspaceName,
|
|
14415
|
+
params.endpointName,
|
|
14416
|
+
params.deploymentName,
|
|
14417
|
+
{
|
|
14418
|
+
location: endpointLro.location,
|
|
14419
|
+
properties: {
|
|
14420
|
+
endpointComputeType: "Managed",
|
|
14421
|
+
model: params.modelId,
|
|
14422
|
+
instanceType: params.instanceType || "Standard_DS3_v2",
|
|
14423
|
+
scaleSettings: {
|
|
14424
|
+
scaleType: "Default",
|
|
14425
|
+
instanceCount: Math.max(1, params.instanceCount || 1)
|
|
14426
|
+
}
|
|
14427
|
+
}
|
|
14428
|
+
}
|
|
14429
|
+
);
|
|
14430
|
+
await this.client.onlineEndpoints.beginCreateOrUpdateAndWait(
|
|
14431
|
+
resourceGroupName,
|
|
14432
|
+
workspaceName,
|
|
14433
|
+
params.endpointName,
|
|
14434
|
+
{
|
|
14435
|
+
location: endpointLro.location,
|
|
14436
|
+
properties: {
|
|
14437
|
+
authMode: "Key",
|
|
14438
|
+
compute: "Managed",
|
|
14439
|
+
traffic: {
|
|
14440
|
+
[params.deploymentName]: 100
|
|
14441
|
+
}
|
|
14442
|
+
}
|
|
14443
|
+
}
|
|
14444
|
+
);
|
|
14445
|
+
return params.endpointName;
|
|
14446
|
+
} catch (e) {
|
|
14447
|
+
throw new Error(`Azure ML Deployment failed: ${e.message}`);
|
|
14448
|
+
}
|
|
14449
|
+
}
|
|
14450
|
+
/**
|
|
14451
|
+
* Retrieves the current provisioning state of an Azure ML Endpoint.
|
|
14452
|
+
*/
|
|
14453
|
+
async getEndpointStatus(endpointName) {
|
|
14454
|
+
const endpoint = await this.client.onlineEndpoints.get(
|
|
14455
|
+
this.config.resourceGroupName,
|
|
14456
|
+
this.config.workspaceName,
|
|
14457
|
+
endpointName
|
|
14458
|
+
);
|
|
14459
|
+
return endpoint.properties?.provisioningState || "Unknown";
|
|
14460
|
+
}
|
|
14461
|
+
};
|
|
14462
|
+
|
|
14463
|
+
// src/models/aws_bedrock.ts
|
|
14464
|
+
var import_client_bedrock_runtime = require("@aws-sdk/client-bedrock-runtime");
|
|
14465
|
+
var AwsBedrockProvider = class extends BaseProvider {
|
|
14466
|
+
client;
|
|
14467
|
+
defaultModel;
|
|
14468
|
+
constructor(config) {
|
|
14469
|
+
super();
|
|
14470
|
+
this.client = new import_client_bedrock_runtime.BedrockRuntimeClient({
|
|
14471
|
+
region: config.region,
|
|
14472
|
+
credentials: config.credentials
|
|
14473
|
+
});
|
|
14474
|
+
this.defaultModel = config.defaultModel || "anthropic.claude-3-haiku-20240307-v1:0";
|
|
14475
|
+
}
|
|
14476
|
+
get providerName() {
|
|
14477
|
+
return "aws_bedrock";
|
|
14478
|
+
}
|
|
14479
|
+
async chatComplete(request) {
|
|
14480
|
+
const modelId = request.model_family === "smart" ? "anthropic.claude-3-sonnet-20240229-v1:0" : this.defaultModel;
|
|
14481
|
+
const systemMessage = request.messages.find((m) => m.role === "system")?.content || "";
|
|
14482
|
+
const userMessages = request.messages.filter((m) => m.role !== "system").map((m) => ({
|
|
14483
|
+
role: m.role,
|
|
14484
|
+
content: [{ type: "text", text: m.content }]
|
|
14485
|
+
}));
|
|
14486
|
+
const payload = {
|
|
14487
|
+
anthropic_version: "bedrock-2023-05-31",
|
|
14488
|
+
max_tokens: request.max_tokens || 1024,
|
|
14489
|
+
system: systemMessage,
|
|
14490
|
+
messages: userMessages,
|
|
14491
|
+
temperature: request.temperature || 0.7
|
|
14492
|
+
};
|
|
14493
|
+
try {
|
|
14494
|
+
const command = new import_client_bedrock_runtime.InvokeModelCommand({
|
|
14495
|
+
modelId,
|
|
14496
|
+
contentType: "application/json",
|
|
14497
|
+
accept: "application/json",
|
|
14498
|
+
body: JSON.stringify(payload)
|
|
14499
|
+
});
|
|
14500
|
+
const response = await this.client.send(command);
|
|
14501
|
+
const responseBody = JSON.parse(new TextDecoder().decode(response.body));
|
|
14502
|
+
return {
|
|
14503
|
+
content: responseBody.content?.[0]?.text || null,
|
|
14504
|
+
usage: {
|
|
14505
|
+
prompt_tokens: responseBody.usage?.input_tokens || 0,
|
|
14506
|
+
completion_tokens: responseBody.usage?.output_tokens || 0,
|
|
14507
|
+
total_tokens: (responseBody.usage?.input_tokens || 0) + (responseBody.usage?.output_tokens || 0)
|
|
14508
|
+
},
|
|
14509
|
+
provider_name: this.providerName,
|
|
14510
|
+
model_name: modelId
|
|
14511
|
+
};
|
|
14512
|
+
} catch (e) {
|
|
14513
|
+
throw new Error(`AWS Bedrock invocation failed: ${e.message}`);
|
|
14514
|
+
}
|
|
14515
|
+
}
|
|
14516
|
+
async *chatStream(request) {
|
|
14517
|
+
const res = await this.chatComplete(request);
|
|
14518
|
+
if (res.content) {
|
|
14519
|
+
yield res.content;
|
|
14520
|
+
}
|
|
14521
|
+
}
|
|
14522
|
+
};
|
|
14523
|
+
|
|
14524
|
+
// src/models/gcp_vertex.ts
|
|
14525
|
+
var import_vertexai = require("@google-cloud/vertexai");
|
|
14526
|
+
var GcpVertexProvider = class extends BaseProvider {
|
|
14527
|
+
client;
|
|
14528
|
+
defaultModel;
|
|
14529
|
+
constructor(config) {
|
|
14530
|
+
super();
|
|
14531
|
+
this.client = new import_vertexai.VertexAI({ project: config.project, location: config.location });
|
|
14532
|
+
this.defaultModel = config.defaultModel || "gemini-1.5-flash-preview-0409";
|
|
14533
|
+
}
|
|
14534
|
+
get providerName() {
|
|
14535
|
+
return "gcp_vertex";
|
|
14536
|
+
}
|
|
14537
|
+
async chatComplete(request) {
|
|
14538
|
+
const model = request.model_family === "smart" ? "gemini-1.5-pro-preview-0409" : this.defaultModel;
|
|
14539
|
+
const generativeModel = this.client.getGenerativeModel({
|
|
14540
|
+
model,
|
|
14541
|
+
generationConfig: {
|
|
14542
|
+
maxOutputTokens: request.max_tokens || 1024,
|
|
14543
|
+
temperature: request.temperature || 0.7
|
|
14544
|
+
}
|
|
14545
|
+
});
|
|
14546
|
+
const systemInstruction = request.messages.find((m) => m.role === "system")?.content || void 0;
|
|
14547
|
+
const contents = request.messages.filter((m) => m.role !== "system").map((m) => ({
|
|
14548
|
+
role: m.role === "assistant" ? "model" : "user",
|
|
14549
|
+
parts: [{ text: m.content }]
|
|
14550
|
+
}));
|
|
14551
|
+
try {
|
|
14552
|
+
const response = await generativeModel.generateContent({
|
|
14553
|
+
contents,
|
|
14554
|
+
systemInstruction: systemInstruction ? { role: "system", parts: [{ text: systemInstruction }] } : void 0
|
|
14555
|
+
});
|
|
14556
|
+
const responseText = response.response.candidates?.[0]?.content?.parts?.[0]?.text || null;
|
|
14557
|
+
return {
|
|
14558
|
+
content: responseText,
|
|
14559
|
+
usage: {
|
|
14560
|
+
prompt_tokens: response.response.usageMetadata?.promptTokenCount || 0,
|
|
14561
|
+
completion_tokens: response.response.usageMetadata?.candidatesTokenCount || 0,
|
|
14562
|
+
total_tokens: response.response.usageMetadata?.totalTokenCount || 0
|
|
14563
|
+
},
|
|
14564
|
+
provider_name: this.providerName,
|
|
14565
|
+
model_name: model
|
|
14566
|
+
};
|
|
14567
|
+
} catch (e) {
|
|
14568
|
+
throw new Error(`GCP Vertex invocation failed: ${e.message}`);
|
|
14569
|
+
}
|
|
14570
|
+
}
|
|
14571
|
+
async *chatStream(request) {
|
|
14572
|
+
const model = request.model_family === "smart" ? "gemini-1.5-pro-preview-0409" : this.defaultModel;
|
|
14573
|
+
const generativeModel = this.client.getGenerativeModel({ model });
|
|
14574
|
+
const contents = request.messages.filter((m) => m.role !== "system").map((m) => ({
|
|
14575
|
+
role: m.role === "assistant" ? "model" : "user",
|
|
14576
|
+
parts: [{ text: m.content }]
|
|
14577
|
+
}));
|
|
14578
|
+
const stream = await generativeModel.generateContentStream({ contents });
|
|
14579
|
+
for await (const chunk of stream.stream) {
|
|
14580
|
+
if (chunk.candidates?.[0]?.content?.parts?.[0]?.text) {
|
|
14581
|
+
yield chunk.candidates[0].content.parts[0].text;
|
|
14582
|
+
}
|
|
14583
|
+
}
|
|
14584
|
+
}
|
|
14585
|
+
};
|
|
14586
|
+
|
|
14587
|
+
// src/models/azure_openai.ts
|
|
14588
|
+
var import_openai6 = require("@azure/openai");
|
|
14589
|
+
var AzureOpenAiProvider = class extends BaseProvider {
|
|
14590
|
+
client;
|
|
14591
|
+
deploymentName;
|
|
14592
|
+
constructor(config) {
|
|
14593
|
+
super();
|
|
14594
|
+
this.client = new import_openai6.OpenAIClient(config.endpoint, new import_openai6.AzureKeyCredential(config.apiKey));
|
|
14595
|
+
this.deploymentName = config.deploymentName || "gpt-35-turbo";
|
|
14596
|
+
}
|
|
14597
|
+
get providerName() {
|
|
14598
|
+
return "azure_openai";
|
|
14599
|
+
}
|
|
14600
|
+
async chatComplete(request) {
|
|
14601
|
+
try {
|
|
14602
|
+
const response = await this.client.getChatCompletions(
|
|
14603
|
+
this.deploymentName,
|
|
14604
|
+
request.messages.map((m) => ({
|
|
14605
|
+
role: m.role,
|
|
14606
|
+
content: m.content
|
|
14607
|
+
})),
|
|
14608
|
+
{
|
|
14609
|
+
maxTokens: request.max_tokens || 1024,
|
|
14610
|
+
temperature: request.temperature || 0.7
|
|
14611
|
+
}
|
|
14612
|
+
);
|
|
14613
|
+
const message = response.choices[0].message;
|
|
14614
|
+
return {
|
|
14615
|
+
content: message?.content || null,
|
|
14616
|
+
tool_calls: message?.toolCalls ? message.toolCalls.map((tc) => ({
|
|
14617
|
+
id: tc.id,
|
|
14618
|
+
function: {
|
|
14619
|
+
name: tc.function?.name,
|
|
14620
|
+
arguments: tc.function?.arguments
|
|
14621
|
+
}
|
|
14622
|
+
})) : void 0,
|
|
14623
|
+
usage: {
|
|
14624
|
+
prompt_tokens: response.usage?.promptTokens || 0,
|
|
14625
|
+
completion_tokens: response.usage?.completionTokens || 0,
|
|
14626
|
+
total_tokens: response.usage?.totalTokens || 0
|
|
14627
|
+
},
|
|
14628
|
+
provider_name: this.providerName,
|
|
14629
|
+
model_name: this.deploymentName
|
|
14630
|
+
};
|
|
14631
|
+
} catch (e) {
|
|
14632
|
+
throw new Error(`Azure OpenAI invocation failed: ${e.message}`);
|
|
14633
|
+
}
|
|
14634
|
+
}
|
|
14635
|
+
async *chatStream(request) {
|
|
14636
|
+
const stream = await this.client.streamChatCompletions(
|
|
14637
|
+
this.deploymentName,
|
|
14638
|
+
request.messages.map((m) => ({
|
|
14639
|
+
role: m.role,
|
|
14640
|
+
content: m.content
|
|
14641
|
+
})),
|
|
14642
|
+
{
|
|
14643
|
+
maxTokens: request.max_tokens || 1024,
|
|
14644
|
+
temperature: request.temperature || 0.7
|
|
14645
|
+
}
|
|
14646
|
+
);
|
|
14647
|
+
for await (const chunk of stream) {
|
|
14648
|
+
for (const choice of chunk.choices) {
|
|
14649
|
+
if (choice.delta?.content) {
|
|
14650
|
+
yield choice.delta.content;
|
|
14651
|
+
}
|
|
14652
|
+
}
|
|
14653
|
+
}
|
|
14654
|
+
}
|
|
14655
|
+
};
|
|
14268
14656
|
// Annotate the CommonJS export names for ESM import in node:
|
|
14269
14657
|
0 && (module.exports = {
|
|
14270
14658
|
AIModelGateway,
|
|
@@ -14273,6 +14661,10 @@ var InferenceEndpointManager = class {
|
|
|
14273
14661
|
AgentIterationLimitError,
|
|
14274
14662
|
AgentPipeline,
|
|
14275
14663
|
AgentRouter,
|
|
14664
|
+
AwsBedrockProvider,
|
|
14665
|
+
AwsSageMakerDeployer,
|
|
14666
|
+
AzureMlDeployer,
|
|
14667
|
+
AzureOpenAiProvider,
|
|
14276
14668
|
BaseProvider,
|
|
14277
14669
|
BaseSTTProvider,
|
|
14278
14670
|
BaseSpeakerRecognizer,
|
|
@@ -14290,9 +14682,10 @@ var InferenceEndpointManager = class {
|
|
|
14290
14682
|
DEFAULT_REDACTION_RULES,
|
|
14291
14683
|
EchoAI,
|
|
14292
14684
|
EchoVoice,
|
|
14293
|
-
ExperimentManager,
|
|
14294
14685
|
FileSessionStore,
|
|
14295
14686
|
GatewayRoutingError,
|
|
14687
|
+
GcpVertexManager,
|
|
14688
|
+
GcpVertexProvider,
|
|
14296
14689
|
HandoffManager,
|
|
14297
14690
|
HuggingFaceImageGen,
|
|
14298
14691
|
HuggingFaceTTS,
|
package/dist/index.mjs
CHANGED
|
@@ -1676,23 +1676,23 @@ function getName(value) {
|
|
|
1676
1676
|
return (typeof value === "object" && value !== null && ("name" in value && value.name && String(value.name) || "url" in value && value.url && String(value.url) || "filename" in value && value.filename && String(value.filename) || "path" in value && value.path && String(value.path)) || "").split(/[\\/]/).pop() || void 0;
|
|
1677
1677
|
}
|
|
1678
1678
|
var isAsyncIterable = (value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function";
|
|
1679
|
-
var maybeMultipartFormRequestOptions = async (opts,
|
|
1679
|
+
var maybeMultipartFormRequestOptions = async (opts, fetch7) => {
|
|
1680
1680
|
if (!hasUploadableValue(opts.body))
|
|
1681
1681
|
return opts;
|
|
1682
|
-
return { ...opts, body: await createForm(opts.body,
|
|
1682
|
+
return { ...opts, body: await createForm(opts.body, fetch7) };
|
|
1683
1683
|
};
|
|
1684
|
-
var multipartFormRequestOptions = async (opts,
|
|
1685
|
-
return { ...opts, body: await createForm(opts.body,
|
|
1684
|
+
var multipartFormRequestOptions = async (opts, fetch7) => {
|
|
1685
|
+
return { ...opts, body: await createForm(opts.body, fetch7) };
|
|
1686
1686
|
};
|
|
1687
1687
|
var supportsFormDataMap = /* @__PURE__ */ new WeakMap();
|
|
1688
1688
|
function supportsFormData(fetchObject) {
|
|
1689
|
-
const
|
|
1690
|
-
const cached = supportsFormDataMap.get(
|
|
1689
|
+
const fetch7 = typeof fetchObject === "function" ? fetchObject : fetchObject.fetch;
|
|
1690
|
+
const cached = supportsFormDataMap.get(fetch7);
|
|
1691
1691
|
if (cached)
|
|
1692
1692
|
return cached;
|
|
1693
1693
|
const promise = (async () => {
|
|
1694
1694
|
try {
|
|
1695
|
-
const FetchResponse = "Response" in
|
|
1695
|
+
const FetchResponse = "Response" in fetch7 ? fetch7.Response : (await fetch7("data:,")).constructor;
|
|
1696
1696
|
const data = new FormData();
|
|
1697
1697
|
if (data.toString() === await new FetchResponse(data).text()) {
|
|
1698
1698
|
return false;
|
|
@@ -1702,11 +1702,11 @@ function supportsFormData(fetchObject) {
|
|
|
1702
1702
|
return true;
|
|
1703
1703
|
}
|
|
1704
1704
|
})();
|
|
1705
|
-
supportsFormDataMap.set(
|
|
1705
|
+
supportsFormDataMap.set(fetch7, promise);
|
|
1706
1706
|
return promise;
|
|
1707
1707
|
}
|
|
1708
|
-
var createForm = async (body,
|
|
1709
|
-
if (!await supportsFormData(
|
|
1708
|
+
var createForm = async (body, fetch7) => {
|
|
1709
|
+
if (!await supportsFormData(fetch7)) {
|
|
1710
1710
|
throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");
|
|
1711
1711
|
}
|
|
1712
1712
|
const form = new FormData();
|
|
@@ -8339,18 +8339,18 @@ function getName2(value, stripPath) {
|
|
|
8339
8339
|
return stripPath ? val.split(/[\\/]/).pop() || void 0 : val;
|
|
8340
8340
|
}
|
|
8341
8341
|
var isAsyncIterable2 = (value) => value != null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function";
|
|
8342
|
-
var multipartFormRequestOptions2 = async (opts,
|
|
8343
|
-
return { ...opts, body: await createForm2(opts.body,
|
|
8342
|
+
var multipartFormRequestOptions2 = async (opts, fetch7, stripFilenames = true) => {
|
|
8343
|
+
return { ...opts, body: await createForm2(opts.body, fetch7, stripFilenames) };
|
|
8344
8344
|
};
|
|
8345
8345
|
var supportsFormDataMap2 = /* @__PURE__ */ new WeakMap();
|
|
8346
8346
|
function supportsFormData2(fetchObject) {
|
|
8347
|
-
const
|
|
8348
|
-
const cached = supportsFormDataMap2.get(
|
|
8347
|
+
const fetch7 = typeof fetchObject === "function" ? fetchObject : fetchObject.fetch;
|
|
8348
|
+
const cached = supportsFormDataMap2.get(fetch7);
|
|
8349
8349
|
if (cached)
|
|
8350
8350
|
return cached;
|
|
8351
8351
|
const promise = (async () => {
|
|
8352
8352
|
try {
|
|
8353
|
-
const FetchResponse = "Response" in
|
|
8353
|
+
const FetchResponse = "Response" in fetch7 ? fetch7.Response : (await fetch7("data:,")).constructor;
|
|
8354
8354
|
const data = new FormData();
|
|
8355
8355
|
if (data.toString() === await new FetchResponse(data).text()) {
|
|
8356
8356
|
return false;
|
|
@@ -8360,11 +8360,11 @@ function supportsFormData2(fetchObject) {
|
|
|
8360
8360
|
return true;
|
|
8361
8361
|
}
|
|
8362
8362
|
})();
|
|
8363
|
-
supportsFormDataMap2.set(
|
|
8363
|
+
supportsFormDataMap2.set(fetch7, promise);
|
|
8364
8364
|
return promise;
|
|
8365
8365
|
}
|
|
8366
|
-
var createForm2 = async (body,
|
|
8367
|
-
if (!await supportsFormData2(
|
|
8366
|
+
var createForm2 = async (body, fetch7, stripFilenames = true) => {
|
|
8367
|
+
if (!await supportsFormData2(fetch7)) {
|
|
8368
8368
|
throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");
|
|
8369
8369
|
}
|
|
8370
8370
|
const form = new FormData();
|
|
@@ -12882,6 +12882,7 @@ var EchoVoice = class {
|
|
|
12882
12882
|
};
|
|
12883
12883
|
|
|
12884
12884
|
// src/widget/connector.ts
|
|
12885
|
+
import fetch2 from "cross-fetch";
|
|
12885
12886
|
var APIConnector = class {
|
|
12886
12887
|
baseUrl;
|
|
12887
12888
|
headers;
|
|
@@ -12909,7 +12910,7 @@ var APIConnector = class {
|
|
|
12909
12910
|
const controller = new AbortController();
|
|
12910
12911
|
const timer = setTimeout(() => controller.abort(), this.timeout);
|
|
12911
12912
|
try {
|
|
12912
|
-
const response = await
|
|
12913
|
+
const response = await fetch2(url, {
|
|
12913
12914
|
method,
|
|
12914
12915
|
headers: this.headers,
|
|
12915
12916
|
body: body ? JSON.stringify(body) : void 0,
|
|
@@ -12929,6 +12930,7 @@ var APIConnector = class {
|
|
|
12929
12930
|
import { z as z4 } from "zod";
|
|
12930
12931
|
|
|
12931
12932
|
// src/rag/knowledge.ts
|
|
12933
|
+
import fetch3 from "cross-fetch";
|
|
12932
12934
|
import * as fs from "fs/promises";
|
|
12933
12935
|
function cosineSimilarity(a, b) {
|
|
12934
12936
|
if (a.length !== b.length) return 0;
|
|
@@ -13057,7 +13059,7 @@ var KnowledgeBase = class {
|
|
|
13057
13059
|
return chunks.length;
|
|
13058
13060
|
}
|
|
13059
13061
|
async ingestURL(url) {
|
|
13060
|
-
const response = await
|
|
13062
|
+
const response = await fetch3(url);
|
|
13061
13063
|
const html = await response.text();
|
|
13062
13064
|
const text = html.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<style[^>]*>[\s\S]*?<\/style>/gi, "").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
13063
13065
|
return this.ingestText(text, url);
|
|
@@ -13262,6 +13264,7 @@ var ConversationAnalytics = class {
|
|
|
13262
13264
|
};
|
|
13263
13265
|
|
|
13264
13266
|
// src/analytics/handoff.ts
|
|
13267
|
+
import fetch4 from "cross-fetch";
|
|
13265
13268
|
import * as crypto2 from "crypto";
|
|
13266
13269
|
var HandoffManager = class {
|
|
13267
13270
|
webhookUrl;
|
|
@@ -13370,7 +13373,7 @@ var HandoffManager = class {
|
|
|
13370
13373
|
headers["X-Webhook-Signature"] = `sha256=${hmac.digest("hex")}`;
|
|
13371
13374
|
}
|
|
13372
13375
|
try {
|
|
13373
|
-
await
|
|
13376
|
+
await fetch4(this.webhookUrl, { method: "POST", headers, body });
|
|
13374
13377
|
} catch (e) {
|
|
13375
13378
|
console.error(`[HandoffManager] Webhook dispatch failed: ${e.message}`);
|
|
13376
13379
|
}
|
|
@@ -14056,6 +14059,7 @@ var SlackAdapter = class extends ChannelAdapter {
|
|
|
14056
14059
|
};
|
|
14057
14060
|
|
|
14058
14061
|
// src/channels/telegram.ts
|
|
14062
|
+
import fetch5 from "cross-fetch";
|
|
14059
14063
|
var TelegramAdapter = class extends ChannelAdapter {
|
|
14060
14064
|
token;
|
|
14061
14065
|
polling = false;
|
|
@@ -14075,7 +14079,7 @@ var TelegramAdapter = class extends ChannelAdapter {
|
|
|
14075
14079
|
async runPollingLoop() {
|
|
14076
14080
|
while (this.polling) {
|
|
14077
14081
|
try {
|
|
14078
|
-
const response = await
|
|
14082
|
+
const response = await fetch5(`https://api.telegram.org/bot${this.token}/getUpdates?offset=${this.offset}&timeout=30`);
|
|
14079
14083
|
const data = await response.json();
|
|
14080
14084
|
if (data.ok && data.result && data.result.length > 0) {
|
|
14081
14085
|
for (const update of data.result) {
|
|
@@ -14094,7 +14098,7 @@ var TelegramAdapter = class extends ChannelAdapter {
|
|
|
14094
14098
|
}
|
|
14095
14099
|
}
|
|
14096
14100
|
async sendMessage(chatId, text) {
|
|
14097
|
-
await
|
|
14101
|
+
await fetch5(`https://api.telegram.org/bot${this.token}/sendMessage`, {
|
|
14098
14102
|
method: "POST",
|
|
14099
14103
|
headers: { "Content-Type": "application/json" },
|
|
14100
14104
|
body: JSON.stringify({ chat_id: chatId, text })
|
|
@@ -14103,6 +14107,7 @@ var TelegramAdapter = class extends ChannelAdapter {
|
|
|
14103
14107
|
};
|
|
14104
14108
|
|
|
14105
14109
|
// src/deployment/huggingface_manager.ts
|
|
14110
|
+
import fetch6 from "cross-fetch";
|
|
14106
14111
|
var InferenceEndpointManager = class {
|
|
14107
14112
|
token;
|
|
14108
14113
|
baseUrl = "https://api.endpoints.huggingface.cloud/v2";
|
|
@@ -14139,7 +14144,7 @@ var InferenceEndpointManager = class {
|
|
|
14139
14144
|
}
|
|
14140
14145
|
}
|
|
14141
14146
|
};
|
|
14142
|
-
const res = await
|
|
14147
|
+
const res = await fetch6(url, {
|
|
14143
14148
|
method: "POST",
|
|
14144
14149
|
headers: this.headers,
|
|
14145
14150
|
body: JSON.stringify(payload)
|
|
@@ -14155,7 +14160,7 @@ var InferenceEndpointManager = class {
|
|
|
14155
14160
|
*/
|
|
14156
14161
|
async getEndpointStatus(accountId, endpointName) {
|
|
14157
14162
|
const url = `${this.baseUrl}/endpoint/${accountId}/${endpointName}`;
|
|
14158
|
-
const res = await
|
|
14163
|
+
const res = await fetch6(url, { headers: this.headers });
|
|
14159
14164
|
if (!res.ok) throw new Error("Could not fetch endpoint status");
|
|
14160
14165
|
const data = await res.json();
|
|
14161
14166
|
return data.status.state;
|
|
@@ -14165,7 +14170,7 @@ var InferenceEndpointManager = class {
|
|
|
14165
14170
|
*/
|
|
14166
14171
|
async pauseEndpoint(accountId, endpointName) {
|
|
14167
14172
|
const url = `${this.baseUrl}/endpoint/${accountId}/${endpointName}/pause`;
|
|
14168
|
-
const res = await
|
|
14173
|
+
const res = await fetch6(url, { method: "POST", headers: this.headers });
|
|
14169
14174
|
if (!res.ok) throw new Error("Failed to pause endpoint");
|
|
14170
14175
|
}
|
|
14171
14176
|
/**
|
|
@@ -14173,10 +14178,388 @@ var InferenceEndpointManager = class {
|
|
|
14173
14178
|
*/
|
|
14174
14179
|
async resumeEndpoint(accountId, endpointName) {
|
|
14175
14180
|
const url = `${this.baseUrl}/endpoint/${accountId}/${endpointName}/resume`;
|
|
14176
|
-
const res = await
|
|
14181
|
+
const res = await fetch6(url, { method: "POST", headers: this.headers });
|
|
14177
14182
|
if (!res.ok) throw new Error("Failed to resume endpoint");
|
|
14178
14183
|
}
|
|
14179
14184
|
};
|
|
14185
|
+
|
|
14186
|
+
// src/deployment/aws_sagemaker.ts
|
|
14187
|
+
import { SageMakerClient, CreateModelCommand, CreateEndpointConfigCommand, CreateEndpointCommand, DescribeEndpointCommand } from "@aws-sdk/client-sagemaker";
|
|
14188
|
+
var AwsSageMakerDeployer = class {
|
|
14189
|
+
client;
|
|
14190
|
+
constructor(config) {
|
|
14191
|
+
this.client = new SageMakerClient({
|
|
14192
|
+
region: config.region,
|
|
14193
|
+
credentials: config.credentials
|
|
14194
|
+
});
|
|
14195
|
+
}
|
|
14196
|
+
/**
|
|
14197
|
+
* Orchestrates the 3-step SageMaker deployment process.
|
|
14198
|
+
*/
|
|
14199
|
+
async deployEndpoint(params) {
|
|
14200
|
+
const configName = `${params.modelName}-config-${Date.now()}`;
|
|
14201
|
+
const endpointName = `${params.modelName}-endpoint`;
|
|
14202
|
+
try {
|
|
14203
|
+
await this.client.send(new CreateModelCommand({
|
|
14204
|
+
ModelName: params.modelName,
|
|
14205
|
+
PrimaryContainer: {
|
|
14206
|
+
Image: params.primaryContainerImage,
|
|
14207
|
+
ModelDataUrl: params.modelDataUrl,
|
|
14208
|
+
Environment: {
|
|
14209
|
+
// HF specific deployment variables if using Hugging Face DLC
|
|
14210
|
+
"HF_MODEL_ID": params.modelName,
|
|
14211
|
+
"HF_TASK": "text-generation"
|
|
14212
|
+
}
|
|
14213
|
+
},
|
|
14214
|
+
ExecutionRoleArn: params.executionRoleArn
|
|
14215
|
+
}));
|
|
14216
|
+
await this.client.send(new CreateEndpointConfigCommand({
|
|
14217
|
+
EndpointConfigName: configName,
|
|
14218
|
+
ProductionVariants: [{
|
|
14219
|
+
VariantName: "AllTraffic",
|
|
14220
|
+
ModelName: params.modelName,
|
|
14221
|
+
InitialInstanceCount: params.initialInstanceCount || 1,
|
|
14222
|
+
InstanceType: params.instanceType || "ml.g5.xlarge"
|
|
14223
|
+
}]
|
|
14224
|
+
}));
|
|
14225
|
+
await this.client.send(new CreateEndpointCommand({
|
|
14226
|
+
EndpointName: endpointName,
|
|
14227
|
+
EndpointConfigName: configName
|
|
14228
|
+
}));
|
|
14229
|
+
return endpointName;
|
|
14230
|
+
} catch (e) {
|
|
14231
|
+
throw new Error(`AWS SageMaker deployment failed: ${e.message}`);
|
|
14232
|
+
}
|
|
14233
|
+
}
|
|
14234
|
+
/**
|
|
14235
|
+
* Checks the provisioning status of a SageMaker Endpoint.
|
|
14236
|
+
*/
|
|
14237
|
+
async getEndpointStatus(endpointName) {
|
|
14238
|
+
const res = await this.client.send(new DescribeEndpointCommand({ EndpointName: endpointName }));
|
|
14239
|
+
return res.EndpointStatus || "Unknown";
|
|
14240
|
+
}
|
|
14241
|
+
};
|
|
14242
|
+
|
|
14243
|
+
// src/deployment/gcp_vertex_manager.ts
|
|
14244
|
+
import { EndpointServiceClient } from "@google-cloud/aiplatform";
|
|
14245
|
+
var GcpVertexManager = class {
|
|
14246
|
+
client;
|
|
14247
|
+
project;
|
|
14248
|
+
location;
|
|
14249
|
+
constructor(config) {
|
|
14250
|
+
this.client = new EndpointServiceClient({
|
|
14251
|
+
apiEndpoint: `${config.location}-aiplatform.googleapis.com`
|
|
14252
|
+
});
|
|
14253
|
+
this.project = config.project;
|
|
14254
|
+
this.location = config.location;
|
|
14255
|
+
}
|
|
14256
|
+
/**
|
|
14257
|
+
* Deploys an uploaded Vertex AI Model Resource to a newly created Endpoint.
|
|
14258
|
+
*/
|
|
14259
|
+
async deployModel(params) {
|
|
14260
|
+
const parent = `projects/${this.project}/locations/${this.location}`;
|
|
14261
|
+
const [endpointLro] = await this.client.createEndpoint({
|
|
14262
|
+
parent,
|
|
14263
|
+
endpoint: { displayName: `${params.displayName}-endpoint` }
|
|
14264
|
+
});
|
|
14265
|
+
const [endpointResponse] = await endpointLro.promise();
|
|
14266
|
+
const endpointName = endpointResponse.name;
|
|
14267
|
+
const [deployLro] = await this.client.deployModel({
|
|
14268
|
+
endpoint: endpointName,
|
|
14269
|
+
deployedModel: {
|
|
14270
|
+
model: params.modelName,
|
|
14271
|
+
displayName: `${params.displayName}-deployment`,
|
|
14272
|
+
dedicatedResources: {
|
|
14273
|
+
machineSpec: {
|
|
14274
|
+
machineType: params.machineType || "n1-standard-4",
|
|
14275
|
+
acceleratorType: params.acceleratorType || void 0,
|
|
14276
|
+
acceleratorCount: params.acceleratorCount || 0
|
|
14277
|
+
},
|
|
14278
|
+
minReplicaCount: 1,
|
|
14279
|
+
maxReplicaCount: 1
|
|
14280
|
+
}
|
|
14281
|
+
}
|
|
14282
|
+
});
|
|
14283
|
+
console.log("Waiting for Vertex AI deployment LRO to finish...");
|
|
14284
|
+
await deployLro.promise();
|
|
14285
|
+
return endpointName;
|
|
14286
|
+
}
|
|
14287
|
+
};
|
|
14288
|
+
|
|
14289
|
+
// src/deployment/azure_ml.ts
|
|
14290
|
+
import { AzureMachineLearningServicesManagementClient } from "@azure/arm-machinelearning";
|
|
14291
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
14292
|
+
var AzureMlDeployer = class {
|
|
14293
|
+
client;
|
|
14294
|
+
config;
|
|
14295
|
+
constructor(config) {
|
|
14296
|
+
const credential = new DefaultAzureCredential();
|
|
14297
|
+
this.client = new AzureMachineLearningServicesManagementClient(credential, config.subscriptionId);
|
|
14298
|
+
this.config = config;
|
|
14299
|
+
}
|
|
14300
|
+
/**
|
|
14301
|
+
* Orchestrates the creation of an Azure Managed Online Endpoint and Deployment.
|
|
14302
|
+
*/
|
|
14303
|
+
async deployEndpoint(params) {
|
|
14304
|
+
const { resourceGroupName, workspaceName } = this.config;
|
|
14305
|
+
try {
|
|
14306
|
+
const endpointLro = await this.client.onlineEndpoints.beginCreateOrUpdateAndWait(
|
|
14307
|
+
resourceGroupName,
|
|
14308
|
+
workspaceName,
|
|
14309
|
+
params.endpointName,
|
|
14310
|
+
{
|
|
14311
|
+
location: "eastus",
|
|
14312
|
+
// Would ideally be dynamic based on workspace location
|
|
14313
|
+
properties: {
|
|
14314
|
+
authMode: "Key",
|
|
14315
|
+
compute: "Managed"
|
|
14316
|
+
}
|
|
14317
|
+
}
|
|
14318
|
+
);
|
|
14319
|
+
await this.client.onlineDeployments.beginCreateOrUpdateAndWait(
|
|
14320
|
+
resourceGroupName,
|
|
14321
|
+
workspaceName,
|
|
14322
|
+
params.endpointName,
|
|
14323
|
+
params.deploymentName,
|
|
14324
|
+
{
|
|
14325
|
+
location: endpointLro.location,
|
|
14326
|
+
properties: {
|
|
14327
|
+
endpointComputeType: "Managed",
|
|
14328
|
+
model: params.modelId,
|
|
14329
|
+
instanceType: params.instanceType || "Standard_DS3_v2",
|
|
14330
|
+
scaleSettings: {
|
|
14331
|
+
scaleType: "Default",
|
|
14332
|
+
instanceCount: Math.max(1, params.instanceCount || 1)
|
|
14333
|
+
}
|
|
14334
|
+
}
|
|
14335
|
+
}
|
|
14336
|
+
);
|
|
14337
|
+
await this.client.onlineEndpoints.beginCreateOrUpdateAndWait(
|
|
14338
|
+
resourceGroupName,
|
|
14339
|
+
workspaceName,
|
|
14340
|
+
params.endpointName,
|
|
14341
|
+
{
|
|
14342
|
+
location: endpointLro.location,
|
|
14343
|
+
properties: {
|
|
14344
|
+
authMode: "Key",
|
|
14345
|
+
compute: "Managed",
|
|
14346
|
+
traffic: {
|
|
14347
|
+
[params.deploymentName]: 100
|
|
14348
|
+
}
|
|
14349
|
+
}
|
|
14350
|
+
}
|
|
14351
|
+
);
|
|
14352
|
+
return params.endpointName;
|
|
14353
|
+
} catch (e) {
|
|
14354
|
+
throw new Error(`Azure ML Deployment failed: ${e.message}`);
|
|
14355
|
+
}
|
|
14356
|
+
}
|
|
14357
|
+
/**
|
|
14358
|
+
* Retrieves the current provisioning state of an Azure ML Endpoint.
|
|
14359
|
+
*/
|
|
14360
|
+
async getEndpointStatus(endpointName) {
|
|
14361
|
+
const endpoint = await this.client.onlineEndpoints.get(
|
|
14362
|
+
this.config.resourceGroupName,
|
|
14363
|
+
this.config.workspaceName,
|
|
14364
|
+
endpointName
|
|
14365
|
+
);
|
|
14366
|
+
return endpoint.properties?.provisioningState || "Unknown";
|
|
14367
|
+
}
|
|
14368
|
+
};
|
|
14369
|
+
|
|
14370
|
+
// src/models/aws_bedrock.ts
|
|
14371
|
+
import { BedrockRuntimeClient, InvokeModelCommand } from "@aws-sdk/client-bedrock-runtime";
|
|
14372
|
+
var AwsBedrockProvider = class extends BaseProvider {
|
|
14373
|
+
client;
|
|
14374
|
+
defaultModel;
|
|
14375
|
+
constructor(config) {
|
|
14376
|
+
super();
|
|
14377
|
+
this.client = new BedrockRuntimeClient({
|
|
14378
|
+
region: config.region,
|
|
14379
|
+
credentials: config.credentials
|
|
14380
|
+
});
|
|
14381
|
+
this.defaultModel = config.defaultModel || "anthropic.claude-3-haiku-20240307-v1:0";
|
|
14382
|
+
}
|
|
14383
|
+
get providerName() {
|
|
14384
|
+
return "aws_bedrock";
|
|
14385
|
+
}
|
|
14386
|
+
async chatComplete(request) {
|
|
14387
|
+
const modelId = request.model_family === "smart" ? "anthropic.claude-3-sonnet-20240229-v1:0" : this.defaultModel;
|
|
14388
|
+
const systemMessage = request.messages.find((m) => m.role === "system")?.content || "";
|
|
14389
|
+
const userMessages = request.messages.filter((m) => m.role !== "system").map((m) => ({
|
|
14390
|
+
role: m.role,
|
|
14391
|
+
content: [{ type: "text", text: m.content }]
|
|
14392
|
+
}));
|
|
14393
|
+
const payload = {
|
|
14394
|
+
anthropic_version: "bedrock-2023-05-31",
|
|
14395
|
+
max_tokens: request.max_tokens || 1024,
|
|
14396
|
+
system: systemMessage,
|
|
14397
|
+
messages: userMessages,
|
|
14398
|
+
temperature: request.temperature || 0.7
|
|
14399
|
+
};
|
|
14400
|
+
try {
|
|
14401
|
+
const command = new InvokeModelCommand({
|
|
14402
|
+
modelId,
|
|
14403
|
+
contentType: "application/json",
|
|
14404
|
+
accept: "application/json",
|
|
14405
|
+
body: JSON.stringify(payload)
|
|
14406
|
+
});
|
|
14407
|
+
const response = await this.client.send(command);
|
|
14408
|
+
const responseBody = JSON.parse(new TextDecoder().decode(response.body));
|
|
14409
|
+
return {
|
|
14410
|
+
content: responseBody.content?.[0]?.text || null,
|
|
14411
|
+
usage: {
|
|
14412
|
+
prompt_tokens: responseBody.usage?.input_tokens || 0,
|
|
14413
|
+
completion_tokens: responseBody.usage?.output_tokens || 0,
|
|
14414
|
+
total_tokens: (responseBody.usage?.input_tokens || 0) + (responseBody.usage?.output_tokens || 0)
|
|
14415
|
+
},
|
|
14416
|
+
provider_name: this.providerName,
|
|
14417
|
+
model_name: modelId
|
|
14418
|
+
};
|
|
14419
|
+
} catch (e) {
|
|
14420
|
+
throw new Error(`AWS Bedrock invocation failed: ${e.message}`);
|
|
14421
|
+
}
|
|
14422
|
+
}
|
|
14423
|
+
async *chatStream(request) {
|
|
14424
|
+
const res = await this.chatComplete(request);
|
|
14425
|
+
if (res.content) {
|
|
14426
|
+
yield res.content;
|
|
14427
|
+
}
|
|
14428
|
+
}
|
|
14429
|
+
};
|
|
14430
|
+
|
|
14431
|
+
// src/models/gcp_vertex.ts
|
|
14432
|
+
import { VertexAI } from "@google-cloud/vertexai";
|
|
14433
|
+
var GcpVertexProvider = class extends BaseProvider {
|
|
14434
|
+
client;
|
|
14435
|
+
defaultModel;
|
|
14436
|
+
constructor(config) {
|
|
14437
|
+
super();
|
|
14438
|
+
this.client = new VertexAI({ project: config.project, location: config.location });
|
|
14439
|
+
this.defaultModel = config.defaultModel || "gemini-1.5-flash-preview-0409";
|
|
14440
|
+
}
|
|
14441
|
+
get providerName() {
|
|
14442
|
+
return "gcp_vertex";
|
|
14443
|
+
}
|
|
14444
|
+
async chatComplete(request) {
|
|
14445
|
+
const model = request.model_family === "smart" ? "gemini-1.5-pro-preview-0409" : this.defaultModel;
|
|
14446
|
+
const generativeModel = this.client.getGenerativeModel({
|
|
14447
|
+
model,
|
|
14448
|
+
generationConfig: {
|
|
14449
|
+
maxOutputTokens: request.max_tokens || 1024,
|
|
14450
|
+
temperature: request.temperature || 0.7
|
|
14451
|
+
}
|
|
14452
|
+
});
|
|
14453
|
+
const systemInstruction = request.messages.find((m) => m.role === "system")?.content || void 0;
|
|
14454
|
+
const contents = request.messages.filter((m) => m.role !== "system").map((m) => ({
|
|
14455
|
+
role: m.role === "assistant" ? "model" : "user",
|
|
14456
|
+
parts: [{ text: m.content }]
|
|
14457
|
+
}));
|
|
14458
|
+
try {
|
|
14459
|
+
const response = await generativeModel.generateContent({
|
|
14460
|
+
contents,
|
|
14461
|
+
systemInstruction: systemInstruction ? { role: "system", parts: [{ text: systemInstruction }] } : void 0
|
|
14462
|
+
});
|
|
14463
|
+
const responseText = response.response.candidates?.[0]?.content?.parts?.[0]?.text || null;
|
|
14464
|
+
return {
|
|
14465
|
+
content: responseText,
|
|
14466
|
+
usage: {
|
|
14467
|
+
prompt_tokens: response.response.usageMetadata?.promptTokenCount || 0,
|
|
14468
|
+
completion_tokens: response.response.usageMetadata?.candidatesTokenCount || 0,
|
|
14469
|
+
total_tokens: response.response.usageMetadata?.totalTokenCount || 0
|
|
14470
|
+
},
|
|
14471
|
+
provider_name: this.providerName,
|
|
14472
|
+
model_name: model
|
|
14473
|
+
};
|
|
14474
|
+
} catch (e) {
|
|
14475
|
+
throw new Error(`GCP Vertex invocation failed: ${e.message}`);
|
|
14476
|
+
}
|
|
14477
|
+
}
|
|
14478
|
+
async *chatStream(request) {
|
|
14479
|
+
const model = request.model_family === "smart" ? "gemini-1.5-pro-preview-0409" : this.defaultModel;
|
|
14480
|
+
const generativeModel = this.client.getGenerativeModel({ model });
|
|
14481
|
+
const contents = request.messages.filter((m) => m.role !== "system").map((m) => ({
|
|
14482
|
+
role: m.role === "assistant" ? "model" : "user",
|
|
14483
|
+
parts: [{ text: m.content }]
|
|
14484
|
+
}));
|
|
14485
|
+
const stream = await generativeModel.generateContentStream({ contents });
|
|
14486
|
+
for await (const chunk of stream.stream) {
|
|
14487
|
+
if (chunk.candidates?.[0]?.content?.parts?.[0]?.text) {
|
|
14488
|
+
yield chunk.candidates[0].content.parts[0].text;
|
|
14489
|
+
}
|
|
14490
|
+
}
|
|
14491
|
+
}
|
|
14492
|
+
};
|
|
14493
|
+
|
|
14494
|
+
// src/models/azure_openai.ts
|
|
14495
|
+
import { OpenAIClient, AzureKeyCredential } from "@azure/openai";
|
|
14496
|
+
var AzureOpenAiProvider = class extends BaseProvider {
|
|
14497
|
+
client;
|
|
14498
|
+
deploymentName;
|
|
14499
|
+
constructor(config) {
|
|
14500
|
+
super();
|
|
14501
|
+
this.client = new OpenAIClient(config.endpoint, new AzureKeyCredential(config.apiKey));
|
|
14502
|
+
this.deploymentName = config.deploymentName || "gpt-35-turbo";
|
|
14503
|
+
}
|
|
14504
|
+
get providerName() {
|
|
14505
|
+
return "azure_openai";
|
|
14506
|
+
}
|
|
14507
|
+
async chatComplete(request) {
|
|
14508
|
+
try {
|
|
14509
|
+
const response = await this.client.getChatCompletions(
|
|
14510
|
+
this.deploymentName,
|
|
14511
|
+
request.messages.map((m) => ({
|
|
14512
|
+
role: m.role,
|
|
14513
|
+
content: m.content
|
|
14514
|
+
})),
|
|
14515
|
+
{
|
|
14516
|
+
maxTokens: request.max_tokens || 1024,
|
|
14517
|
+
temperature: request.temperature || 0.7
|
|
14518
|
+
}
|
|
14519
|
+
);
|
|
14520
|
+
const message = response.choices[0].message;
|
|
14521
|
+
return {
|
|
14522
|
+
content: message?.content || null,
|
|
14523
|
+
tool_calls: message?.toolCalls ? message.toolCalls.map((tc) => ({
|
|
14524
|
+
id: tc.id,
|
|
14525
|
+
function: {
|
|
14526
|
+
name: tc.function?.name,
|
|
14527
|
+
arguments: tc.function?.arguments
|
|
14528
|
+
}
|
|
14529
|
+
})) : void 0,
|
|
14530
|
+
usage: {
|
|
14531
|
+
prompt_tokens: response.usage?.promptTokens || 0,
|
|
14532
|
+
completion_tokens: response.usage?.completionTokens || 0,
|
|
14533
|
+
total_tokens: response.usage?.totalTokens || 0
|
|
14534
|
+
},
|
|
14535
|
+
provider_name: this.providerName,
|
|
14536
|
+
model_name: this.deploymentName
|
|
14537
|
+
};
|
|
14538
|
+
} catch (e) {
|
|
14539
|
+
throw new Error(`Azure OpenAI invocation failed: ${e.message}`);
|
|
14540
|
+
}
|
|
14541
|
+
}
|
|
14542
|
+
async *chatStream(request) {
|
|
14543
|
+
const stream = await this.client.streamChatCompletions(
|
|
14544
|
+
this.deploymentName,
|
|
14545
|
+
request.messages.map((m) => ({
|
|
14546
|
+
role: m.role,
|
|
14547
|
+
content: m.content
|
|
14548
|
+
})),
|
|
14549
|
+
{
|
|
14550
|
+
maxTokens: request.max_tokens || 1024,
|
|
14551
|
+
temperature: request.temperature || 0.7
|
|
14552
|
+
}
|
|
14553
|
+
);
|
|
14554
|
+
for await (const chunk of stream) {
|
|
14555
|
+
for (const choice of chunk.choices) {
|
|
14556
|
+
if (choice.delta?.content) {
|
|
14557
|
+
yield choice.delta.content;
|
|
14558
|
+
}
|
|
14559
|
+
}
|
|
14560
|
+
}
|
|
14561
|
+
}
|
|
14562
|
+
};
|
|
14180
14563
|
export {
|
|
14181
14564
|
AIModelGateway,
|
|
14182
14565
|
APIConnector,
|
|
@@ -14184,6 +14567,10 @@ export {
|
|
|
14184
14567
|
AgentIterationLimitError,
|
|
14185
14568
|
AgentPipeline,
|
|
14186
14569
|
AgentRouter,
|
|
14570
|
+
AwsBedrockProvider,
|
|
14571
|
+
AwsSageMakerDeployer,
|
|
14572
|
+
AzureMlDeployer,
|
|
14573
|
+
AzureOpenAiProvider,
|
|
14187
14574
|
BaseProvider,
|
|
14188
14575
|
BaseSTTProvider,
|
|
14189
14576
|
BaseSpeakerRecognizer,
|
|
@@ -14201,9 +14588,10 @@ export {
|
|
|
14201
14588
|
DEFAULT_REDACTION_RULES,
|
|
14202
14589
|
EchoAI,
|
|
14203
14590
|
EchoVoice,
|
|
14204
|
-
ExperimentManager,
|
|
14205
14591
|
FileSessionStore,
|
|
14206
14592
|
GatewayRoutingError,
|
|
14593
|
+
GcpVertexManager,
|
|
14594
|
+
GcpVertexProvider,
|
|
14207
14595
|
HandoffManager,
|
|
14208
14596
|
HuggingFaceImageGen,
|
|
14209
14597
|
HuggingFaceTTS,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "echo-ai-sdk-ts",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Echo AI SDK: Tier
|
|
3
|
+
"version": "2.6.1",
|
|
4
|
+
"description": "Echo AI SDK: Tier 5 Cloud Native (AWS Bedrock/SageMaker, GCP Vertex, Azure OpenAI/ML)",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "tsup src/index.ts --format cjs,esm --
|
|
12
|
+
"build": "tsup src/index.ts --format cjs,esm --external @azure/arm-machinelearning,@azure/identity,@google-cloud/aiplatform,@google-cloud/vertexai,@aws-sdk/client-sagemaker,@aws-sdk/client-bedrock-runtime,@azure/openai",
|
|
13
13
|
"dev": "tsup src/index.ts --format cjs,esm --watch --dts",
|
|
14
14
|
"lint": "tsc",
|
|
15
15
|
"test": "vitest run"
|
|
@@ -17,12 +17,20 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@huggingface/inference": "^4.13.15",
|
|
19
19
|
"cors": "^2.8.5",
|
|
20
|
+
"cross-fetch": "^4.1.0",
|
|
20
21
|
"express": "^4.18.2",
|
|
21
22
|
"zod": "^3.25.76",
|
|
22
23
|
"zod-to-json-schema": "^3.25.1"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@anthropic-ai/sdk": "^0.80.0",
|
|
27
|
+
"@aws-sdk/client-bedrock-runtime": "^3.1019.0",
|
|
28
|
+
"@aws-sdk/client-sagemaker": "^3.1019.0",
|
|
29
|
+
"@azure/arm-machinelearning": "^3.0.0",
|
|
30
|
+
"@azure/identity": "^4.13.1",
|
|
31
|
+
"@azure/openai": "^2.0.0",
|
|
32
|
+
"@google-cloud/aiplatform": "^6.5.0",
|
|
33
|
+
"@google-cloud/vertexai": "^1.10.3",
|
|
26
34
|
"@types/cors": "^2.8.17",
|
|
27
35
|
"@types/express": "^4.17.21",
|
|
28
36
|
"@types/node": "^20.11.24",
|