@alquimia-ai/tools 1.1.0 → 1.3.0
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/providers/elastic/index.d.mts +20 -0
- package/dist/providers/elastic/index.d.ts +20 -0
- package/dist/providers/elastic/index.js +102 -0
- package/dist/providers/elastic/index.js.map +1 -0
- package/dist/providers/elastic/index.mjs +69 -0
- package/dist/providers/elastic/index.mjs.map +1 -0
- package/dist/providers/index.d.mts +15 -25
- package/dist/providers/index.d.ts +15 -25
- package/dist/providers/index.js +38 -70
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs +38 -70
- package/dist/providers/index.mjs.map +1 -1
- package/dist/services/apm/index.d.mts +26 -0
- package/dist/services/apm/index.d.ts +26 -0
- package/dist/services/apm/index.js +86 -0
- package/dist/services/apm/index.js.map +1 -0
- package/dist/services/apm/index.mjs +63 -0
- package/dist/services/apm/index.mjs.map +1 -0
- package/dist/services/index.d.mts +3 -25
- package/dist/services/index.d.ts +3 -25
- package/dist/types/index.d.mts +13 -1
- package/dist/types/index.d.ts +13 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/package.json +8 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { L as LoggerProvider } from '../../providers-D6FJ6tlA.mjs';
|
|
2
|
+
|
|
3
|
+
interface ElasticLoggerConfig {
|
|
4
|
+
endpoint: string;
|
|
5
|
+
username: string;
|
|
6
|
+
password: string;
|
|
7
|
+
index?: string;
|
|
8
|
+
esVersion?: number;
|
|
9
|
+
flushBytes?: number;
|
|
10
|
+
}
|
|
11
|
+
declare class ElasticLoggerProvider extends LoggerProvider {
|
|
12
|
+
private logger;
|
|
13
|
+
private constructor();
|
|
14
|
+
static create(config: ElasticLoggerConfig): Promise<ElasticLoggerProvider>;
|
|
15
|
+
private initialize;
|
|
16
|
+
logInfo(message: string, data?: Record<string, any>): void;
|
|
17
|
+
logError(message: string, error: Error, data?: Record<string, any>): void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { ElasticLoggerProvider };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { L as LoggerProvider } from '../../providers-D6FJ6tlA.js';
|
|
2
|
+
|
|
3
|
+
interface ElasticLoggerConfig {
|
|
4
|
+
endpoint: string;
|
|
5
|
+
username: string;
|
|
6
|
+
password: string;
|
|
7
|
+
index?: string;
|
|
8
|
+
esVersion?: number;
|
|
9
|
+
flushBytes?: number;
|
|
10
|
+
}
|
|
11
|
+
declare class ElasticLoggerProvider extends LoggerProvider {
|
|
12
|
+
private logger;
|
|
13
|
+
private constructor();
|
|
14
|
+
static create(config: ElasticLoggerConfig): Promise<ElasticLoggerProvider>;
|
|
15
|
+
private initialize;
|
|
16
|
+
logInfo(message: string, data?: Record<string, any>): void;
|
|
17
|
+
logError(message: string, error: Error, data?: Record<string, any>): void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { ElasticLoggerProvider };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/providers/elastic/index.ts
|
|
31
|
+
var elastic_exports = {};
|
|
32
|
+
__export(elastic_exports, {
|
|
33
|
+
ElasticLoggerProvider: () => ElasticLoggerProvider
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(elastic_exports);
|
|
36
|
+
|
|
37
|
+
// src/providers/providers.ts
|
|
38
|
+
var LoggerProvider = class {
|
|
39
|
+
constructor(config) {
|
|
40
|
+
this.config = config;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// src/providers/elastic/elastic-search.ts
|
|
45
|
+
var import_pino = __toESM(require("pino"));
|
|
46
|
+
var ElasticLoggerProvider = class _ElasticLoggerProvider extends LoggerProvider {
|
|
47
|
+
constructor(config) {
|
|
48
|
+
super(config);
|
|
49
|
+
this.logger = console;
|
|
50
|
+
}
|
|
51
|
+
static async create(config) {
|
|
52
|
+
const provider = new _ElasticLoggerProvider(config);
|
|
53
|
+
await provider.initialize(config);
|
|
54
|
+
return provider;
|
|
55
|
+
}
|
|
56
|
+
async initialize(config) {
|
|
57
|
+
if (typeof window === "undefined") {
|
|
58
|
+
const [pinoElastic] = await Promise.all([
|
|
59
|
+
import("pino-elasticsearch")
|
|
60
|
+
]);
|
|
61
|
+
const streamToElastic = pinoElastic.default({
|
|
62
|
+
index: config.index || "logs-index",
|
|
63
|
+
node: config.endpoint,
|
|
64
|
+
esVersion: config.esVersion || 7,
|
|
65
|
+
flushBytes: config.flushBytes || 1e3,
|
|
66
|
+
auth: {
|
|
67
|
+
username: config.username || "",
|
|
68
|
+
password: config.password || ""
|
|
69
|
+
},
|
|
70
|
+
tls: {
|
|
71
|
+
rejectUnauthorized: false
|
|
72
|
+
},
|
|
73
|
+
op_type: "create"
|
|
74
|
+
});
|
|
75
|
+
streamToElastic.on("error", (err) => {
|
|
76
|
+
console.error("Elasticsearch stream error:", err);
|
|
77
|
+
});
|
|
78
|
+
streamToElastic.on("insertError", (err) => {
|
|
79
|
+
console.error("Elasticsearch insert error:", err);
|
|
80
|
+
});
|
|
81
|
+
streamToElastic.on("insert", () => {
|
|
82
|
+
console.log("Successfully sent log to Elasticsearch");
|
|
83
|
+
});
|
|
84
|
+
this.logger = (0, import_pino.default)({
|
|
85
|
+
level: "info",
|
|
86
|
+
timestamp: () => `,"time":"${(/* @__PURE__ */ new Date()).toISOString()}"`
|
|
87
|
+
}, streamToElastic);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
logInfo(message, data) {
|
|
91
|
+
this.logger.info({ ...data }, message);
|
|
92
|
+
}
|
|
93
|
+
logError(message, error, data) {
|
|
94
|
+
const errorDetails = {
|
|
95
|
+
message: error.message,
|
|
96
|
+
name: error.name,
|
|
97
|
+
stack: error.stack
|
|
98
|
+
};
|
|
99
|
+
this.logger.error({ error, ...data, ...errorDetails }, message);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/providers/elastic/index.ts","../../../src/providers/providers.ts","../../../src/providers/elastic/elastic-search.ts"],"sourcesContent":["export * from \"./elastic-search\";","\nexport abstract class GenerativeProvider {\n private config: Record<string, any>;\n\n constructor(config: Record<string, any>) {\n this.config = config;\n }\n}\n\nexport abstract class WhisperProvider {\n protected config: Record<string, any>;\n\n constructor(config: Record<string, any>) {\n this.config = config;\n }\n\n abstract textToSpeech(text: string): Promise<Blob>\n\n abstract speechToText(audio: string): Promise<string>\n} \n\nexport abstract class StableDiffusionProvider {\n protected config: Record<string, any>;\n\n constructor(config: Record<string, any>) {\n this.config = config;\n }\n\n abstract generateImage(query: string): Promise<string>\n}\n\nexport abstract class CharacterizationProvider {\n protected config: Record<string, any>;\n\n constructor(config: Record<string, any>) {\n this.config = config;\n }\n\n abstract analyzeCharacterization(text: string): Promise<Record<string, any>>\n}\n\nexport abstract class RatingsProvider {\n protected config: Record<string, any>;\n\n constructor(config: Record<string, any>) {\n this.config = config;\n }\n\n abstract rate(data: Record<string, any>): Promise<Record<string, any>>;\n}\n\nexport abstract class LoggerProvider {\n protected config: Record<string, any>;\n\n constructor(config: Record<string, any>) {\n this.config = config;\n }\n\n abstract logInfo(message: string, data?: Record<string, any>): void;\n abstract logError(message: string, error: Error, data?: Record<string, any>): void;\n}\n","import { LoggerProvider } from \"../providers\";\nimport pino from \"pino\";\n\ninterface ElasticLoggerConfig {\n endpoint: string;\n username: string;\n password: string;\n index?: string;\n esVersion?: number;\n flushBytes?: number;\n}\n\nclass ElasticLoggerProvider extends LoggerProvider {\n private logger: pino.Logger;\n\n private constructor(config: ElasticLoggerConfig) {\n super(config);\n this.logger = console as any;\n }\n\n public static async create(config: ElasticLoggerConfig): Promise<ElasticLoggerProvider> {\n const provider = new ElasticLoggerProvider(config);\n await provider.initialize(config);\n return provider;\n }\n\n private async initialize(config: ElasticLoggerConfig) {\n if (typeof window === 'undefined') {\n const [pinoElastic] = await Promise.all([\n import('pino-elasticsearch')\n ]);\n\n const streamToElastic = pinoElastic.default({\n index: config.index || \"logs-index\",\n node: config.endpoint,\n esVersion: config.esVersion || 7,\n flushBytes: config.flushBytes || 1000,\n auth: {\n username: config.username || \"\",\n password: config.password || \"\",\n },\n tls: {\n rejectUnauthorized: false,\n },\n op_type: 'create',\n });\n\n streamToElastic.on('error', (err) => {\n console.error('Elasticsearch stream error:', err);\n });\n\n streamToElastic.on('insertError', (err) => {\n console.error('Elasticsearch insert error:', err);\n });\n\n streamToElastic.on('insert', () => {\n console.log('Successfully sent log to Elasticsearch');\n });\n\n\n this.logger = pino({\n level: 'info',\n timestamp: () => `,\"time\":\"${new Date().toISOString()}\"`,\n }, streamToElastic);\n }\n }\n\n logInfo(message: string, data?: Record<string, any>): void {\n this.logger.info({ ...data }, message);\n }\n\n logError(message: string, error: Error, data?: Record<string, any>): void {\n const errorDetails = {\n message: error.message,\n name: error.name,\n stack: error.stack,\n };\n this.logger.error({ error, ...data, ...errorDetails }, message);\n }\n}\n\nexport { ElasticLoggerProvider };"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmDO,IAAe,iBAAf,MAA8B;AAAA,EAGjC,YAAY,QAA6B;AACrC,SAAK,SAAS;AAAA,EAClB;AAIJ;;;AC3DA,kBAAiB;AAWjB,IAAM,wBAAN,MAAM,+BAA8B,eAAe;AAAA,EAGzC,YAAY,QAA6B;AAC/C,UAAM,MAAM;AACZ,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,aAAoB,OAAO,QAA6D;AACtF,UAAM,WAAW,IAAI,uBAAsB,MAAM;AACjD,UAAM,SAAS,WAAW,MAAM;AAChC,WAAO;AAAA,EACT;AAAA,EAEA,MAAc,WAAW,QAA6B;AACpD,QAAI,OAAO,WAAW,aAAa;AACjC,YAAM,CAAC,WAAW,IAAI,MAAM,QAAQ,IAAI;AAAA,QACtC,OAAO,oBAAoB;AAAA,MAC7B,CAAC;AAED,YAAM,kBAAkB,YAAY,QAAQ;AAAA,QAC1C,OAAO,OAAO,SAAS;AAAA,QACvB,MAAM,OAAO;AAAA,QACb,WAAW,OAAO,aAAa;AAAA,QAC/B,YAAY,OAAO,cAAc;AAAA,QACjC,MAAM;AAAA,UACJ,UAAU,OAAO,YAAY;AAAA,UAC7B,UAAU,OAAO,YAAY;AAAA,QAC/B;AAAA,QACA,KAAK;AAAA,UACH,oBAAoB;AAAA,QACtB;AAAA,QACA,SAAS;AAAA,MACX,CAAC;AAED,sBAAgB,GAAG,SAAS,CAAC,QAAQ;AACnC,gBAAQ,MAAM,+BAA+B,GAAG;AAAA,MAClD,CAAC;AAED,sBAAgB,GAAG,eAAe,CAAC,QAAQ;AACzC,gBAAQ,MAAM,+BAA+B,GAAG;AAAA,MAClD,CAAC;AAED,sBAAgB,GAAG,UAAU,MAAM;AACjC,gBAAQ,IAAI,wCAAwC;AAAA,MACtD,CAAC;AAGD,WAAK,aAAS,YAAAA,SAAK;AAAA,QACjB,OAAO;AAAA,QACP,WAAW,MAAM,aAAY,oBAAI,KAAK,GAAE,YAAY,CAAC;AAAA,MACvD,GAAG,eAAe;AAAA,IACpB;AAAA,EACF;AAAA,EAEA,QAAQ,SAAiB,MAAkC;AACzD,SAAK,OAAO,KAAK,EAAE,GAAG,KAAK,GAAG,OAAO;AAAA,EACvC;AAAA,EAEA,SAAS,SAAiB,OAAc,MAAkC;AACxE,UAAM,eAAe;AAAA,MACnB,SAAS,MAAM;AAAA,MACf,MAAM,MAAM;AAAA,MACZ,OAAO,MAAM;AAAA,IACf;AACA,SAAK,OAAO,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,aAAa,GAAG,OAAO;AAAA,EAChE;AACF;","names":["pino"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// src/providers/providers.ts
|
|
2
|
+
var LoggerProvider = class {
|
|
3
|
+
constructor(config) {
|
|
4
|
+
this.config = config;
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// src/providers/elastic/elastic-search.ts
|
|
9
|
+
import pino from "pino";
|
|
10
|
+
var ElasticLoggerProvider = class _ElasticLoggerProvider extends LoggerProvider {
|
|
11
|
+
constructor(config) {
|
|
12
|
+
super(config);
|
|
13
|
+
this.logger = console;
|
|
14
|
+
}
|
|
15
|
+
static async create(config) {
|
|
16
|
+
const provider = new _ElasticLoggerProvider(config);
|
|
17
|
+
await provider.initialize(config);
|
|
18
|
+
return provider;
|
|
19
|
+
}
|
|
20
|
+
async initialize(config) {
|
|
21
|
+
if (typeof window === "undefined") {
|
|
22
|
+
const [pinoElastic] = await Promise.all([
|
|
23
|
+
import("pino-elasticsearch")
|
|
24
|
+
]);
|
|
25
|
+
const streamToElastic = pinoElastic.default({
|
|
26
|
+
index: config.index || "logs-index",
|
|
27
|
+
node: config.endpoint,
|
|
28
|
+
esVersion: config.esVersion || 7,
|
|
29
|
+
flushBytes: config.flushBytes || 1e3,
|
|
30
|
+
auth: {
|
|
31
|
+
username: config.username || "",
|
|
32
|
+
password: config.password || ""
|
|
33
|
+
},
|
|
34
|
+
tls: {
|
|
35
|
+
rejectUnauthorized: false
|
|
36
|
+
},
|
|
37
|
+
op_type: "create"
|
|
38
|
+
});
|
|
39
|
+
streamToElastic.on("error", (err) => {
|
|
40
|
+
console.error("Elasticsearch stream error:", err);
|
|
41
|
+
});
|
|
42
|
+
streamToElastic.on("insertError", (err) => {
|
|
43
|
+
console.error("Elasticsearch insert error:", err);
|
|
44
|
+
});
|
|
45
|
+
streamToElastic.on("insert", () => {
|
|
46
|
+
console.log("Successfully sent log to Elasticsearch");
|
|
47
|
+
});
|
|
48
|
+
this.logger = pino({
|
|
49
|
+
level: "info",
|
|
50
|
+
timestamp: () => `,"time":"${(/* @__PURE__ */ new Date()).toISOString()}"`
|
|
51
|
+
}, streamToElastic);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
logInfo(message, data) {
|
|
55
|
+
this.logger.info({ ...data }, message);
|
|
56
|
+
}
|
|
57
|
+
logError(message, error, data) {
|
|
58
|
+
const errorDetails = {
|
|
59
|
+
message: error.message,
|
|
60
|
+
name: error.name,
|
|
61
|
+
stack: error.stack
|
|
62
|
+
};
|
|
63
|
+
this.logger.error({ error, ...data, ...errorDetails }, message);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
ElasticLoggerProvider
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/providers/providers.ts","../../../src/providers/elastic/elastic-search.ts"],"sourcesContent":["\nexport abstract class GenerativeProvider {\n private config: Record<string, any>;\n\n constructor(config: Record<string, any>) {\n this.config = config;\n }\n}\n\nexport abstract class WhisperProvider {\n protected config: Record<string, any>;\n\n constructor(config: Record<string, any>) {\n this.config = config;\n }\n\n abstract textToSpeech(text: string): Promise<Blob>\n\n abstract speechToText(audio: string): Promise<string>\n} \n\nexport abstract class StableDiffusionProvider {\n protected config: Record<string, any>;\n\n constructor(config: Record<string, any>) {\n this.config = config;\n }\n\n abstract generateImage(query: string): Promise<string>\n}\n\nexport abstract class CharacterizationProvider {\n protected config: Record<string, any>;\n\n constructor(config: Record<string, any>) {\n this.config = config;\n }\n\n abstract analyzeCharacterization(text: string): Promise<Record<string, any>>\n}\n\nexport abstract class RatingsProvider {\n protected config: Record<string, any>;\n\n constructor(config: Record<string, any>) {\n this.config = config;\n }\n\n abstract rate(data: Record<string, any>): Promise<Record<string, any>>;\n}\n\nexport abstract class LoggerProvider {\n protected config: Record<string, any>;\n\n constructor(config: Record<string, any>) {\n this.config = config;\n }\n\n abstract logInfo(message: string, data?: Record<string, any>): void;\n abstract logError(message: string, error: Error, data?: Record<string, any>): void;\n}\n","import { LoggerProvider } from \"../providers\";\nimport pino from \"pino\";\n\ninterface ElasticLoggerConfig {\n endpoint: string;\n username: string;\n password: string;\n index?: string;\n esVersion?: number;\n flushBytes?: number;\n}\n\nclass ElasticLoggerProvider extends LoggerProvider {\n private logger: pino.Logger;\n\n private constructor(config: ElasticLoggerConfig) {\n super(config);\n this.logger = console as any;\n }\n\n public static async create(config: ElasticLoggerConfig): Promise<ElasticLoggerProvider> {\n const provider = new ElasticLoggerProvider(config);\n await provider.initialize(config);\n return provider;\n }\n\n private async initialize(config: ElasticLoggerConfig) {\n if (typeof window === 'undefined') {\n const [pinoElastic] = await Promise.all([\n import('pino-elasticsearch')\n ]);\n\n const streamToElastic = pinoElastic.default({\n index: config.index || \"logs-index\",\n node: config.endpoint,\n esVersion: config.esVersion || 7,\n flushBytes: config.flushBytes || 1000,\n auth: {\n username: config.username || \"\",\n password: config.password || \"\",\n },\n tls: {\n rejectUnauthorized: false,\n },\n op_type: 'create',\n });\n\n streamToElastic.on('error', (err) => {\n console.error('Elasticsearch stream error:', err);\n });\n\n streamToElastic.on('insertError', (err) => {\n console.error('Elasticsearch insert error:', err);\n });\n\n streamToElastic.on('insert', () => {\n console.log('Successfully sent log to Elasticsearch');\n });\n\n\n this.logger = pino({\n level: 'info',\n timestamp: () => `,\"time\":\"${new Date().toISOString()}\"`,\n }, streamToElastic);\n }\n }\n\n logInfo(message: string, data?: Record<string, any>): void {\n this.logger.info({ ...data }, message);\n }\n\n logError(message: string, error: Error, data?: Record<string, any>): void {\n const errorDetails = {\n message: error.message,\n name: error.name,\n stack: error.stack,\n };\n this.logger.error({ error, ...data, ...errorDetails }, message);\n }\n}\n\nexport { ElasticLoggerProvider };"],"mappings":";AAmDO,IAAe,iBAAf,MAA8B;AAAA,EAGjC,YAAY,QAA6B;AACrC,SAAK,SAAS;AAAA,EAClB;AAIJ;;;AC3DA,OAAO,UAAU;AAWjB,IAAM,wBAAN,MAAM,+BAA8B,eAAe;AAAA,EAGzC,YAAY,QAA6B;AAC/C,UAAM,MAAM;AACZ,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,aAAoB,OAAO,QAA6D;AACtF,UAAM,WAAW,IAAI,uBAAsB,MAAM;AACjD,UAAM,SAAS,WAAW,MAAM;AAChC,WAAO;AAAA,EACT;AAAA,EAEA,MAAc,WAAW,QAA6B;AACpD,QAAI,OAAO,WAAW,aAAa;AACjC,YAAM,CAAC,WAAW,IAAI,MAAM,QAAQ,IAAI;AAAA,QACtC,OAAO,oBAAoB;AAAA,MAC7B,CAAC;AAED,YAAM,kBAAkB,YAAY,QAAQ;AAAA,QAC1C,OAAO,OAAO,SAAS;AAAA,QACvB,MAAM,OAAO;AAAA,QACb,WAAW,OAAO,aAAa;AAAA,QAC/B,YAAY,OAAO,cAAc;AAAA,QACjC,MAAM;AAAA,UACJ,UAAU,OAAO,YAAY;AAAA,UAC7B,UAAU,OAAO,YAAY;AAAA,QAC/B;AAAA,QACA,KAAK;AAAA,UACH,oBAAoB;AAAA,QACtB;AAAA,QACA,SAAS;AAAA,MACX,CAAC;AAED,sBAAgB,GAAG,SAAS,CAAC,QAAQ;AACnC,gBAAQ,MAAM,+BAA+B,GAAG;AAAA,MAClD,CAAC;AAED,sBAAgB,GAAG,eAAe,CAAC,QAAQ;AACzC,gBAAQ,MAAM,+BAA+B,GAAG;AAAA,MAClD,CAAC;AAED,sBAAgB,GAAG,UAAU,MAAM;AACjC,gBAAQ,IAAI,wCAAwC;AAAA,MACtD,CAAC;AAGD,WAAK,SAAS,KAAK;AAAA,QACjB,OAAO;AAAA,QACP,WAAW,MAAM,aAAY,oBAAI,KAAK,GAAE,YAAY,CAAC;AAAA,MACvD,GAAG,eAAe;AAAA,IACpB;AAAA,EACF;AAAA,EAEA,QAAQ,SAAiB,MAAkC;AACzD,SAAK,OAAO,KAAK,EAAE,GAAG,KAAK,GAAG,OAAO;AAAA,EACvC;AAAA,EAEA,SAAS,SAAiB,OAAc,MAAkC;AACxE,UAAM,eAAe;AAAA,MACnB,SAAS,MAAM;AAAA,MACf,MAAM,MAAM;AAAA,MACZ,OAAO,MAAM;AAAA,IACf;AACA,SAAK,OAAO,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,aAAa,GAAG,OAAO;AAAA,EAChE;AACF;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as WhisperProvider, R as RatingsProvider, C as CharacterizationProvider, S as StableDiffusionProvider
|
|
2
|
-
export { G as GenerativeProvider } from '../providers-D6FJ6tlA.mjs';
|
|
1
|
+
import { W as WhisperProvider, R as RatingsProvider, C as CharacterizationProvider, S as StableDiffusionProvider } from '../providers-D6FJ6tlA.mjs';
|
|
2
|
+
export { G as GenerativeProvider, L as LoggerProvider } from '../providers-D6FJ6tlA.mjs';
|
|
3
3
|
import { RatingData } from '../types/index.mjs';
|
|
4
4
|
import '@elastic/apm-rum';
|
|
5
5
|
import 'ai';
|
|
@@ -43,32 +43,22 @@ declare class StabilityProvider extends StableDiffusionProvider {
|
|
|
43
43
|
generateImage(query: string): Promise<string>;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
interface ElevenLabsConfig {
|
|
47
|
+
baseURL: string;
|
|
48
|
+
apiKey: string;
|
|
49
|
+
voiceId: string;
|
|
50
|
+
voiceSettings?: {
|
|
51
|
+
stability?: number;
|
|
52
|
+
similarity_boost?: number;
|
|
53
|
+
style?: number;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
46
56
|
declare class ElevenLabsWhisperProvider extends WhisperProvider {
|
|
47
57
|
private client;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
voiceId: string;
|
|
51
|
-
baseURL: string;
|
|
52
|
-
});
|
|
58
|
+
private requestSpecs;
|
|
59
|
+
constructor(config: ElevenLabsConfig);
|
|
53
60
|
speechToText(audio: string): Promise<string>;
|
|
54
61
|
textToSpeech(text: string): Promise<any>;
|
|
55
62
|
}
|
|
56
63
|
|
|
57
|
-
|
|
58
|
-
endpoint: string;
|
|
59
|
-
username: string;
|
|
60
|
-
password: string;
|
|
61
|
-
index?: string;
|
|
62
|
-
esVersion?: number;
|
|
63
|
-
flushBytes?: number;
|
|
64
|
-
}
|
|
65
|
-
declare class ElasticLoggerProvider extends LoggerProvider {
|
|
66
|
-
private logger;
|
|
67
|
-
private constructor();
|
|
68
|
-
static create(config: ElasticLoggerConfig): Promise<ElasticLoggerProvider>;
|
|
69
|
-
private initialize;
|
|
70
|
-
logInfo(message: string, data?: Record<string, any>): void;
|
|
71
|
-
logError(message: string, error: Error, data?: Record<string, any>): void;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export { AlquimiaRatingsProvider, AlquimiaWhisperProvider, CharacterizationProvider, ElasticLoggerProvider, ElevenLabsWhisperProvider, LoggerProvider, OpenAIAnalyzeCharProvider, OpenAIStableDiffusionProvider, OpenAIWhisperProvider, RatingsProvider, StabilityProvider, StableDiffusionProvider, WhisperProvider };
|
|
64
|
+
export { AlquimiaRatingsProvider, AlquimiaWhisperProvider, CharacterizationProvider, ElevenLabsWhisperProvider, OpenAIAnalyzeCharProvider, OpenAIStableDiffusionProvider, OpenAIWhisperProvider, RatingsProvider, StabilityProvider, StableDiffusionProvider, WhisperProvider };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as WhisperProvider, R as RatingsProvider, C as CharacterizationProvider, S as StableDiffusionProvider
|
|
2
|
-
export { G as GenerativeProvider } from '../providers-D6FJ6tlA.js';
|
|
1
|
+
import { W as WhisperProvider, R as RatingsProvider, C as CharacterizationProvider, S as StableDiffusionProvider } from '../providers-D6FJ6tlA.js';
|
|
2
|
+
export { G as GenerativeProvider, L as LoggerProvider } from '../providers-D6FJ6tlA.js';
|
|
3
3
|
import { RatingData } from '../types/index.js';
|
|
4
4
|
import '@elastic/apm-rum';
|
|
5
5
|
import 'ai';
|
|
@@ -43,32 +43,22 @@ declare class StabilityProvider extends StableDiffusionProvider {
|
|
|
43
43
|
generateImage(query: string): Promise<string>;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
interface ElevenLabsConfig {
|
|
47
|
+
baseURL: string;
|
|
48
|
+
apiKey: string;
|
|
49
|
+
voiceId: string;
|
|
50
|
+
voiceSettings?: {
|
|
51
|
+
stability?: number;
|
|
52
|
+
similarity_boost?: number;
|
|
53
|
+
style?: number;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
46
56
|
declare class ElevenLabsWhisperProvider extends WhisperProvider {
|
|
47
57
|
private client;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
voiceId: string;
|
|
51
|
-
baseURL: string;
|
|
52
|
-
});
|
|
58
|
+
private requestSpecs;
|
|
59
|
+
constructor(config: ElevenLabsConfig);
|
|
53
60
|
speechToText(audio: string): Promise<string>;
|
|
54
61
|
textToSpeech(text: string): Promise<any>;
|
|
55
62
|
}
|
|
56
63
|
|
|
57
|
-
|
|
58
|
-
endpoint: string;
|
|
59
|
-
username: string;
|
|
60
|
-
password: string;
|
|
61
|
-
index?: string;
|
|
62
|
-
esVersion?: number;
|
|
63
|
-
flushBytes?: number;
|
|
64
|
-
}
|
|
65
|
-
declare class ElasticLoggerProvider extends LoggerProvider {
|
|
66
|
-
private logger;
|
|
67
|
-
private constructor();
|
|
68
|
-
static create(config: ElasticLoggerConfig): Promise<ElasticLoggerProvider>;
|
|
69
|
-
private initialize;
|
|
70
|
-
logInfo(message: string, data?: Record<string, any>): void;
|
|
71
|
-
logError(message: string, error: Error, data?: Record<string, any>): void;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export { AlquimiaRatingsProvider, AlquimiaWhisperProvider, CharacterizationProvider, ElasticLoggerProvider, ElevenLabsWhisperProvider, LoggerProvider, OpenAIAnalyzeCharProvider, OpenAIStableDiffusionProvider, OpenAIWhisperProvider, RatingsProvider, StabilityProvider, StableDiffusionProvider, WhisperProvider };
|
|
64
|
+
export { AlquimiaRatingsProvider, AlquimiaWhisperProvider, CharacterizationProvider, ElevenLabsWhisperProvider, OpenAIAnalyzeCharProvider, OpenAIStableDiffusionProvider, OpenAIWhisperProvider, RatingsProvider, StabilityProvider, StableDiffusionProvider, WhisperProvider };
|
package/dist/providers/index.js
CHANGED
|
@@ -1813,7 +1813,6 @@ __export(providers_exports, {
|
|
|
1813
1813
|
AlquimiaRatingsProvider: () => AlquimiaRatingsProvider,
|
|
1814
1814
|
AlquimiaWhisperProvider: () => AlquimiaWhisperProvider,
|
|
1815
1815
|
CharacterizationProvider: () => CharacterizationProvider,
|
|
1816
|
-
ElasticLoggerProvider: () => ElasticLoggerProvider,
|
|
1817
1816
|
ElevenLabsWhisperProvider: () => ElevenLabsWhisperProvider,
|
|
1818
1817
|
GenerativeProvider: () => GenerativeProvider,
|
|
1819
1818
|
LoggerProvider: () => LoggerProvider,
|
|
@@ -2064,24 +2063,52 @@ var StabilityProvider = class extends StableDiffusionProvider {
|
|
|
2064
2063
|
// src/providers/eleven-labs.ts
|
|
2065
2064
|
var import_elevenlabs = require("elevenlabs");
|
|
2066
2065
|
var import_axios3 = __toESM(require("axios"));
|
|
2067
|
-
var
|
|
2066
|
+
var defaultVoiceSettings = {
|
|
2067
|
+
stability: 0.7,
|
|
2068
|
+
similarity_boost: 0.3,
|
|
2069
|
+
style: 0.2
|
|
2070
|
+
};
|
|
2071
|
+
var defaultRequestSpecs = {
|
|
2068
2072
|
optimize_streaming_latency: import_elevenlabs.ElevenLabs.OptimizeStreamingLatency.Zero,
|
|
2069
2073
|
output_format: import_elevenlabs.ElevenLabs.OutputFormat.Mp344100128,
|
|
2070
|
-
model_id: "
|
|
2071
|
-
language: "es"
|
|
2072
|
-
voice_settings: {
|
|
2073
|
-
stability: 0.1,
|
|
2074
|
-
similarity_boost: 0.15,
|
|
2075
|
-
style: 0.2
|
|
2076
|
-
}
|
|
2074
|
+
model_id: "eleven_multilingual_v2",
|
|
2075
|
+
language: "es"
|
|
2077
2076
|
};
|
|
2078
2077
|
var ElevenLabsWhisperProvider = class extends WhisperProvider {
|
|
2079
2078
|
constructor(config) {
|
|
2080
2079
|
super(config);
|
|
2080
|
+
this.requestSpecs = {
|
|
2081
|
+
...defaultRequestSpecs,
|
|
2082
|
+
voice_settings: {
|
|
2083
|
+
...defaultVoiceSettings,
|
|
2084
|
+
...config.voiceSettings
|
|
2085
|
+
}
|
|
2086
|
+
};
|
|
2081
2087
|
this.client = new import_elevenlabs.ElevenLabsClient(config);
|
|
2082
2088
|
}
|
|
2083
2089
|
async speechToText(audio) {
|
|
2084
|
-
|
|
2090
|
+
try {
|
|
2091
|
+
const axiosClient = import_axios3.default.create({
|
|
2092
|
+
baseURL: this.config.baseURL,
|
|
2093
|
+
headers: {
|
|
2094
|
+
"xi-api-key": this.config.apiKey
|
|
2095
|
+
}
|
|
2096
|
+
});
|
|
2097
|
+
const base64Data = audio.split(",")[1];
|
|
2098
|
+
const blob = new Blob([Buffer.from(base64Data, "base64")], { type: "audio/webm" });
|
|
2099
|
+
const formData = new FormData();
|
|
2100
|
+
formData.append("file", blob, "audio.webm");
|
|
2101
|
+
formData.append("model_id", "scribe_v1");
|
|
2102
|
+
const response = await axiosClient.post("/v1/speech-to-text", formData, {
|
|
2103
|
+
headers: {
|
|
2104
|
+
"Content-Type": "multipart/form-data"
|
|
2105
|
+
}
|
|
2106
|
+
});
|
|
2107
|
+
return response.data.text;
|
|
2108
|
+
} catch (error) {
|
|
2109
|
+
console.error("Error converting speech to text:", error);
|
|
2110
|
+
throw error;
|
|
2111
|
+
}
|
|
2085
2112
|
}
|
|
2086
2113
|
async textToSpeech(text) {
|
|
2087
2114
|
const axiosClient = import_axios3.default.create({
|
|
@@ -2097,7 +2124,7 @@ var ElevenLabsWhisperProvider = class extends WhisperProvider {
|
|
|
2097
2124
|
`/v1/text-to-speech/${this.config.voiceId}`,
|
|
2098
2125
|
{
|
|
2099
2126
|
text,
|
|
2100
|
-
...requestSpecs
|
|
2127
|
+
...this.requestSpecs
|
|
2101
2128
|
},
|
|
2102
2129
|
{ responseType: "blob" }
|
|
2103
2130
|
);
|
|
@@ -2108,65 +2135,6 @@ var ElevenLabsWhisperProvider = class extends WhisperProvider {
|
|
|
2108
2135
|
}
|
|
2109
2136
|
}
|
|
2110
2137
|
};
|
|
2111
|
-
|
|
2112
|
-
// src/providers/elastic-search.ts
|
|
2113
|
-
var import_pino = __toESM(require("pino"));
|
|
2114
|
-
var ElasticLoggerProvider = class _ElasticLoggerProvider extends LoggerProvider {
|
|
2115
|
-
constructor(config) {
|
|
2116
|
-
super(config);
|
|
2117
|
-
this.logger = console;
|
|
2118
|
-
}
|
|
2119
|
-
static async create(config) {
|
|
2120
|
-
const provider = new _ElasticLoggerProvider(config);
|
|
2121
|
-
await provider.initialize(config);
|
|
2122
|
-
return provider;
|
|
2123
|
-
}
|
|
2124
|
-
async initialize(config) {
|
|
2125
|
-
if (typeof window === "undefined") {
|
|
2126
|
-
const [pinoElastic] = await Promise.all([
|
|
2127
|
-
import("pino-elasticsearch")
|
|
2128
|
-
]);
|
|
2129
|
-
const streamToElastic = pinoElastic.default({
|
|
2130
|
-
index: config.index || "logs-index",
|
|
2131
|
-
node: config.endpoint,
|
|
2132
|
-
esVersion: config.esVersion || 7,
|
|
2133
|
-
flushBytes: config.flushBytes || 1e3,
|
|
2134
|
-
auth: {
|
|
2135
|
-
username: config.username || "",
|
|
2136
|
-
password: config.password || ""
|
|
2137
|
-
},
|
|
2138
|
-
tls: {
|
|
2139
|
-
rejectUnauthorized: false
|
|
2140
|
-
},
|
|
2141
|
-
op_type: "create"
|
|
2142
|
-
});
|
|
2143
|
-
streamToElastic.on("error", (err) => {
|
|
2144
|
-
console.error("Elasticsearch stream error:", err);
|
|
2145
|
-
});
|
|
2146
|
-
streamToElastic.on("insertError", (err) => {
|
|
2147
|
-
console.error("Elasticsearch insert error:", err);
|
|
2148
|
-
});
|
|
2149
|
-
streamToElastic.on("insert", () => {
|
|
2150
|
-
console.log("Successfully sent log to Elasticsearch");
|
|
2151
|
-
});
|
|
2152
|
-
this.logger = (0, import_pino.default)({
|
|
2153
|
-
level: "info",
|
|
2154
|
-
timestamp: () => `,"time":"${(/* @__PURE__ */ new Date()).toISOString()}"`
|
|
2155
|
-
}, streamToElastic);
|
|
2156
|
-
}
|
|
2157
|
-
}
|
|
2158
|
-
logInfo(message, data) {
|
|
2159
|
-
this.logger.info({ ...data }, message);
|
|
2160
|
-
}
|
|
2161
|
-
logError(message, error, data) {
|
|
2162
|
-
const errorDetails = {
|
|
2163
|
-
message: error.message,
|
|
2164
|
-
name: error.name,
|
|
2165
|
-
stack: error.stack
|
|
2166
|
-
};
|
|
2167
|
-
this.logger.error({ error, ...data, ...errorDetails }, message);
|
|
2168
|
-
}
|
|
2169
|
-
};
|
|
2170
2138
|
/*! Bundled license information:
|
|
2171
2139
|
|
|
2172
2140
|
ieee754/index.js:
|