revdotcom / revai-node-sdk Goto Github PK
View Code? Open in Web Editor NEWNode.js SDK for the Rev AI API
License: MIT License
Node.js SDK for the Rev AI API
License: MIT License
The errors thrown by the SDK do not extend native JS errors.
Is there any downside to extending from Error
? The current behavior means our monitoring service (Sentry) won't properly capture the error.
Hello,
We're using this library for our RevAI integration and seeing that some updates are being made but there is no public documentation to understand what breaking changes or new features are being added. Is it possible to add the support for this?
Thansk
Current version of axios used by the library has a vulnerability. https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459
While usage in this library likely isn't affected at all due to the vuln being CSRF related, bumping the version would reduce the maintenance burden on rev.ai customers to not have to ignore / silence security warnings in build pipelines etc
In the main rev documentation now shows that an RTMP URI can now be used as a source. Can someone give a quick example of this?
This project uses axios
, which limits the body size to 10mb by default (via maxBodyLength
). See https://axios-http.com/docs/req_config.
This limit should probably be increased to 2gb to match the API, or at least be configurable. Currently the submitJobLocalFile
will throw an error if files larger than 10mb
EU based accounts require a different base URL (source):
Yet, the SDK hardcodes the US based URL:
revai-node-sdk/src/api-client.ts
Line 31 in a250658
It's possible to overwrite the apiHandler
field of the client (by plugging into the internal API):
import { RevAiApiClient } from 'revai-node-sdk';
import { ApiRequestHandler } from 'revai-node-sdk/src/api-request-handler';
...
const client = new RevAiApiClient(accessToken);
client.apiHandler = new ApiRequestHandler('https://ec1.api.rev.ai/speechtotext/v1/', accessToken);
Calling RevAiStreamingClient's client.unsafeEnd()
often leads to a crash:
Error [ERR_STREAM_PUSH_AFTER_EOF]: stream.push() after EOF
at readableAddChunk (_stream_readable.js:257:32)
at PassThrough.Readable.push (_stream_readable.js:224:10)
at PassThrough.Transform.push (_stream_transform.js:151:32)
at PassThrough.afterTransform (_stream_transform.js:92:10)
at PassThrough._transform (_stream_passthrough.js:42:3)
at PassThrough.Transform._read (_stream_transform.js:190:10)
at PassThrough.Transform._write (_stream_transform.js:178:12)
at doWrite (_stream_writable.js:415:12)
at writeOrBuffer (_stream_writable.js:399:5)
at PassThrough.Writable.write (_stream_writable.js:299:11)
Emitted 'error' event at:
at errorOrDestroy (internal/streams/destroy.js:107:12)
at readableAddChunk (_stream_readable.js:257:9)
at PassThrough.Readable.push (_stream_readable.js:224:10)
[... lines matching original stack trace ...]
at writeOrBuffer (_stream_writable.js:399:5)
What's happening here is that unsafeEnd
is calling closeStreams
, which executes this.responses.push(null)
. Once null
has been pushed onto a stream, you cannot push to it again. Then, as the connection gets a response from rev.ai, we write to this.response
again:
revai-node-sdk/src/streaming-client.ts
Line 138 in ece2087
Reproduction of this crash: https://codesandbox.io/s/revai-node-sdk-crash-hpy8u?file=/src/index.js (assign a rev.ai API token to the "token" variable). This is the streaming example from the document + a call to unsafeEnd
before we've sent/received all of the results.
Something like this should fix it:
diff --git a/src/streaming-client.ts b/src/streaming-client.ts
index 8374e49..f56715e 100644
--- a/src/streaming-client.ts
+++ b/src/streaming-client.ts
@@ -34,6 +34,7 @@ export class RevAiStreamingClient extends EventEmitter {
private config: AudioConfig;
private requests: PassThrough;
private responses: PassThrough;
+ private streamsClosed: boolean;
/**
* @param accessToken Access token associated with the user's account
@@ -130,6 +131,9 @@ export class RevAiStreamingClient extends EventEmitter {
this.closeStreams();
});
connection.on('message', (message: any) => {
+ if (this.streamsClosed) {
+ return;
+ }
if (message.type === 'utf8') {
let response = JSON.parse(message.utf8Data);
if ((response as StreamingResponse).type === 'connected') {
@@ -159,5 +163,6 @@ export class RevAiStreamingClient extends EventEmitter {
private closeStreams(): void {
this.requests.end();
this.responses.push(null);
+ this.streamsClosed = true;
}
-}
\ No newline at end of file
+}
I'm getting this message after installing the SDK and importing it as such:
import { RevAiApiClient } from 'revai-node-sdk';
I should mention that I'm using the Svelte framework and working on an Electron desktop app.
Can anyone help me understand what seems to be the issue?
Is it possible to use the streaming api in a chrome extension ?
When I tried, I first had issue with 'fs' module being unavailable, but it doesn't seem necessary for my use case.
After deletion of 'fs' references,
the code block on this call:
client = new revai.RevAiStreamingClient(token, audioConfig)
We are trying this service for the first time, and we have ran into this issue.
Hi, you recently released foreign language support https://rev-ai-non-english-streaming.redoc.ly/#section/WebSocket-Endpoint/Language-(Labs), but SessionConfig
still does not take a language, seems like a pretty straight forward addition.
Thanks!
The JobStatus.Failed
enum is defined as 'failed'
, but the documentation for "Get Job by Id" says that it should be be 'failure'
. https://www.rev.ai/docs#operation/GetJobById
We need to upgrade to 3.0 to get away from the issue around dropped sockets connections with mistaken closure strings in the feed, however when we upgrade to 3x the partials inbound are so slow that it is not possible to use for our captions any-longer.
Are we possibly missing a new configuration flag that would return partials with the expediency of 2.62?
we are using ffmpeg to add a wav audio into a pipe.
our session config is:
const getSessionConfig = (streamID, vocab) => new revai.SessionConfig(
metadata=streamID, /* (optional) metadata */
customVocabularyID=vocab, /* (optional) custom_vocabulary_id */
filterProfanity=true, /* (optional) filter_profanity */
removeDisfluencies=true, /* (optional) remove_disfluencies */
);
what was millisecond return latency is now over 10 to 20 seconds to get partials using the newest version
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.