diff --git a/.pnp.cjs b/.pnp.cjs index 52a72ba63..896283583 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -7168,7 +7168,7 @@ const RAW_RUNTIME_STATE = ["@types/yaml", "npm:1.9.7"],\ ["@typescript-eslint/eslint-plugin", "virtual:36b10b38a2f3e49d8cd162fbeda8e49e065ae2d0ebbbd25b0a3339d0203e0ec0394d852d27989cf9f4297d5cf181367ebbc4ea51690fe53337f9c0c2783178a4#npm:6.9.0"],\ ["@typescript-eslint/parser", "virtual:36b10b38a2f3e49d8cd162fbeda8e49e065ae2d0ebbbd25b0a3339d0203e0ec0394d852d27989cf9f4297d5cf181367ebbc4ea51690fe53337f9c0c2783178a4#npm:6.9.0"],\ - ["assemblyai", "npm:4.4.2"],\ + ["assemblyai", "npm:4.6.0"],\ ["autoevals", "npm:0.0.26"],\ ["crypto-js", "npm:4.2.0"],\ ["emittery", "npm:1.0.1"],\ @@ -12369,11 +12369,11 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["assemblyai", [\ - ["npm:4.4.2", {\ - "packageLocation": "./.yarn/cache/assemblyai-npm-4.4.2-1a406f9d98-34ab153d34.zip/node_modules/assemblyai/",\ + ["npm:4.6.0", {\ + "packageLocation": "./.yarn/cache/assemblyai-npm-4.6.0-b8890b6dbd-332d7135c9.zip/node_modules/assemblyai/",\ "packageDependencies": [\ - ["assemblyai", "npm:4.4.2"],\ - ["ws", "virtual:1a406f9d98aca59d63097716dd03130c0006f8e0e3878be04653c8ad23ebedf2c463fdfae3f844f3d13d5653eb55b4f4fa6db5f426b9ac8df0db945cd7a041ea#npm:8.16.0"]\ + ["assemblyai", "npm:4.6.0"],\ + ["ws", "virtual:b8890b6dbdda557fc318d38c8ae30c864b86b11af383f035a4092cb69ad7032390605c10465c3f36ecaf4f01bf478d4b4af88d84dd152d7cce36394aad4be560#npm:8.18.0"]\ ],\ "linkType": "HARD"\ }]\ @@ -28637,17 +28637,17 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "SOFT"\ }],\ - ["npm:8.16.0", {\ - "packageLocation": "./.yarn/cache/ws-npm-8.16.0-46943f6199-7c511c59e9.zip/node_modules/ws/",\ + ["npm:8.18.0", {\ + "packageLocation": "./.yarn/cache/ws-npm-8.18.0-56f68bc4d6-70dfe53f23.zip/node_modules/ws/",\ "packageDependencies": [\ - ["ws", "npm:8.16.0"]\ + ["ws", "npm:8.18.0"]\ ],\ "linkType": "SOFT"\ }],\ - ["virtual:1a406f9d98aca59d63097716dd03130c0006f8e0e3878be04653c8ad23ebedf2c463fdfae3f844f3d13d5653eb55b4f4fa6db5f426b9ac8df0db945cd7a041ea#npm:8.16.0", {\ - "packageLocation": "./.yarn/__virtual__/ws-virtual-307d704276/0/cache/ws-npm-8.16.0-46943f6199-7c511c59e9.zip/node_modules/ws/",\ + ["virtual:3cee627136e3222935f2f0574998a299414f2997be4d2273e90c3717e54c7ad49885ef603e817dc15b21193b05a7719a630fbd40250061090ae31e6a388b57d3#npm:8.13.0", {\ + "packageLocation": "./.yarn/__virtual__/ws-virtual-893882e133/0/cache/ws-npm-8.13.0-26ffa3016a-1769532b6f.zip/node_modules/ws/",\ "packageDependencies": [\ - ["ws", "virtual:1a406f9d98aca59d63097716dd03130c0006f8e0e3878be04653c8ad23ebedf2c463fdfae3f844f3d13d5653eb55b4f4fa6db5f426b9ac8df0db945cd7a041ea#npm:8.16.0"],\ + ["ws", "virtual:3cee627136e3222935f2f0574998a299414f2997be4d2273e90c3717e54c7ad49885ef603e817dc15b21193b05a7719a630fbd40250061090ae31e6a388b57d3#npm:8.13.0"],\ ["@types/bufferutil", null],\ ["@types/utf-8-validate", null],\ ["bufferutil", null],\ @@ -28661,10 +28661,10 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["virtual:3cee627136e3222935f2f0574998a299414f2997be4d2273e90c3717e54c7ad49885ef603e817dc15b21193b05a7719a630fbd40250061090ae31e6a388b57d3#npm:8.13.0", {\ - "packageLocation": "./.yarn/__virtual__/ws-virtual-893882e133/0/cache/ws-npm-8.13.0-26ffa3016a-1769532b6f.zip/node_modules/ws/",\ + ["virtual:74fcc7b6256f60a89945acc6b1c62e6158616c0dcf2312663cfe08ceda598b7d943e5de97f39a415e4491198cfa92535d8e40310ec84839b8241ca342059e353#npm:8.14.2", {\ + "packageLocation": "./.yarn/__virtual__/ws-virtual-a03856d0bf/0/cache/ws-npm-8.14.2-b339ac47a2-815ff01d9b.zip/node_modules/ws/",\ "packageDependencies": [\ - ["ws", "virtual:3cee627136e3222935f2f0574998a299414f2997be4d2273e90c3717e54c7ad49885ef603e817dc15b21193b05a7719a630fbd40250061090ae31e6a388b57d3#npm:8.13.0"],\ + ["ws", "virtual:74fcc7b6256f60a89945acc6b1c62e6158616c0dcf2312663cfe08ceda598b7d943e5de97f39a415e4491198cfa92535d8e40310ec84839b8241ca342059e353#npm:8.14.2"],\ ["@types/bufferutil", null],\ ["@types/utf-8-validate", null],\ ["bufferutil", null],\ @@ -28678,10 +28678,10 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["virtual:74fcc7b6256f60a89945acc6b1c62e6158616c0dcf2312663cfe08ceda598b7d943e5de97f39a415e4491198cfa92535d8e40310ec84839b8241ca342059e353#npm:8.14.2", {\ - "packageLocation": "./.yarn/__virtual__/ws-virtual-a03856d0bf/0/cache/ws-npm-8.14.2-b339ac47a2-815ff01d9b.zip/node_modules/ws/",\ + ["virtual:76c6aafc1f7e8989718dbe34dd5529b10d133ec0b59d3fd4cad631c94c4c3cedf8aaae151dbe673b08a30f9b1e402fadc946963bfe223764b0186a410464dc7b#npm:7.5.9", {\ + "packageLocation": "./.yarn/__virtual__/ws-virtual-db43838321/0/cache/ws-npm-7.5.9-26f12a5ed6-171e350129.zip/node_modules/ws/",\ "packageDependencies": [\ - ["ws", "virtual:74fcc7b6256f60a89945acc6b1c62e6158616c0dcf2312663cfe08ceda598b7d943e5de97f39a415e4491198cfa92535d8e40310ec84839b8241ca342059e353#npm:8.14.2"],\ + ["ws", "virtual:76c6aafc1f7e8989718dbe34dd5529b10d133ec0b59d3fd4cad631c94c4c3cedf8aaae151dbe673b08a30f9b1e402fadc946963bfe223764b0186a410464dc7b#npm:7.5.9"],\ ["@types/bufferutil", null],\ ["@types/utf-8-validate", null],\ ["bufferutil", null],\ @@ -28695,10 +28695,10 @@ const RAW_RUNTIME_STATE = ],\ "linkType": "HARD"\ }],\ - ["virtual:76c6aafc1f7e8989718dbe34dd5529b10d133ec0b59d3fd4cad631c94c4c3cedf8aaae151dbe673b08a30f9b1e402fadc946963bfe223764b0186a410464dc7b#npm:7.5.9", {\ - "packageLocation": "./.yarn/__virtual__/ws-virtual-db43838321/0/cache/ws-npm-7.5.9-26f12a5ed6-171e350129.zip/node_modules/ws/",\ + ["virtual:b8890b6dbdda557fc318d38c8ae30c864b86b11af383f035a4092cb69ad7032390605c10465c3f36ecaf4f01bf478d4b4af88d84dd152d7cce36394aad4be560#npm:8.18.0", {\ + "packageLocation": "./.yarn/__virtual__/ws-virtual-354c1e9a39/0/cache/ws-npm-8.18.0-56f68bc4d6-70dfe53f23.zip/node_modules/ws/",\ "packageDependencies": [\ - ["ws", "virtual:76c6aafc1f7e8989718dbe34dd5529b10d133ec0b59d3fd4cad631c94c4c3cedf8aaae151dbe673b08a30f9b1e402fadc946963bfe223764b0186a410464dc7b#npm:7.5.9"],\ + ["ws", "virtual:b8890b6dbdda557fc318d38c8ae30c864b86b11af383f035a4092cb69ad7032390605c10465c3f36ecaf4f01bf478d4b4af88d84dd152d7cce36394aad4be560#npm:8.18.0"],\ ["@types/bufferutil", null],\ ["@types/utf-8-validate", null],\ ["bufferutil", null],\ diff --git a/.yarn/cache/assemblyai-npm-4.4.2-1a406f9d98-34ab153d34.zip b/.yarn/cache/assemblyai-npm-4.4.2-1a406f9d98-34ab153d34.zip deleted file mode 100644 index 35cabba28..000000000 Binary files a/.yarn/cache/assemblyai-npm-4.4.2-1a406f9d98-34ab153d34.zip and /dev/null differ diff --git a/.yarn/cache/assemblyai-npm-4.6.0-b8890b6dbd-332d7135c9.zip b/.yarn/cache/assemblyai-npm-4.6.0-b8890b6dbd-332d7135c9.zip new file mode 100644 index 000000000..00a91aa58 Binary files /dev/null and b/.yarn/cache/assemblyai-npm-4.6.0-b8890b6dbd-332d7135c9.zip differ diff --git a/.yarn/cache/ws-npm-8.16.0-46943f6199-7c511c59e9.zip b/.yarn/cache/ws-npm-8.16.0-46943f6199-7c511c59e9.zip deleted file mode 100644 index 3b552fa0e..000000000 Binary files a/.yarn/cache/ws-npm-8.16.0-46943f6199-7c511c59e9.zip and /dev/null differ diff --git a/.yarn/cache/ws-npm-8.18.0-56f68bc4d6-70dfe53f23.zip b/.yarn/cache/ws-npm-8.18.0-56f68bc4d6-70dfe53f23.zip new file mode 100644 index 000000000..4b76225c8 Binary files /dev/null and b/.yarn/cache/ws-npm-8.18.0-56f68bc4d6-70dfe53f23.zip differ diff --git a/README.md b/README.md index 0578032ee..b4a82929d 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Rivet currently has LLM support for: - [OpenAI GPT-3.5 and GPT-4](https://openai.com/gpt-4) - [Anthropic Claude Instant and Claude 2](https://www.anthropic.com/index/claude-2) - [Anthropic Claude 3 Haiku, Sonnet, and Opus] (https://www.anthropic.com/news/claude-3-family) -- [AssemblyAI LeMUR framework for voice data](https://www.assemblyai.com/models/lemur) +- [AssemblyAI LeMUR framework for voice data](https://www.assemblyai.com/products/speech-understanding?utm_source=rivet) Rivet has embedding/vector database support for: @@ -54,7 +54,7 @@ Rivet has embedding/vector database support for: Rivet also supports these additional integrations: -- [Audio Transcription from AssemblyAI](https://www.assemblyai.com/models/core-transcription) +- [Speech-to-Text from AssemblyAI](https://www.assemblyai.com/discover/products/speech-to-text?utm_source=rivet) For more information on how to use the application and all of its capabilities, see [the documentation](https://rivet.ironcladapp.com/docs)! diff --git a/packages/app/src/plugins.ts b/packages/app/src/plugins.ts index 836ce4ec2..abe976534 100644 --- a/packages/app/src/plugins.ts +++ b/packages/app/src/plugins.ts @@ -90,7 +90,7 @@ export const pluginInfos: PluginInfo[] = [ id: 'assemblyAi', name: 'AssemblyAI', description: dedent` - Use [AssemblyAI](https://www.assemblyai.com/) to build AI applications with voice data. + Use [AssemblyAI](https://www.assemblyai.com/?utm_source=rivet) to build AI applications with voice data. - [Transcribe audio files](https://rivet.ironcladapp.com/docs/user-guide/plugins/built-in/assemblyai#transcribe-audio-node) - [Summarize audio files using LeMUR](https://rivet.ironcladapp.com/docs/user-guide/plugins/built-in/assemblyai#lemur-summary-node) @@ -98,7 +98,7 @@ export const pluginInfos: PluginInfo[] = [ - [Extract action items from audio files using LeMUR](https://rivet.ironcladapp.com/docs/user-guide/plugins/built-in/assemblyai#lemur-action-items) - [Run custom LLM tasks against audio files using LeMUR](https://rivet.ironcladapp.com/docs/user-guide/plugins/built-in/assemblyai#lemur-custom-task) - Follow this [step-by-step tutorial to see these capabilities in action](https://www.assemblyai.com/blog/podcast-qa-application-rivet/). + Follow this [step-by-step tutorial to see these capabilities in action](https://www.assemblyai.com/blog/podcast-qa-application-rivet?utm_source=rivet). `, author: 'AssemblyAI', logoImage: AssemblyAiLogo, @@ -278,8 +278,8 @@ export const pluginInfos: PluginInfo[] = [ description: dedent` Adds several utilities nodes that help with concurrency, pipelines and iterations. - - Iterator node: The iterator Node will map an array of input objects through a provided graph. It allows for parallel execution with concurrency controls and caching. - - Pipeline node: The PipelineNode will take and input and run it through a pipeline of graphs (stages). Each stage's output will be the next graph's input. In addition, the pipeline node can have optional pre/post graph. + - Iterator node: The iterator Node will map an array of input objects through a provided graph. It allows for parallel execution with concurrency controls and caching. + - Pipeline node: The PipelineNode will take and input and run it through a pipeline of graphs (stages). Each stage's output will be the next graph's input. In addition, the pipeline node can have optional pre/post graph. - Pinecone Search/Upsert node: These nodes will allow you to search or upsert documents in a pinecone collection. Allows for metadata, sparse vectors as optional inputs `, tag: 'latest', @@ -300,5 +300,5 @@ export const pluginInfos: PluginInfo[] = [ package: 'rivet-plugin-qdrant', tag: 'latest', logoImage: QdrantLogo, - } + }, ]; diff --git a/packages/cli/README.md b/packages/cli/README.md index 0578032ee..72d47f513 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -45,7 +45,7 @@ Rivet currently has LLM support for: - [OpenAI GPT-3.5 and GPT-4](https://openai.com/gpt-4) - [Anthropic Claude Instant and Claude 2](https://www.anthropic.com/index/claude-2) - [Anthropic Claude 3 Haiku, Sonnet, and Opus] (https://www.anthropic.com/news/claude-3-family) -- [AssemblyAI LeMUR framework for voice data](https://www.assemblyai.com/models/lemur) +- [AssemblyAI LeMUR framework for voice data](https://www.assemblyai.com/discover/products/speech-understanding?utm_source=rivet) Rivet has embedding/vector database support for: @@ -54,7 +54,7 @@ Rivet has embedding/vector database support for: Rivet also supports these additional integrations: -- [Audio Transcription from AssemblyAI](https://www.assemblyai.com/models/core-transcription) +- [Speech-to-Text from AssemblyAI](https://www.assemblyai.com/products/speech-to-text) For more information on how to use the application and all of its capabilities, see [the documentation](https://rivet.ironcladapp.com/docs)! diff --git a/packages/core/README.md b/packages/core/README.md index 0578032ee..c5ed0e531 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -45,7 +45,7 @@ Rivet currently has LLM support for: - [OpenAI GPT-3.5 and GPT-4](https://openai.com/gpt-4) - [Anthropic Claude Instant and Claude 2](https://www.anthropic.com/index/claude-2) - [Anthropic Claude 3 Haiku, Sonnet, and Opus] (https://www.anthropic.com/news/claude-3-family) -- [AssemblyAI LeMUR framework for voice data](https://www.assemblyai.com/models/lemur) +- [AssemblyAI LeMUR framework for voice data](https://www.assemblyai.com/discover/products/speech-understanding?utm_source=rivet) Rivet has embedding/vector database support for: @@ -54,7 +54,7 @@ Rivet has embedding/vector database support for: Rivet also supports these additional integrations: -- [Audio Transcription from AssemblyAI](https://www.assemblyai.com/models/core-transcription) +- [Speech-to-Text from AssemblyAI](https://www.assemblyai.com/products/speech-to-text?utm_source=rivet) For more information on how to use the application and all of its capabilities, see [the documentation](https://rivet.ironcladapp.com/docs)! diff --git a/packages/core/package.json b/packages/core/package.json index cc35ee9df..66d94fe03 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -47,7 +47,7 @@ "@gentrace/core": "^2.2.5", "@google-cloud/vertexai": "^0.1.3", "@huggingface/inference": "^2.6.4", - "assemblyai": "^4.4.2", + "assemblyai": "^4.6.0", "autoevals": "^0.0.26", "crypto-js": "^4.2.0", "emittery": "^1.0.1", diff --git a/packages/core/src/plugins/assemblyAi/LemurActionItemsNode.ts b/packages/core/src/plugins/assemblyAi/LemurActionItemsNode.ts index e5dec3017..30978fd63 100644 --- a/packages/core/src/plugins/assemblyAi/LemurActionItemsNode.ts +++ b/packages/core/src/plugins/assemblyAi/LemurActionItemsNode.ts @@ -1,6 +1,6 @@ import { nanoid } from 'nanoid/non-secure'; import { dedent } from 'ts-dedent'; -import { AssemblyAI, type LemurActionItemsParams } from 'assemblyai'; +import type { LemurActionItemsParams } from 'assemblyai'; import { type ChartNode, type EditorDefinition, @@ -17,10 +17,10 @@ import { import { pluginNodeDefinition } from '../../model/NodeDefinition.js'; import { type LemurNodeData, - getApiKey, + getClient, getLemurParams, lemurEditorDefinitions, - lemurTranscriptIdsInputDefinition, + lemurInputDefinitions, } from './lemurHelpers.js'; export type LemurActionItemsNode = ChartNode<'assemblyAiLemurActionItems', LemurActionItemsNodeData>; @@ -48,7 +48,7 @@ export const LemurActionItemsNodeImpl: PluginNodeImpl = { getInputDefinitions(): NodeInputDefinition[] { return [ - lemurTranscriptIdsInputDefinition, + ...lemurInputDefinitions, { id: 'context' as PortId, dataType: 'string', @@ -92,8 +92,7 @@ export const LemurActionItemsNodeImpl: PluginNodeImpl = { }, async process(data, inputs: Inputs, context: InternalProcessContext): Promise { - const apiKey = getApiKey(context); - const client = new AssemblyAI({ apiKey }); + const client = getClient(context); const params: LemurActionItemsParams = getLemurParams(inputs, data); diff --git a/packages/core/src/plugins/assemblyAi/LemurQaNode.ts b/packages/core/src/plugins/assemblyAi/LemurQaNode.ts index d4ec4b2f4..91e239ef8 100644 --- a/packages/core/src/plugins/assemblyAi/LemurQaNode.ts +++ b/packages/core/src/plugins/assemblyAi/LemurQaNode.ts @@ -20,10 +20,10 @@ import { } from '../../index.js'; import { type LemurNodeData, - getApiKey, + getClient, getLemurParams, lemurEditorDefinitions, - lemurTranscriptIdsInputDefinition, + lemurInputDefinitions, } from './lemurHelpers.js'; import { coerceType } from '../../utils/coerceType.js'; import { pluginNodeDefinition } from '../../model/NodeDefinition.js'; @@ -58,7 +58,7 @@ export const LemurQaNodeImpl = { getInputDefinitions(): NodeInputDefinition[] { return [ - lemurTranscriptIdsInputDefinition, + ...lemurInputDefinitions, { id: 'questions' as PortId, dataType: ['string', 'string[]', 'object', 'object[]', 'any', 'any[]'], @@ -122,8 +122,7 @@ export const LemurQaNodeImpl = { }, async process(data, inputs: Inputs, context: InternalProcessContext): Promise { - const apiKey = getApiKey(context); - const client = new AssemblyAI({ apiKey }); + const client = getClient(context); const questions = getQuestions(inputs).map((question) => applyQuestionEditors(data, question)); diff --git a/packages/core/src/plugins/assemblyAi/LemurSummaryNode.ts b/packages/core/src/plugins/assemblyAi/LemurSummaryNode.ts index ce8e872c5..5013a7a15 100644 --- a/packages/core/src/plugins/assemblyAi/LemurSummaryNode.ts +++ b/packages/core/src/plugins/assemblyAi/LemurSummaryNode.ts @@ -16,10 +16,10 @@ import { } from '../../index.js'; import { type LemurNodeData, - getApiKey, + getClient, getLemurParams, lemurEditorDefinitions, - lemurTranscriptIdsInputDefinition, + lemurInputDefinitions, } from './lemurHelpers.js'; import { pluginNodeDefinition } from '../../model/NodeDefinition.js'; @@ -50,7 +50,7 @@ export const LemurSummaryNodeImpl: PluginNodeImpl = { getInputDefinitions(): NodeInputDefinition[] { return [ - lemurTranscriptIdsInputDefinition, + ...lemurInputDefinitions, { id: 'context' as PortId, dataType: 'string', @@ -94,8 +94,7 @@ export const LemurSummaryNodeImpl: PluginNodeImpl = { }, async process(data, inputs: Inputs, context: InternalProcessContext): Promise { - const apiKey = getApiKey(context); - const client = new AssemblyAI({ apiKey }); + const client = getClient(context); const params: LemurSummaryParams = getLemurParams(inputs, data); if (data.answer_format) { diff --git a/packages/core/src/plugins/assemblyAi/LemurTaskNode.ts b/packages/core/src/plugins/assemblyAi/LemurTaskNode.ts index 6c963470f..e7ad02278 100644 --- a/packages/core/src/plugins/assemblyAi/LemurTaskNode.ts +++ b/packages/core/src/plugins/assemblyAi/LemurTaskNode.ts @@ -1,6 +1,6 @@ import { nanoid } from 'nanoid/non-secure'; import { dedent } from 'ts-dedent'; -import { AssemblyAI, type LemurTaskParams } from 'assemblyai'; +import { type LemurTaskParams } from 'assemblyai'; import { type ChartNode, type EditorDefinition, @@ -16,10 +16,10 @@ import { } from '../../index.js'; import { type LemurNodeData, - getApiKey, + getClient, getLemurParams, lemurEditorDefinitions, - lemurTranscriptIdsInputDefinition, + lemurInputDefinitions, } from './lemurHelpers.js'; import { pluginNodeDefinition } from '../../model/NodeDefinition.js'; import { coerceTypeOptional } from '../../utils/coerceType.js'; @@ -51,7 +51,7 @@ export const LemurTaskNodeImpl: PluginNodeImpl = { getInputDefinitions(): NodeInputDefinition[] { return [ - lemurTranscriptIdsInputDefinition, + ...lemurInputDefinitions, { id: 'prompt' as PortId, dataType: 'string', @@ -95,8 +95,7 @@ export const LemurTaskNodeImpl: PluginNodeImpl = { }, async process(data, inputs: Inputs, context: InternalProcessContext): Promise { - const apiKey = getApiKey(context); - const client = new AssemblyAI({ apiKey }); + const client = getClient(context); const params: LemurTaskParams = { prompt: coerceTypeOptional(inputs['prompt' as PortId], 'string') || data.prompt || '', ...getLemurParams(inputs, data), diff --git a/packages/core/src/plugins/assemblyAi/TranscribeAudioNode.ts b/packages/core/src/plugins/assemblyAi/TranscribeAudioNode.ts index e44f21dbd..add6f7fba 100644 --- a/packages/core/src/plugins/assemblyAi/TranscribeAudioNode.ts +++ b/packages/core/src/plugins/assemblyAi/TranscribeAudioNode.ts @@ -1,6 +1,5 @@ import { nanoid } from 'nanoid/non-secure'; import { dedent } from 'ts-dedent'; -import { AssemblyAI } from 'assemblyai'; import type { TranscribeParams, TranscriptParams } from 'assemblyai'; import { type AnyDataValue, @@ -18,7 +17,7 @@ import { type PortId, type StringDataValue, } from '../../index.js'; -import { getApiKey } from './lemurHelpers.js'; +import { getClient } from './lemurHelpers.js'; import { pluginNodeDefinition } from '../../model/NodeDefinition.js'; import { coerceType } from '../../utils/coerceType.js'; @@ -83,7 +82,7 @@ export const TranscribeAudioNodeImpl: PluginNodeImpl = { language: 'json', dataKey: 'transcriptParameters', helperMessage: `Configure additional parameters using a JSON object. This will override any other fields you have set. - For a detailed list of parameters, see [the AssemblyAI API documentation](https://www.assemblyai.com/docs/api-reference/transcript#create-a-transcript).`, + For a detailed list of parameters, see [the AssemblyAI API documentation](https://www.assemblyai.com/docs/api-reference/transcripts/submit?utm_source=rivet).`, }, ]; }, @@ -105,8 +104,7 @@ export const TranscribeAudioNodeImpl: PluginNodeImpl = { const input = inputs['audio' as PortId] as AudioDataValue | StringDataValue | AnyDataValue; if (!input) throw new Error('Audio input is required.'); - const apiKey = getApiKey(context); - const client = new AssemblyAI({ apiKey }); + const client = getClient(context); let audioUrl: string; if (input.type === 'audio') { diff --git a/packages/core/src/plugins/assemblyAi/lemurHelpers.ts b/packages/core/src/plugins/assemblyAi/lemurHelpers.ts index 7b4b5e423..ed43a70e5 100644 --- a/packages/core/src/plugins/assemblyAi/lemurHelpers.ts +++ b/packages/core/src/plugins/assemblyAi/lemurHelpers.ts @@ -1,3 +1,4 @@ +import { AssemblyAI } from 'assemblyai'; import type { LemurBaseParams } from 'assemblyai'; import { type AnyDataValue, @@ -10,13 +11,13 @@ import { } from '../../index.js'; import { coerceType, coerceTypeOptional } from '../../utils/coerceType.js'; -function getTranscriptIds(inputs: Inputs): string[] { +function getTranscriptIds(inputs: Inputs): string[] | undefined { const input = inputs['transcript_ids' as PortId] as | StringDataValue | StringArrayDataValue | AnyDataValue | ArrayDataValue; - if (!input) throw new Error('Transcript IDs are required.'); + if (!input) return undefined; if (input.type === 'string' || (input.type === 'any' && typeof input.value === 'string')) { return [coerceType(input, 'string')]; @@ -30,30 +31,45 @@ function getTranscriptIds(inputs: Inputs): string[] { throw new Error('Transcript IDs must be a string or string[] of transcript IDs.'); } -export function getApiKey(context: InternalProcessContext) { +const userAgent = { + integration: { + name: 'Rivet', + version: '1.0.1', + }, +}; +export function getClient(context: InternalProcessContext): AssemblyAI { const apiKey = context.getPluginConfig('assemblyAiApiKey'); if (!apiKey) { throw new Error('AssemblyAI API key not set.'); } - return apiKey; + return new AssemblyAI({ apiKey, userAgent }); } export function getLemurParams(inputs: Inputs, editorData: LemurNodeData): LemurBaseParams { const params: LemurBaseParams = { transcript_ids: getTranscriptIds(inputs), + input_text: coerceTypeOptional(inputs['input_text' as PortId], 'string'), context: coerceTypeOptional(inputs['context' as PortId], 'string') || editorData.context || undefined, final_model: editorData.final_model && editorData.final_model !== 'default' ? editorData.final_model : undefined, max_output_size: editorData.max_output_size, + temperature: editorData.temperature, }; return params; } -export const lemurTranscriptIdsInputDefinition = { - id: 'transcript_ids' as PortId, - dataType: ['string', 'string[]', 'any', 'any[]'], - title: 'Transcript IDs', -} as const; +export const lemurInputDefinitions = [ + { + id: 'transcript_ids' as PortId, + dataType: ['string', 'string[]', 'any', 'any[]'], + title: 'Transcript IDs', + }, + { + id: 'input_text' as PortId, + dataType: ['string'], + title: 'Input Text', + }, +] as const; export const lemurEditorDefinitions = [ { @@ -61,14 +77,46 @@ export const lemurEditorDefinitions = [ label: 'Final Model', dataKey: 'final_model', options: [ + { + value: 'anthropic/claude-3-5-sonnet', + label: 'Claude 3.5 Sonnet (on Anthropic)', + }, + { + value: 'anthropic/claude-3-opus', + label: 'Claude 3 Opus (on Anthropic)', + }, + { + value: 'anthropic/claude-3-haiku', + label: 'Claude 3 Haiku (on Anthropic)', + }, + { + value: 'anthropic/claude-3-sonnet', + label: 'Claude 3 Sonnet (on Anthropic)', + }, + { + value: 'anthropic/claude-2-1', + label: 'Claude 2.1 (on Anthropic)', + }, + { + value: 'anthropic/claude-2', + label: 'Claude 2.1 (on Anthropic)', + }, { value: 'default', label: 'Default', }, + { + value: 'anthropic/claude-instant-1-2', + label: 'Claude Instant 1.2 (on Anthropic)', + }, { value: 'basic', label: 'Basic', }, + { + value: 'assemblyai/mistral-7b', + label: 'Mistral 7B (hosted by AssemblyAI)', + }, ], }, { @@ -76,12 +124,30 @@ export const lemurEditorDefinitions = [ label: 'Maximum Output Size', dataKey: 'max_output_size', }, + { + type: 'number', + label: 'Temperature', + dataKey: 'temperature', + min: 0, + max: 1, + }, ] as const; -export type FinalModel = 'default' | 'basic'; +export type FinalModel = + | 'anthropic/claude-3-5-sonnet' + | 'anthropic/claude-3-opus' + | 'anthropic/claude-3-haiku' + | 'anthropic/claude-3-sonnet' + | 'anthropic/claude-2-1' + | 'anthropic/claude-2' + | 'default' + | 'anthropic/claude-instant-1-2' + | 'basic' + | 'assemblyai/mistral-7b'; export type LemurNodeData = { context?: string; final_model?: FinalModel; max_output_size?: number; + temperature?: number; }; diff --git a/packages/docs/docs/user-guide/plugins/built-in/assemblyai.md b/packages/docs/docs/user-guide/plugins/built-in/assemblyai.md index 96165b512..bb2d33abe 100644 --- a/packages/docs/docs/user-guide/plugins/built-in/assemblyai.md +++ b/packages/docs/docs/user-guide/plugins/built-in/assemblyai.md @@ -14,7 +14,7 @@ At the moment you must use the [node executor](../../executors.md) to use the As ### Transcribe Audio Node -The Transcribe Audio node transcribes audio using the [AssemblyAI](https://www.assemblyai.com/) API. It will return a transcript of the given audio source. +The Transcribe Audio node transcribes audio using the [AssemblyAI](https://www.assemblyai.com/?utm_source=rivet) API. It will return a transcript of the given audio source. ![Transcribe Audio Node](./assets/transcribe-audio-node.png) @@ -22,7 +22,7 @@ The Transcribe Audio node transcribes audio using the [AssemblyAI](https://www.a AssemblyAI's LeMUR (Leveraging Large Language Models to Understand Recognized Speech) is a framework to process audio files with an LLM. The AssemblyAI plugin has a dedicated node for each LeMUR endpoint. -Each node accepts Transcript IDs as input which you can get from the Transcribe Audio Node. Additional parameters are available as inputs and as node configuration. For more information what these parameters do, [check out the LeMUR API reference](https://www.assemblyai.com/docs/api-reference/lemur). +Each node accepts Transcript IDs as input which you can get from the Transcribe Audio Node. Additional parameters are available as inputs and as node configuration. For more information what these parameters do, [check out the LeMUR API reference](https://www.assemblyai.com/docs/api-reference/lemur?utm_source=lemur). #### LeMUR Summary Node diff --git a/packages/docs/src/components/main/UseCasesSection.tsx b/packages/docs/src/components/main/UseCasesSection.tsx index a87d670cc..7adc2d4ef 100644 --- a/packages/docs/src/components/main/UseCasesSection.tsx +++ b/packages/docs/src/components/main/UseCasesSection.tsx @@ -71,7 +71,7 @@ export const UseCasesSection: React.FC<{ id?: string }> = ({ id }) => { /> =5.0.2" @@ -20857,7 +20857,7 @@ __metadata: optional: true utf-8-validate: optional: true - checksum: 7c511c59e979bd37b63c3aea4a8e4d4163204f00bd5633c053b05ed67835481995f61a523b0ad2b603566f9a89b34cb4965cb9fab9649fbfebd8f740cea57f17 + checksum: 70dfe53f23ff4368d46e4c0b1d4ca734db2c4149c6f68bc62cb16fc21f753c47b35fcc6e582f3bdfba0eaeb1c488cddab3c2255755a5c3eecb251431e42b3ff6 languageName: node linkType: hard