@alquimia-ai/tools 1.1.0 → 1.2.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.
@@ -2055,7 +2055,28 @@ var ElevenLabsWhisperProvider = class extends WhisperProvider {
2055
2055
  this.client = new ElevenLabsClient(config);
2056
2056
  }
2057
2057
  async speechToText(audio) {
2058
- return "";
2058
+ try {
2059
+ const axiosClient = axios3.create({
2060
+ baseURL: this.config.baseURL,
2061
+ headers: {
2062
+ "xi-api-key": this.config.apiKey
2063
+ }
2064
+ });
2065
+ const base64Data = audio.split(",")[1];
2066
+ const blob = new Blob([Buffer.from(base64Data, "base64")], { type: "audio/webm" });
2067
+ const formData = new FormData();
2068
+ formData.append("file", blob, "audio.webm");
2069
+ formData.append("model_id", "scribe_v1");
2070
+ const response = await axiosClient.post("/v1/speech-to-text", formData, {
2071
+ headers: {
2072
+ "Content-Type": "multipart/form-data"
2073
+ }
2074
+ });
2075
+ return response.data.text;
2076
+ } catch (error) {
2077
+ console.error("Error converting speech to text:", error);
2078
+ throw error;
2079
+ }
2059
2080
  }
2060
2081
  async textToSpeech(text) {
2061
2082
  const axiosClient = axios3.create({
@@ -2082,70 +2103,10 @@ var ElevenLabsWhisperProvider = class extends WhisperProvider {
2082
2103
  }
2083
2104
  }
2084
2105
  };
2085
-
2086
- // src/providers/elastic-search.ts
2087
- import pino from "pino";
2088
- var ElasticLoggerProvider = class _ElasticLoggerProvider extends LoggerProvider {
2089
- constructor(config) {
2090
- super(config);
2091
- this.logger = console;
2092
- }
2093
- static async create(config) {
2094
- const provider = new _ElasticLoggerProvider(config);
2095
- await provider.initialize(config);
2096
- return provider;
2097
- }
2098
- async initialize(config) {
2099
- if (typeof window === "undefined") {
2100
- const [pinoElastic] = await Promise.all([
2101
- import("pino-elasticsearch")
2102
- ]);
2103
- const streamToElastic = pinoElastic.default({
2104
- index: config.index || "logs-index",
2105
- node: config.endpoint,
2106
- esVersion: config.esVersion || 7,
2107
- flushBytes: config.flushBytes || 1e3,
2108
- auth: {
2109
- username: config.username || "",
2110
- password: config.password || ""
2111
- },
2112
- tls: {
2113
- rejectUnauthorized: false
2114
- },
2115
- op_type: "create"
2116
- });
2117
- streamToElastic.on("error", (err) => {
2118
- console.error("Elasticsearch stream error:", err);
2119
- });
2120
- streamToElastic.on("insertError", (err) => {
2121
- console.error("Elasticsearch insert error:", err);
2122
- });
2123
- streamToElastic.on("insert", () => {
2124
- console.log("Successfully sent log to Elasticsearch");
2125
- });
2126
- this.logger = pino({
2127
- level: "info",
2128
- timestamp: () => `,"time":"${(/* @__PURE__ */ new Date()).toISOString()}"`
2129
- }, streamToElastic);
2130
- }
2131
- }
2132
- logInfo(message, data) {
2133
- this.logger.info({ ...data }, message);
2134
- }
2135
- logError(message, error, data) {
2136
- const errorDetails = {
2137
- message: error.message,
2138
- name: error.name,
2139
- stack: error.stack
2140
- };
2141
- this.logger.error({ error, ...data, ...errorDetails }, message);
2142
- }
2143
- };
2144
2106
  export {
2145
2107
  AlquimiaRatingsProvider,
2146
2108
  AlquimiaWhisperProvider,
2147
2109
  CharacterizationProvider,
2148
- ElasticLoggerProvider,
2149
2110
  ElevenLabsWhisperProvider,
2150
2111
  GenerativeProvider,
2151
2112
  LoggerProvider,