diff --git a/apps/simple/assemblyai.ts b/apps/simple/assemblyai.ts deleted file mode 100644 index 348d5eefe23b6b1aa21367ef43698f05952e37ba..0000000000000000000000000000000000000000 --- a/apps/simple/assemblyai.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { program } from "commander"; -import { AudioTranscriptReader, TranscribeParams } from "llamaindex"; -import { stdin as input, stdout as output } from "node:process"; -// readline/promises is still experimental so not in @types/node yet -// @ts-ignore -import readline from "node:readline/promises"; -import { VectorStoreIndex } from "../../packages/core/src/indices"; - -program - .option( - "-a, --audio-url [string]", - "URL or path of the audio file to transcribe", - ) - .option("-i, --transcript-id [string]", "ID of the AssemblyAI transcript") - .action(async (options) => { - if (!process.env.ASSEMBLYAI_API_KEY) { - console.log("No ASSEMBLYAI_API_KEY found in environment variables."); - return; - } - - const reader = new AudioTranscriptReader(); - let params: TranscribeParams | string; - if (options.audioUrl) { - params = { - audio: options.audioUrl, - }; - } else if (options.transcriptId) { - params = options.transcriptId; - } else { - console.log( - "You must provide either an --audio-url or a --transcript-id", - ); - return; - } - - const documents = await reader.loadData(params); - console.log(documents); - - // Split text and create embeddings. Store them in a VectorStoreIndex - const index = await VectorStoreIndex.fromDocuments(documents); - - // Create query engine - const queryEngine = index.asQueryEngine(); - - const rl = readline.createInterface({ input, output }); - while (true) { - const query = await rl.question("Ask a question: "); - - if (!query) { - break; - } - - const response = await queryEngine.query(query); - - console.log(response.toString()); - } - }); - -program.parse(); diff --git a/examples/assemblyai.ts b/examples/assemblyai.ts index 348d5eefe23b6b1aa21367ef43698f05952e37ba..b1cc37e95369438f9b88ecb5a29503b12820700d 100644 --- a/examples/assemblyai.ts +++ b/examples/assemblyai.ts @@ -1,14 +1,13 @@ import { program } from "commander"; -import { AudioTranscriptReader, TranscribeParams } from "llamaindex"; +import { AudioTranscriptReader, TranscribeParams, VectorStoreIndex } from "llamaindex"; import { stdin as input, stdout as output } from "node:process"; // readline/promises is still experimental so not in @types/node yet // @ts-ignore import readline from "node:readline/promises"; -import { VectorStoreIndex } from "../../packages/core/src/indices"; program .option( - "-a, --audio-url [string]", + "-a, --audio [string]", "URL or path of the audio file to transcribe", ) .option("-i, --transcript-id [string]", "ID of the AssemblyAI transcript") @@ -20,15 +19,15 @@ program const reader = new AudioTranscriptReader(); let params: TranscribeParams | string; - if (options.audioUrl) { + if (options.audio) { params = { - audio: options.audioUrl, + audio: options.audio, }; } else if (options.transcriptId) { params = options.transcriptId; } else { console.log( - "You must provide either an --audio-url or a --transcript-id", + "You must provide either an --audio or a --transcript-id", ); return; } diff --git a/packages/core/package.json b/packages/core/package.json index 39763d032a2ddae7187d00f65ec99fa6a2cd09b4..c63857acdac48930d7f87eed73954beee26b1cde 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -7,7 +7,7 @@ "@datastax/astra-db-ts": "^0.1.0", "@notionhq/client": "^2.2.14", "@xenova/transformers": "^2.10.0", - "assemblyai": "^3.1.3", + "assemblyai": "^4.0.0", "crypto-js": "^4.2.0", "js-tiktoken": "^1.0.8", "lodash": "^4.17.21", @@ -52,4 +52,4 @@ "build": "tsup src/index.ts --format esm,cjs --dts", "dev": "tsup src/index.ts --format esm,cjs --dts --watch" } -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 33f5341147c4bc71214789168b9adbd9de3126b5..a3531ddc1a024f4a04bf64bca454836565efd8d3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -150,8 +150,8 @@ importers: specifier: ^2.10.0 version: 2.10.0 assemblyai: - specifier: ^3.1.3 - version: 3.1.3 + specifier: ^4.0.0 + version: 4.0.0 crypto-js: specifier: ^4.2.0 version: 4.2.0 @@ -5253,8 +5253,9 @@ packages: safer-buffer: 2.1.2 dev: true - /assemblyai@3.1.3: - resolution: {integrity: sha512-MOVibx4jcKk48lUKoLQWCAnWzm8cBL99GnQ7Af/2XTkGBVUCefocjIO5kJWqRdwLAdoD1D0csR+l4ll62i9vyQ==} + /assemblyai@4.0.0: + resolution: {integrity: sha512-dhASQcGbZuyGkeJN8h7iUzC7eICMyOeiuQ7A4v81vbiNvn1HOwGMli73nD3JN9sOw5JCsAoGRM2wgQMXFM+p2Q==} + engines: {node: '>=18'} dependencies: ws: 8.14.2 transitivePeerDependencies: