diff --git a/JS/edgechains/arakoodev/package.json b/JS/edgechains/arakoodev/package.json index ed84553e..0b0bd378 100644 --- a/JS/edgechains/arakoodev/package.json +++ b/JS/edgechains/arakoodev/package.json @@ -46,7 +46,7 @@ "regenerator-runtime": "^0.14.1", "request": "^2.88.2", "retell-client-js-sdk": "^2.0.4", - "retell-sdk": "^4.7.0", + "retell-sdk": "^4.9.0", "retry": "^0.13.1", "ts-node": "^10.9.2", "typeorm": "^0.3.20", diff --git a/JS/edgechains/arakoodev/src/ai/src/index.ts b/JS/edgechains/arakoodev/src/ai/src/index.ts index 55997ba2..2c98f37d 100644 --- a/JS/edgechains/arakoodev/src/ai/src/index.ts +++ b/JS/edgechains/arakoodev/src/ai/src/index.ts @@ -2,4 +2,4 @@ export { OpenAI } from "./lib/openai/openai.js"; export { GeminiAI } from "./lib/gemini/gemini.js"; export { LlamaAI } from "./lib/llama/llama.js"; export { RetellAI } from "./lib/retell-ai/retell.js"; -export { RetellWebClient } from "./lib/retell-ai/retellWebClient.js" +export { RetellWebClient } from "./lib/retell-ai/retellWebClient.js"; diff --git a/JS/edgechains/arakoodev/src/ai/src/lib/openai/openai.ts b/JS/edgechains/arakoodev/src/ai/src/lib/openai/openai.ts index 2e49c691..f60ba522 100644 --- a/JS/edgechains/arakoodev/src/ai/src/lib/openai/openai.ts +++ b/JS/edgechains/arakoodev/src/ai/src/lib/openai/openai.ts @@ -22,7 +22,7 @@ interface OpenAIChatOptions { temperature?: number; prompt?: string; messages?: messageOption[]; - frequency_penalty?: number + frequency_penalty?: number; } interface chatWithFunctionOptions { @@ -87,11 +87,11 @@ export class OpenAI { model: chatOptions.model || "gpt-3.5-turbo", messages: chatOptions.prompt ? [ - { - role: chatOptions.role || "user", - content: chatOptions.prompt, - }, - ] + { + role: chatOptions.role || "user", + content: chatOptions.prompt, + }, + ] : chatOptions.messages, max_tokens: chatOptions.max_tokens || 256, temperature: chatOptions.temperature || 0.7, @@ -129,16 +129,16 @@ export class OpenAI { model: chatOptions.model || "gpt-3.5-turbo", messages: chatOptions.prompt ? [ - { - role: chatOptions.role || "user", - content: chatOptions.prompt, - }, - ] + { + role: chatOptions.role || "user", + content: chatOptions.prompt, + }, + ] : chatOptions.messages, max_tokens: chatOptions.max_tokens || 256, temperature: chatOptions.temperature || 0.7, frequency_penalty: chatOptions.frequency_penalty || 1, - stream: true + stream: true, }, { headers: { @@ -164,7 +164,6 @@ export class OpenAI { return response[0].message; } - async chatWithFunction( chatOptions: chatWithFunctionOptions ): Promise { @@ -175,11 +174,11 @@ export class OpenAI { model: chatOptions.model || "gpt-3.5-turbo", messages: chatOptions.prompt ? [ - { - role: chatOptions.role || "user", - content: chatOptions.prompt, - }, - ] + { + role: chatOptions.role || "user", + content: chatOptions.prompt, + }, + ] : chatOptions.messages, max_tokens: chatOptions.max_tokens || 1024, temperature: chatOptions.temperature || 0.7, diff --git a/JS/edgechains/arakoodev/src/ai/src/lib/retell-ai/retell.ts b/JS/edgechains/arakoodev/src/ai/src/lib/retell-ai/retell.ts index 2a78cb29..f86b205b 100644 --- a/JS/edgechains/arakoodev/src/ai/src/lib/retell-ai/retell.ts +++ b/JS/edgechains/arakoodev/src/ai/src/lib/retell-ai/retell.ts @@ -1,9 +1,9 @@ -import Retell from 'retell-sdk'; -import { AgentCreateParams, AgentResponse } from 'retell-sdk/resources/agent.mjs'; +import Retell from "retell-sdk"; +import { AgentCreateParams, AgentResponse } from "retell-sdk/resources/agent.mjs"; import { LlmResponse, LlmCreateParams } from "retell-sdk/resources/llm.mjs"; export class RetellAI { retellClient: Retell; - llm: null | LlmResponse; + llm: LlmResponse | null; constructor(apiKey: string) { this.retellClient = new Retell({ apiKey: apiKey, @@ -12,11 +12,12 @@ export class RetellAI { } async createAgent(body: AgentCreateParams, options?: Retell.RequestOptions): Promise { - const defaultParams = { voice_id: "11labs-Adrian", agent_name: "Ryan", llm_websocket_url: this?.llm?.llm_websocket_url, } + //@ts-ignore + const defaultParams = { voice_id: "11labs-Adrian", agent_name: "Ryan", llm_websocket_url: this?.llm?.llm_websocket_url } const keys = Object.keys(defaultParams); for (let i = 0; i < keys.length; i++) { if (keys[i] in body) { - delete defaultParams[keys[i]] + delete defaultParams[keys[i]]; } } const agent = await this.retellClient.agent.create({ ...defaultParams, ...body }, options); @@ -30,6 +31,6 @@ export class RetellAI { async initiateWebCall(agent_id: string): Promise { const webCallResponse = await this.retellClient.call.createWebCall({ agent_id }); - return webCallResponse.access_token + return webCallResponse.access_token; } -} +} \ No newline at end of file diff --git a/JS/edgechains/arakoodev/src/ai/src/lib/retell-ai/retellWebClient.ts b/JS/edgechains/arakoodev/src/ai/src/lib/retell-ai/retellWebClient.ts index 2bf08dee..6920efc9 100644 --- a/JS/edgechains/arakoodev/src/ai/src/lib/retell-ai/retellWebClient.ts +++ b/JS/edgechains/arakoodev/src/ai/src/lib/retell-ai/retellWebClient.ts @@ -1,7 +1,7 @@ import { RetellWebClient as RetellClient, StartCallConfig } from "retell-client-js-sdk"; export class RetellWebClient { - client: RetellClient + client: RetellClient; constructor() { this.client = new RetellClient(); } @@ -18,5 +18,3 @@ export class RetellWebClient { return this.client.stopCall(); } } - - diff --git a/JS/edgechains/arakoodev/src/sync-rpc/lib/sync-rpc.ts b/JS/edgechains/arakoodev/src/sync-rpc/lib/sync-rpc.ts index a53a0a93..fb6a881e 100644 --- a/JS/edgechains/arakoodev/src/sync-rpc/lib/sync-rpc.ts +++ b/JS/edgechains/arakoodev/src/sync-rpc/lib/sync-rpc.ts @@ -1,8 +1,8 @@ -import { execSync } from 'node:child_process'; -import path from 'node:path'; -import fs from 'node:fs'; -import crypto from 'node:crypto'; -import os from 'node:os'; +import { execSync } from "node:child_process"; +import path from "node:path"; +import fs from "node:fs"; +import crypto from "node:crypto"; +import os from "node:os"; function createSyncRPC(filename: string) { const absolutePath = path.resolve(filename); diff --git a/JS/edgechains/examples/retell-ai/README.md b/JS/edgechains/examples/retell-ai/README.md index 2bfc15cf..37c2c2fc 100644 --- a/JS/edgechains/examples/retell-ai/README.md +++ b/JS/edgechains/examples/retell-ai/README.md @@ -28,4 +28,4 @@ npm install npm run start ``` ->>>>>>> 100bddc3 (fixing-example) +> > > > > > > 100bddc3 (fixing-example) diff --git a/JS/edgechains/examples/retell-ai/client/index.js b/JS/edgechains/examples/retell-ai/client/index.js index 1c430362..aaaf691d 100644 --- a/JS/edgechains/examples/retell-ai/client/index.js +++ b/JS/edgechains/examples/retell-ai/client/index.js @@ -1,34 +1,32 @@ -import 'htmx.org'; +import "htmx.org"; import { RetellWebClient } from "@arakoodev/edgechains.js/ai"; -import './style.css'; +import "./style.css"; // Create a single instance const retellWebClient = new RetellWebClient(); async function startCall(access_token) { try { - const callResponse = await retellWebClient.startCall({ accessToken: access_token, }); - console.log('Call started:', callResponse); - document.getElementById('callStatus').textContent = 'Call in progress...'; - + console.log("Call started:", callResponse); + document.getElementById("callStatus").textContent = "Call in progress..."; } catch (error) { - console.error('Failed to start call:', error); - document.getElementById('error').textContent = `Failed to start call: ${error.message}`; + console.error("Failed to start call:", error); + document.getElementById("error").textContent = `Failed to start call: ${error.message}`; } } async function endCall() { try { await retellWebClient.stopCall(); - console.log('Call ended successfully'); - document.getElementById('callStatus').textContent = 'Call ended'; + console.log("Call ended successfully"); + document.getElementById("callStatus").textContent = "Call ended"; } catch (error) { - console.error('Failed to end call:', error); - document.getElementById('error').textContent = `Failed to end call: ${error.message}`; + console.error("Failed to end call:", error); + document.getElementById("error").textContent = `Failed to end call: ${error.message}`; } } @@ -36,4 +34,4 @@ async function endCall() { window.startCall = startCall; window.endCall = endCall; -console.log('Client-side code initialized'); \ No newline at end of file +console.log("Client-side code initialized"); diff --git a/JS/edgechains/examples/retell-ai/package.json b/JS/edgechains/examples/retell-ai/package.json index 1b15cef0..dc77184c 100644 --- a/JS/edgechains/examples/retell-ai/package.json +++ b/JS/edgechains/examples/retell-ai/package.json @@ -1,67 +1,67 @@ { - "name": "htmx-webpack-demo", - "version": "1.0.0", - "scripts": { - "build": "webpack", - "dev": "webpack --watch", - "start": "node --experimental-wasm-modules ./server/index.js" - }, - "dependencies": { - "@arakoodev/edgechains.js": "file:../../arakoodev", - "@arakoodev/jsonnet": "^0.25.0", - "@hono/node-server": "^1.13.4", - "browserify-zlib": "^0.2.0", - "buffer": "^6.0.3", - "crypto": "^1.0.1", - "crypto-browserify": "^3.12.1", - "file-uri-to-path": "^2.0.0", - "html-webpack-plugin": "^5.6.3", - "htmx.org": "^1.9.10", - "hyperscript": "^2.0.2", - "hyperscript.org": "^0.9.13", - "mini-css-extract-plugin": "^2.9.2", - "process": "^0.11.10", - "retell-client-js-sdk": "^2.0.4", - "retell-sdk": "^4.8.0", - "stream-browserify": "^3.0.0", - "stream-http": "^3.2.0", - "util": "^0.12.5", - "vm-browserify": "^1.1.2", - "vue": "^3.5.12", - "vue-loader": "^17.4.2", - "webpack-node-externals": "^3.0.0", - "workbox-webpack-plugin": "^7.3.0" - }, - "devDependencies": { - "@babel/core": "^7.26.0", - "@babel/plugin-transform-runtime": "^7.25.9", - "@babel/preset-env": "^7.26.0", - "assert": "^2.1.0", - "babel-loader": "^9.2.1", - "css-loader": "^7.1.2", - "node-polyfill-webpack-plugin": "^4.0.0", - "os-browserify": "^0.3.0", - "path-browserify": "^1.0.1", - "postcss": "^8.4.47", - "postcss-loader": "^8.1.1", - "postcss-preset-env": "^10.0.9", - "style-loader": "^4.0.0", - "tailwindcss": "^3.4.14", - "url": "^0.11.4", - "webpack": "^5.96.1", - "webpack-cli": "^5.1.4", - "webpack-dev-server": "^5.1.0" - }, - "browser": { - "crypto": "crypto-browserify", - "stream": "stream-browserify", - "http": "stream-http", - "util": "util", - "buffer": "buffer", - "node:crypto": "crypto-browserify", - "node:stream": "stream-browserify", - "node:http": "stream-http", - "node:buffer": "buffer", - "node:util": "util" - } + "name": "htmx-webpack-demo", + "version": "1.0.0", + "scripts": { + "build": "webpack", + "dev": "webpack --watch", + "start": "node --experimental-wasm-modules ./server/index.js" + }, + "dependencies": { + "@arakoodev/edgechains.js": "file:../../arakoodev", + "@arakoodev/jsonnet": "^0.25.0", + "@hono/node-server": "^1.13.4", + "browserify-zlib": "^0.2.0", + "buffer": "^6.0.3", + "crypto": "^1.0.1", + "crypto-browserify": "^3.12.1", + "file-uri-to-path": "^2.0.0", + "html-webpack-plugin": "^5.6.3", + "htmx.org": "^1.9.10", + "hyperscript": "^2.0.2", + "hyperscript.org": "^0.9.13", + "mini-css-extract-plugin": "^2.9.2", + "process": "^0.11.10", + "retell-client-js-sdk": "^2.0.4", + "retell-sdk": "^4.8.0", + "stream-browserify": "^3.0.0", + "stream-http": "^3.2.0", + "util": "^0.12.5", + "vm-browserify": "^1.1.2", + "vue": "^3.5.12", + "vue-loader": "^17.4.2", + "webpack-node-externals": "^3.0.0", + "workbox-webpack-plugin": "^7.3.0" + }, + "devDependencies": { + "@babel/core": "^7.26.0", + "@babel/plugin-transform-runtime": "^7.25.9", + "@babel/preset-env": "^7.26.0", + "assert": "^2.1.0", + "babel-loader": "^9.2.1", + "css-loader": "^7.1.2", + "node-polyfill-webpack-plugin": "^4.0.0", + "os-browserify": "^0.3.0", + "path-browserify": "^1.0.1", + "postcss": "^8.4.47", + "postcss-loader": "^8.1.1", + "postcss-preset-env": "^10.0.9", + "style-loader": "^4.0.0", + "tailwindcss": "^3.4.14", + "url": "^0.11.4", + "webpack": "^5.96.1", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^5.1.0" + }, + "browser": { + "crypto": "crypto-browserify", + "stream": "stream-browserify", + "http": "stream-http", + "util": "util", + "buffer": "buffer", + "node:crypto": "crypto-browserify", + "node:stream": "stream-browserify", + "node:http": "stream-http", + "node:buffer": "buffer", + "node:util": "util" + } } diff --git a/JS/edgechains/examples/retell-ai/postcss.config.js b/JS/edgechains/examples/retell-ai/postcss.config.js index f86ef084..93e8c0e0 100644 --- a/JS/edgechains/examples/retell-ai/postcss.config.js +++ b/JS/edgechains/examples/retell-ai/postcss.config.js @@ -1,7 +1,4 @@ -const tailwindcss = require('tailwindcss'); +const tailwindcss = require("tailwindcss"); module.exports = { - plugins: [ - 'postcss-preset-env', - tailwindcss - ], + plugins: ["postcss-preset-env", tailwindcss], }; diff --git a/JS/edgechains/examples/retell-ai/server/index.js b/JS/edgechains/examples/retell-ai/server/index.js index d14840d8..12ffc439 100644 --- a/JS/edgechains/examples/retell-ai/server/index.js +++ b/JS/edgechains/examples/retell-ai/server/index.js @@ -1,6 +1,6 @@ -import { ArakooServer } from "@arakoodev/edgechains.js/arakooserver" -import { RetellAI } from "@arakoodev/edgechains.js/ai" -import { serveStatic } from '@hono/node-server/serve-static'; +import { ArakooServer } from "@arakoodev/edgechains.js/arakooserver"; +import { RetellAI } from "@arakoodev/edgechains.js/ai"; +import { serveStatic } from "@hono/node-server/serve-static"; import Jsonnet from "@arakoodev/jsonnet"; import path from "path"; import fileURLToPath from "file-uri-to-path"; @@ -19,19 +19,18 @@ const retellai = new RetellAI(jsonnet_secrets_obj.reteall_api_key); await retellai.createLLM({ general_prompt: jsonnet_main_obj.general_prompt, - begin_message: jsonnet_main_obj.begin_message -}) + begin_message: jsonnet_main_obj.begin_message, +}); const createAgentRes = await retellai.createAgent({}); app.get( - '/static/*', + "/static/*", serveStatic({ - root: './dist', - rewriteRequestPath: (path) => - path.replace(/^\/static/, '/'), - })) - + root: "./dist", + rewriteRequestPath: (path) => path.replace(/^\/static/, "/"), + }) +); app.get("/", (c) => { return c.html(` @@ -59,12 +58,11 @@ app.get("/", (c) => { `); -}) - +}); app.get("/call", async (c) => { - const token = await retellai.initiateWebCall(createAgentRes.agent_id) - return c.json({ token }) -}) + const token = await retellai.initiateWebCall(createAgentRes.agent_id); + return c.json({ token }); +}); -server.listen(3000) \ No newline at end of file +server.listen(3000); diff --git a/JS/edgechains/examples/retell-ai/tailwind.config.js b/JS/edgechains/examples/retell-ai/tailwind.config.js index 9740d3fd..6da0163d 100644 --- a/JS/edgechains/examples/retell-ai/tailwind.config.js +++ b/JS/edgechains/examples/retell-ai/tailwind.config.js @@ -1,11 +1,11 @@ module.exports = { - purge: ['./server/**/*.{html,js}'], - darkMode: "media", // or 'media' or 'class' - theme: { - extend: {}, - }, - variants: { - extend: {}, - }, - plugins: [], -}; \ No newline at end of file + purge: ["./server/**/*.{html,js}"], + darkMode: "media", // or 'media' or 'class' + theme: { + extend: {}, + }, + variants: { + extend: {}, + }, + plugins: [], +}; diff --git a/JS/edgechains/examples/retell-ai/webpack.config.cjs b/JS/edgechains/examples/retell-ai/webpack.config.cjs index 20f92f3b..15d6daf5 100644 --- a/JS/edgechains/examples/retell-ai/webpack.config.cjs +++ b/JS/edgechains/examples/retell-ai/webpack.config.cjs @@ -1,45 +1,45 @@ -const path = require('path') -const webpack = require('webpack'); +const path = require("path"); +const webpack = require("webpack"); module.exports = { - mode: 'development', - entry: './client/index.js', - output: { - path: path.resolve(__dirname, 'dist'), - filename: 'bundle.js', - }, - resolve: { - fallback: { - "buffer": require.resolve("buffer/"), - "stream": require.resolve("stream-browserify"), - "crypto": require.resolve("crypto-browserify"), - "vm": require.resolve("vm-browserify"), - "process": require.resolve("process/browser.js") - } - }, - plugins: [ - new webpack.ProvidePlugin({ - process: 'process/browser.js', - Buffer: ['buffer', 'Buffer'], - }), - ], - devServer: { - static: { - directory: path.resolve(__dirname, 'dist'), + mode: "development", + entry: "./client/index.js", + output: { + path: path.resolve(__dirname, "dist"), + filename: "bundle.js", }, - port: 3000, - open: true, - hot: true, - compress: true, - historyApiFallback: true, - }, - module: { - rules: [ - { - test: /\.css$/i, - include: path.resolve(__dirname, 'client'), - use: ['style-loader', 'css-loader', 'postcss-loader'], - }, + resolve: { + fallback: { + buffer: require.resolve("buffer/"), + stream: require.resolve("stream-browserify"), + crypto: require.resolve("crypto-browserify"), + vm: require.resolve("vm-browserify"), + process: require.resolve("process/browser.js"), + }, + }, + plugins: [ + new webpack.ProvidePlugin({ + process: "process/browser.js", + Buffer: ["buffer", "Buffer"], + }), ], - }, -} + devServer: { + static: { + directory: path.resolve(__dirname, "dist"), + }, + port: 3000, + open: true, + hot: true, + compress: true, + historyApiFallback: true, + }, + module: { + rules: [ + { + test: /\.css$/i, + include: path.resolve(__dirname, "client"), + use: ["style-loader", "css-loader", "postcss-loader"], + }, + ], + }, +}; diff --git a/package.json b/package.json index 6f08f899..ff1eeb15 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,8 @@ "dependencies": { "@microsoft/eslint-formatter-sarif": "^3.1.0", "@playwright/test": "^1.46.0", - "@typescript-eslint/eslint-plugin": "^8.12.2", - "@typescript-eslint/parser": "^8.12.2", + "@typescript-eslint/eslint-plugin": "^8.13.0", + "@typescript-eslint/parser": "^8.13.0", "axios": "^1.7.3", "eslint": "^8.57.1", "eslint-config-google": "^0.14.0",