Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AssemblyAI Node SDK #226

Merged
merged 3 commits into from
Oct 31, 2023
Merged

Use AssemblyAI Node SDK #226

merged 3 commits into from
Oct 31, 2023

Conversation

Swimburger
Copy link
Collaborator

I updated the AssemblyAI plugin to use the AssemblyAI Node SDK.
This did require me to polyfill a couple of Node APIs.

@Swimburger Swimburger requested a review from abrenneke October 24, 2023 17:41
@abrenneke
Copy link
Collaborator

I'd really prefer to not polyfill node APIs, because Rivet is designed to run without any kind of polyfill. Is there anything we can do to make this or your library isomorphic? It's important to me to keep Rivet isomorphic and not depend on any library that's node or browser specific.

@Swimburger
Copy link
Collaborator Author

Got it. If we provide a browser-specific module (specify "browser" in package.json of assemblyai), would Rivet pick that for the browser, and the CommonJS one for Node?

@abrenneke
Copy link
Collaborator

abrenneke commented Oct 24, 2023

I suppose that depends on the bundler used. I haven't tested it. I wonder if it's time to move this plugin out of core maybe? Like https://github.com/abrenneke/rivet-plugin-example-python-exec is the example repo. And I just wrote the docs on creating plugins too. Then you could do whatever you like with regards to libraries.

@Swimburger
Copy link
Collaborator Author

I updated the SDK so it no longer requires polyfills in Rivet. Being built into Rivet was one of the appeals for us to contribute the integration, so I hope we can keep it in, but we can move it out if it makes more sense.

@abrenneke
Copy link
Collaborator

Sure it's fine! There's really not much difference between built-in plugins and external ones at this point. Built-in plugins allow you to modify the Rivet UI though and add functionality there - if you're only adding nodes, the only real difference is that there's no "install" step and the plugin activates immediately

@Swimburger
Copy link
Collaborator Author

We always went the fewest possible steps to success of course. ;)
Is this PR okay now?

Copy link
Collaborator

@abrenneke abrenneke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!

@abrenneke abrenneke merged commit 8a60cd7 into main Oct 31, 2023
2 checks passed
@Swimburger Swimburger deleted the use-assemblyai-sdk branch October 31, 2023 17:47
@abrenneke
Copy link
Collaborator

@Swimburger latest builds have these warnings:

[plugin:vite:resolve] Module "stream" has been externalized for browser compatibility, imported by "/Users/Shared/ironclad/rivet/.yarn/cache/assemblyai-npm-3.0.1-41a2932ec5-bfa7c25c89.zip/node_modules/assemblyai/dist/index.esm.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] Module "fs" has been externalized for browser compatibility, imported by "/Users/Shared/ironclad/rivet/.yarn/cache/assemblyai-npm-3.0.1-41a2932ec5-bfa7c25c89.zip/node_modules/assemblyai/dist/index.esm.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.

@Swimburger
Copy link
Collaborator Author

@abrenneke The plugin doesn't rely on stream or fs, so we can disregard.
In the next version of the SDK we're using web standard streams tho, so that'll be gone, and we'll have a browser-compatible export that doesn't use fs either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants