-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding-voice-ai * fixing-example * removing-extra-files * removing-dist
- Loading branch information
1 parent
a696493
commit 5b1005f
Showing
18 changed files
with
423 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
JS/edgechains/arakoodev/src/ai/src/lib/retell-ai/retell.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
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; | ||
constructor(apiKey: string) { | ||
this.retellClient = new Retell({ | ||
apiKey: apiKey, | ||
}); | ||
this.llm = null; | ||
} | ||
|
||
async createAgent(body: AgentCreateParams, options?: Retell.RequestOptions): Promise<AgentResponse> { | ||
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]] | ||
} | ||
} | ||
const agent = await this.retellClient.agent.create({ ...defaultParams, ...body }, options); | ||
return agent; | ||
} | ||
async createLLM(data?: LlmCreateParams): Promise<LlmResponse> { | ||
const llm = await this.retellClient.llm.create(data || {}); | ||
this.llm = llm; | ||
return llm; | ||
} | ||
|
||
async initiateWebCall(agent_id: string): Promise<string> { | ||
const webCallResponse = await this.retellClient.call.createWebCall({ agent_id }); | ||
return webCallResponse.access_token | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
JS/edgechains/arakoodev/src/ai/src/lib/retell-ai/retellWebClient.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { RetellWebClient as RetellClient, StartCallConfig } from "retell-client-js-sdk"; | ||
|
||
export class RetellWebClient { | ||
client: RetellClient | ||
constructor() { | ||
this.client = new RetellClient(); | ||
} | ||
|
||
on(event: string, callback: (...args: any[]) => void) { | ||
return this.client.on(event, callback); | ||
} | ||
|
||
async startCall(startCallConfig: StartCallConfig) { | ||
return await this.client.startCall(startCallConfig); | ||
} | ||
|
||
async stopCall(): Promise<void> { | ||
return this.client.stopCall(); | ||
} | ||
} | ||
|
||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dist | ||
node_modules | ||
.env | ||
.env.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# 🚀 Welcome to your new awesome project! | ||
|
||
This project has been created using **webpack-cli**, you can now run | ||
|
||
``` | ||
npm run build | ||
``` | ||
|
||
or | ||
|
||
``` | ||
yarn build | ||
``` | ||
|
||
to bundle your application | ||
|
||
## How to use | ||
|
||
1. Install dependencies | ||
|
||
``` | ||
npm install | ||
``` | ||
|
||
2. Run the server | ||
|
||
``` | ||
npm run start | ||
``` | ||
|
||
>>>>>>> 100bddc3 (fixing-example) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import 'htmx.org'; | ||
import { RetellWebClient } from "@arakoodev/edgechains.js/ai"; | ||
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...'; | ||
|
||
} catch (error) { | ||
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'; | ||
} catch (error) { | ||
console.error('Failed to end call:', error); | ||
document.getElementById('error').textContent = `Failed to end call: ${error.message}`; | ||
} | ||
} | ||
|
||
// Expose functions to be used with hyperscript or other event handlers | ||
window.startCall = startCall; | ||
window.endCall = endCall; | ||
|
||
console.log('Client-side code initialized'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
|
||
local general_prompt = "You are a friendly agent that helps people retrieves their questions's answers."; | ||
local begin_message = "Hi, I'm Edgechains agent, how can I help you?"; | ||
|
||
{ | ||
general_prompt: general_prompt, | ||
begin_message: begin_message, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
local RETELL_API_KEY = 'key_****'; | ||
|
||
{ | ||
reteall_api_key: RETELL_API_KEY, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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" | ||
} | ||
} |
Oops, something went wrong.