assemblyai 4.13.0-beta.1 → 4.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assemblyai.umd.js +9 -7
- package/dist/assemblyai.umd.min.js +1 -1
- package/dist/browser.mjs +9 -7
- package/dist/bun.mjs +9 -7
- package/dist/deno.mjs +9 -7
- package/dist/index.cjs +9 -7
- package/dist/index.mjs +9 -7
- package/dist/node.cjs +9 -7
- package/dist/node.mjs +9 -7
- package/dist/services/streaming/factory.d.ts +1 -0
- package/dist/types/streaming/index.d.ts +4 -6
- package/dist/workerd.mjs +9 -7
- package/package.json +1 -1
- package/src/services/streaming/factory.ts +10 -1
- package/src/services/streaming/service.ts +2 -12
- package/src/types/streaming/index.ts +4 -6
package/dist/assemblyai.umd.js
CHANGED
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
defaultUserAgentString += navigator.userAgent;
|
|
66
66
|
}
|
|
67
67
|
const defaultUserAgent = {
|
|
68
|
-
sdk: { name: "JavaScript", version: "4.13.
|
|
68
|
+
sdk: { name: "JavaScript", version: "4.13.1" },
|
|
69
69
|
};
|
|
70
70
|
if (typeof process !== "undefined") {
|
|
71
71
|
if (process.versions.node && defaultUserAgentString.indexOf("Node") === -1) {
|
|
@@ -894,9 +894,6 @@ Learn more at https://github.com/AssemblyAI/assemblyai-node-sdk/blob/main/docs/c
|
|
|
894
894
|
}
|
|
895
895
|
const searchParams = new URLSearchParams();
|
|
896
896
|
searchParams.set("sample_rate", this.params.sampleRate.toString());
|
|
897
|
-
if (this.params.wordFinalizationMaxWaitTime) {
|
|
898
|
-
searchParams.set("word_finalization_max_wait_time", this.params.wordFinalizationMaxWaitTime.toString());
|
|
899
|
-
}
|
|
900
897
|
if (this.params.endOfTurnConfidenceThreshold) {
|
|
901
898
|
searchParams.set("end_of_turn_confidence_threshold", this.params.endOfTurnConfidenceThreshold.toString());
|
|
902
899
|
}
|
|
@@ -906,8 +903,8 @@ Learn more at https://github.com/AssemblyAI/assemblyai-node-sdk/blob/main/docs/c
|
|
|
906
903
|
if (this.params.maxTurnSilence) {
|
|
907
904
|
searchParams.set("max_turn_silence", this.params.maxTurnSilence.toString());
|
|
908
905
|
}
|
|
909
|
-
if (this.params.
|
|
910
|
-
searchParams.set("
|
|
906
|
+
if (this.params.formatTurns) {
|
|
907
|
+
searchParams.set("format_turns", this.params.formatTurns.toString());
|
|
911
908
|
}
|
|
912
909
|
url.search = searchParams.toString();
|
|
913
910
|
return url;
|
|
@@ -1013,9 +1010,14 @@ Learn more at https://github.com/AssemblyAI/assemblyai-node-sdk/blob/main/docs/c
|
|
|
1013
1010
|
class StreamingTranscriberFactory extends BaseService {
|
|
1014
1011
|
constructor(params) {
|
|
1015
1012
|
super(params);
|
|
1013
|
+
this.baseServiceParams = params;
|
|
1016
1014
|
}
|
|
1017
1015
|
transcriber(params) {
|
|
1018
|
-
|
|
1016
|
+
const serviceParams = Object.assign({}, params);
|
|
1017
|
+
if (!serviceParams.token && !serviceParams.apiKey) {
|
|
1018
|
+
serviceParams.apiKey = this.baseServiceParams.apiKey;
|
|
1019
|
+
}
|
|
1020
|
+
return new StreamingTranscriber(serviceParams);
|
|
1019
1021
|
}
|
|
1020
1022
|
createTemporaryToken(params) {
|
|
1021
1023
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).assemblyai={})}(this,(function(e){"use strict";function t(e,t,s,i){return new(s||(s=Promise))((function(n,r){function o(e){try{c(i.next(e))}catch(e){r(e)}}function a(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const s={cache:"no-store"};let i="";"undefined"!=typeof navigator&&navigator.userAgent&&(i+=navigator.userAgent);const n={sdk:{name:"JavaScript",version:"4.13.0-beta.1"}};"undefined"!=typeof process&&(process.versions.node&&-1===i.indexOf("Node")&&(n.runtime_env={name:"Node",version:process.versions.node}),process.versions.bun&&-1===i.indexOf("Bun")&&(n.runtime_env={name:"Bun",version:process.versions.bun})),"undefined"!=typeof Deno&&process.versions.bun&&-1===i.indexOf("Deno")&&(n.runtime_env={name:"Deno",version:Deno.version.deno});class r{constructor(e){var t;this.params=e,!1===e.userAgent?this.userAgent=void 0:this.userAgent=(t=e.userAgent||{},i+(!1===t?"":" AssemblyAI/1.0 ("+Object.entries(Object.assign(Object.assign({},n),t)).map((([e,t])=>t?`${e}=${t.name}/${t.version}`:"")).join(" ")+")"))}fetch(e,i){return t(this,void 0,void 0,(function*(){i=Object.assign(Object.assign({},s),i);let t={Authorization:this.params.apiKey,"Content-Type":"application/json"};(null==s?void 0:s.headers)&&(t=Object.assign(Object.assign({},t),s.headers)),(null==i?void 0:i.headers)&&(t=Object.assign(Object.assign({},t),i.headers)),this.userAgent&&(t["User-Agent"]=this.userAgent,"undefined"!=typeof window&&"chrome"in window&&(t["AssemblyAI-Agent"]=this.userAgent)),i.headers=t,e.startsWith("http")||(e=this.params.baseUrl+e);const n=yield fetch(e,i);if(n.status>=400){let e;const t=yield n.text();if(t){try{e=JSON.parse(t)}catch(e){}if(null==e?void 0:e.error)throw new Error(e.error);throw new Error(t)}throw new Error(`HTTP Error: ${n.status} ${n.statusText}`)}return n}))}fetchJson(e,s){return t(this,void 0,void 0,(function*(){return(yield this.fetch(e,s)).json()}))}}class o extends r{summary(e){return this.fetchJson("/lemur/v3/generate/summary",{method:"POST",body:JSON.stringify(e)})}questionAnswer(e){return this.fetchJson("/lemur/v3/generate/question-answer",{method:"POST",body:JSON.stringify(e)})}actionItems(e){return this.fetchJson("/lemur/v3/generate/action-items",{method:"POST",body:JSON.stringify(e)})}task(e){return this.fetchJson("/lemur/v3/generate/task",{method:"POST",body:JSON.stringify(e)})}getResponse(e){return this.fetchJson(`/lemur/v3/${e}`)}purgeRequestData(e){return this.fetchJson(`/lemur/v3/${e}`,{method:"DELETE"})}}const{WritableStream:a}="undefined"!=typeof window?window:"undefined"!=typeof global?global:globalThis;var c,l;const d=null!==(l=null!==(c=null!==WebSocket&&void 0!==WebSocket?WebSocket:null===global||void 0===global?void 0:global.WebSocket)&&void 0!==c?c:null===window||void 0===window?void 0:window.WebSocket)&&void 0!==l?l:null===self||void 0===self?void 0:self.WebSocket,h=(e,t)=>t?new d(e,t):new d(e),u={[4e3]:"Sample rate must be a positive integer",[4001]:"Not Authorized",[4002]:"Insufficient funds",[4003]:"This feature is paid-only and requires you to add a credit card. Please visit https://app.assemblyai.com/ to add a credit card to your account.",[4004]:"Session ID does not exist",[4008]:"Session has expired",[4010]:"Session is closed",[4029]:"Rate limited",[4030]:"Unique session violation",[4031]:"Session Timeout",[4032]:"Audio too short",[4033]:"Audio too long",[4034]:"Audio too small to transcode",[4100]:"Bad JSON",[4101]:"Bad schema",[4102]:"Too many streams",[4103]:"This session has been reconnected. This WebSocket is no longer valid.",[1013]:"Reconnect attempts exhausted",[4104]:"Could not parse word boost parameter"};class p extends Error{}const m={[4e3]:"Sample rate must be a positive integer",[4001]:"Not Authorized",[4002]:"Insufficient funds",[4003]:"This feature is paid-only and requires you to add a credit card. Please visit https://app.assemblyai.com/ to add a credit card to your account.",[4004]:"Session ID does not exist",[4008]:"Session has expired",[4010]:"Session is closed",[4029]:"Rate limited",[4030]:"Unique session violation",[4031]:"Session Timeout",[4032]:"Audio too short",[4033]:"Audio too long",[4034]:"Audio too small to transcode",[4101]:"Bad schema",[4102]:"Too many streams",[4103]:"This session has been reconnected. This WebSocket is no longer valid."};class f extends Error{}const v='{"terminate_session":true}';class y{constructor(e){var t,s;if(this.listeners={},this.realtimeUrl=null!==(t=e.realtimeUrl)&&void 0!==t?t:"wss://api.assemblyai.com/v2/realtime/ws",this.sampleRate=null!==(s=e.sampleRate)&&void 0!==s?s:16e3,this.wordBoost=e.wordBoost,this.encoding=e.encoding,this.endUtteranceSilenceThreshold=e.endUtteranceSilenceThreshold,this.disablePartialTranscripts=e.disablePartialTranscripts,"token"in e&&e.token&&(this.token=e.token),"apiKey"in e&&e.apiKey&&(this.apiKey=e.apiKey),!this.token&&!this.apiKey)throw new Error("API key or temporary token is required.")}connectionUrl(){const e=new URL(this.realtimeUrl);if("wss:"!==e.protocol)throw new Error("Invalid protocol, must be wss");const t=new URLSearchParams;return this.token&&t.set("token",this.token),t.set("sample_rate",this.sampleRate.toString()),this.wordBoost&&this.wordBoost.length>0&&t.set("word_boost",JSON.stringify(this.wordBoost)),this.encoding&&t.set("encoding",this.encoding),t.set("enable_extra_session_information","true"),this.disablePartialTranscripts&&t.set("disable_partial_transcripts",this.disablePartialTranscripts.toString()),e.search=t.toString(),e}on(e,t){this.listeners[e]=t}connect(){return new Promise((e=>{if(this.socket)throw new Error("Already connected");const t=this.connectionUrl();this.token?this.socket=h(t.toString()):(console.warn("API key authentication is not supported for the RealtimeTranscriber in browser environment. Use temporary token authentication instead.\nLearn more at https://github.com/AssemblyAI/assemblyai-node-sdk/blob/main/docs/compat.md#browser-compatibility."),this.socket=h(t.toString(),{headers:{Authorization:this.apiKey}})),this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{void 0!==this.endUtteranceSilenceThreshold&&null!==this.endUtteranceSilenceThreshold&&this.configureEndUtteranceSilenceThreshold(this.endUtteranceSilenceThreshold)},this.socket.onclose=({code:e,reason:t})=>{var s,i;t||e in u&&(t=u[e]),null===(i=(s=this.listeners).close)||void 0===i||i.call(s,e,t)},this.socket.onerror=e=>{var t,s,i,n;e.error?null===(s=(t=this.listeners).error)||void 0===s||s.call(t,e.error):null===(n=(i=this.listeners).error)||void 0===n||n.call(i,new Error(e.message))},this.socket.onmessage=({data:t})=>{var s,i,n,r,o,a,c,l,d,h,u,m,f,v,y;const b=JSON.parse(t.toString());if("error"in b)null===(i=(s=this.listeners).error)||void 0===i||i.call(s,new p(b.error));else switch(b.message_type){case"SessionBegins":{const t={sessionId:b.session_id,expiresAt:new Date(b.expires_at)};e(t),null===(r=(n=this.listeners).open)||void 0===r||r.call(n,t);break}case"PartialTranscript":b.created=new Date(b.created),null===(a=(o=this.listeners).transcript)||void 0===a||a.call(o,b),null===(l=(c=this.listeners)["transcript.partial"])||void 0===l||l.call(c,b);break;case"FinalTranscript":b.created=new Date(b.created),null===(h=(d=this.listeners).transcript)||void 0===h||h.call(d,b),null===(m=(u=this.listeners)["transcript.final"])||void 0===m||m.call(u,b);break;case"SessionInformation":null===(v=(f=this.listeners).session_information)||void 0===v||v.call(f,b);break;case"SessionTerminated":null===(y=this.sessionTerminatedResolve)||void 0===y||y.call(this)}}}))}sendAudio(e){this.send(e)}stream(){return new a({write:e=>{this.sendAudio(e)}})}forceEndUtterance(){this.send('{"force_end_utterance":true}')}configureEndUtteranceSilenceThreshold(e){this.send(`{"end_utterance_silence_threshold":${e}}`)}send(e){if(!this.socket||this.socket.readyState!==this.socket.OPEN)throw new Error("Socket is not open for communication");this.socket.send(e)}close(){return t(this,arguments,void 0,(function*(e=!0){var t;if(this.socket){if(this.socket.readyState===this.socket.OPEN)if(e){const e=new Promise((e=>{this.sessionTerminatedResolve=e}));this.socket.send(v),yield e}else this.socket.send(v);(null===(t=this.socket)||void 0===t?void 0:t.removeAllListeners)&&this.socket.removeAllListeners(),this.socket.close()}this.listeners={},this.socket=void 0}))}}class b extends r{constructor(e){super(e),this.rtFactoryParams=e}createService(e){return this.transcriber(e)}transcriber(e){const t=Object.assign({},e);return t.token||t.apiKey||(t.apiKey=this.rtFactoryParams.apiKey),new y(t)}createTemporaryToken(e){return t(this,void 0,void 0,(function*(){return(yield this.fetchJson("/v2/realtime/token",{method:"POST",body:JSON.stringify(e)})).token}))}}function w(e){return e.startsWith("http")||e.startsWith("https")||e.startsWith("data:")?null:e.startsWith("file://")?e.substring(7):e.startsWith("file:")?e.substring(5):e}class g extends r{constructor(e,t){super(e),this.files=t}transcribe(e,s){return t(this,void 0,void 0,(function*(){const t=yield this.submit(e);return yield this.waitUntilReady(t.id,s)}))}submit(e){return t(this,void 0,void 0,(function*(){let t,s;if("audio"in e){const{audio:i}=e,n=function(e,t){var s={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(s[i[n]]=e[i[n]])}return s}(e,["audio"]);if("string"==typeof i){const e=w(i);t=null!==e?yield this.files.upload(e):i.startsWith("data:")?yield this.files.upload(i):i}else t=yield this.files.upload(i);s=Object.assign(Object.assign({},n),{audio_url:t})}else s=e;return yield this.fetchJson("/v2/transcript",{method:"POST",body:JSON.stringify(s)})}))}create(e,s){return t(this,void 0,void 0,(function*(){var t;const i=w(e.audio_url);if(null!==i){const t=yield this.files.upload(i);e.audio_url=t}const n=yield this.fetchJson("/v2/transcript",{method:"POST",body:JSON.stringify(e)});return null===(t=null==s?void 0:s.poll)||void 0===t||t?yield this.waitUntilReady(n.id,s):n}))}waitUntilReady(e,s){return t(this,void 0,void 0,(function*(){var t,i;const n=null!==(t=null==s?void 0:s.pollingInterval)&&void 0!==t?t:3e3,r=null!==(i=null==s?void 0:s.pollingTimeout)&&void 0!==i?i:-1,o=Date.now();for(;;){const t=yield this.get(e);if("completed"===t.status||"error"===t.status)return t;if(r>0&&Date.now()-o>r)throw new Error("Polling timeout");yield new Promise((e=>setTimeout(e,n)))}}))}get(e){return this.fetchJson(`/v2/transcript/${e}`)}list(e){return t(this,void 0,void 0,(function*(){let t="/v2/transcript";"string"==typeof e?t=e:e&&(t=`${t}?${new URLSearchParams(Object.keys(e).map((t=>{var s;return[t,(null===(s=e[t])||void 0===s?void 0:s.toString())||""]})))}`);const s=yield this.fetchJson(t);for(const e of s.transcripts)e.created=new Date(e.created),e.completed&&(e.completed=new Date(e.completed));return s}))}delete(e){return this.fetchJson(`/v2/transcript/${e}`,{method:"DELETE"})}wordSearch(e,t){const s=new URLSearchParams({words:t.join(",")});return this.fetchJson(`/v2/transcript/${e}/word-search?${s.toString()}`)}sentences(e){return this.fetchJson(`/v2/transcript/${e}/sentences`)}paragraphs(e){return this.fetchJson(`/v2/transcript/${e}/paragraphs`)}subtitles(e){return t(this,arguments,void 0,(function*(e,t="srt",s){let i=`/v2/transcript/${e}/${t}`;if(s){const e=new URLSearchParams;e.set("chars_per_caption",s.toString()),i+=`?${e.toString()}`}const n=yield this.fetch(i);return yield n.text()}))}redactions(e){return this.redactedAudio(e)}redactedAudio(e){return this.fetchJson(`/v2/transcript/${e}/redacted-audio`)}redactedAudioFile(e){return t(this,void 0,void 0,(function*(){const{redacted_audio_url:t,status:s}=yield this.redactedAudio(e);if("redacted_audio_ready"!==s)throw new Error(`Redacted audio status is ${s}`);const i=yield fetch(t);if(!i.ok)throw new Error(`Failed to fetch redacted audio: ${i.statusText}`);return{arrayBuffer:i.arrayBuffer.bind(i),blob:i.blob.bind(i),body:i.body,bodyUsed:i.bodyUsed}}))}}class S extends r{upload(e){return t(this,void 0,void 0,(function*(){let s;s="string"==typeof e?e.startsWith("data:")?function(e){const t=e.split(","),s=t[0].match(/:(.*?);/)[1],i=atob(t[1]);let n=i.length;const r=new Uint8Array(n);for(;n--;)r[n]=i.charCodeAt(n);return new Blob([r],{type:s})}(e):yield function(e){return t(this,void 0,void 0,(function*(){throw new Error("Interacting with the file system is not supported in this environment.")}))}():e;return(yield this.fetchJson("/v2/upload",{method:"POST",body:s,headers:{"Content-Type":"application/octet-stream"},duplex:"half"})).upload_url}))}}const k='{"type":"Terminate"}';class T{constructor(e){if(this.listeners={},this.params=Object.assign(Object.assign({},e),{websocketBaseUrl:e.websocketBaseUrl||"wss://streaming.assemblyai.com/v3/ws"}),"token"in e&&e.token&&(this.token=e.token),"apiKey"in e&&e.apiKey&&(this.apiKey=e.apiKey),!this.token&&!this.apiKey)throw new Error("API key or temporary token is required.")}connectionUrl(){var e;const t=new URL(null!==(e=this.params.websocketBaseUrl)&&void 0!==e?e:"");if("wss:"!==t.protocol)throw new Error("Invalid protocol, must be wss");const s=new URLSearchParams;return s.set("sample_rate",this.params.sampleRate.toString()),this.params.wordFinalizationMaxWaitTime&&s.set("word_finalization_max_wait_time",this.params.wordFinalizationMaxWaitTime.toString()),this.params.endOfTurnConfidenceThreshold&&s.set("end_of_turn_confidence_threshold",this.params.endOfTurnConfidenceThreshold.toString()),this.params.minEndOfTurnSilenceWhenConfident&&s.set("min_end_of_turn_silence_when_confident",this.params.minEndOfTurnSilenceWhenConfident.toString()),this.params.maxTurnSilence&&s.set("max_turn_silence",this.params.maxTurnSilence.toString()),this.params.formattedFinals&&s.set("formatted_finals",this.params.formattedFinals.toString()),t.search=s.toString(),t}on(e,t){this.listeners[e]=t}connect(){return new Promise((e=>{if(this.socket)throw new Error("Already connected");const t=this.connectionUrl();this.socket=h(t.toString(),{headers:{Authorization:this.token||this.apiKey}}),this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{},this.socket.onclose=({code:e,reason:t})=>{var s,i;t||e in m&&(t=m[e]),null===(i=(s=this.listeners).close)||void 0===i||i.call(s,e,t)},this.socket.onerror=e=>{var t,s,i,n;e.error?null===(s=(t=this.listeners).error)||void 0===s||s.call(t,e.error):null===(n=(i=this.listeners).error)||void 0===n||n.call(i,new Error(e.message))},this.socket.onmessage=({data:t})=>{var s,i,n,r,o,a,c;const l=JSON.parse(t.toString());if("error"in l)null===(i=(s=this.listeners).error)||void 0===i||i.call(s,new f(l.error));else switch(l.type){case"Begin":e(l),null===(r=(n=this.listeners).open)||void 0===r||r.call(n,l);break;case"Turn":null===(a=(o=this.listeners).turn)||void 0===a||a.call(o,l);break;case"Termination":null===(c=this.sessionTerminatedResolve)||void 0===c||c.call(this)}}}))}stream(){return new a({write:e=>{this.sendAudio(e)}})}sendAudio(e){this.send(e)}send(e){if(!this.socket||this.socket.readyState!==this.socket.OPEN)throw new Error("Socket is not open for communication");this.socket.send(e)}close(){return t(this,arguments,void 0,(function*(e=!0){var t;if(this.socket){if(this.socket.readyState===this.socket.OPEN)if(e){const e=new Promise((e=>{this.sessionTerminatedResolve=e}));this.socket.send(k),yield e}else this.socket.send(k);(null===(t=this.socket)||void 0===t?void 0:t.removeAllListeners)&&this.socket.removeAllListeners(),this.socket.close()}this.listeners={},this.socket=void 0}))}}class O extends r{constructor(e){super(e)}transcriber(e){return new T(e)}createTemporaryToken(e){return t(this,void 0,void 0,(function*(){const t=new URLSearchParams;Object.entries(e).forEach((([e,s])=>{null!=s&&t.append(e,String(s))}));const s=t.toString(),i=s?`/v3/token?${s}`:"/v3/token";return(yield this.fetchJson(i,{method:"GET"})).token}))}}e.AssemblyAI=class{constructor(e){e.baseUrl=e.baseUrl||"https://api.assemblyai.com",e.baseUrl&&e.baseUrl.endsWith("/")&&(e.baseUrl=e.baseUrl.slice(0,-1)),this.files=new S(e),this.transcripts=new g(e,this.files),this.lemur=new o(e),this.realtime=new b(e),this.streaming=new O(Object.assign(Object.assign({},e),{baseUrl:e.streamingBaseUrl||"https://streaming.assemblyai.com"}))}},e.FileService=S,e.LemurService=o,e.RealtimeService=class extends y{},e.RealtimeServiceFactory=class extends b{},e.RealtimeTranscriber=y,e.RealtimeTranscriberFactory=b,e.StreamingTranscriber=T,e.TranscriptService=g}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).assemblyai={})}(this,(function(e){"use strict";function t(e,t,s,i){return new(s||(s=Promise))((function(n,r){function o(e){try{c(i.next(e))}catch(e){r(e)}}function a(e){try{c(i.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const s={cache:"no-store"};let i="";"undefined"!=typeof navigator&&navigator.userAgent&&(i+=navigator.userAgent);const n={sdk:{name:"JavaScript",version:"4.13.1"}};"undefined"!=typeof process&&(process.versions.node&&-1===i.indexOf("Node")&&(n.runtime_env={name:"Node",version:process.versions.node}),process.versions.bun&&-1===i.indexOf("Bun")&&(n.runtime_env={name:"Bun",version:process.versions.bun})),"undefined"!=typeof Deno&&process.versions.bun&&-1===i.indexOf("Deno")&&(n.runtime_env={name:"Deno",version:Deno.version.deno});class r{constructor(e){var t;this.params=e,!1===e.userAgent?this.userAgent=void 0:this.userAgent=(t=e.userAgent||{},i+(!1===t?"":" AssemblyAI/1.0 ("+Object.entries(Object.assign(Object.assign({},n),t)).map((([e,t])=>t?`${e}=${t.name}/${t.version}`:"")).join(" ")+")"))}fetch(e,i){return t(this,void 0,void 0,(function*(){i=Object.assign(Object.assign({},s),i);let t={Authorization:this.params.apiKey,"Content-Type":"application/json"};(null==s?void 0:s.headers)&&(t=Object.assign(Object.assign({},t),s.headers)),(null==i?void 0:i.headers)&&(t=Object.assign(Object.assign({},t),i.headers)),this.userAgent&&(t["User-Agent"]=this.userAgent,"undefined"!=typeof window&&"chrome"in window&&(t["AssemblyAI-Agent"]=this.userAgent)),i.headers=t,e.startsWith("http")||(e=this.params.baseUrl+e);const n=yield fetch(e,i);if(n.status>=400){let e;const t=yield n.text();if(t){try{e=JSON.parse(t)}catch(e){}if(null==e?void 0:e.error)throw new Error(e.error);throw new Error(t)}throw new Error(`HTTP Error: ${n.status} ${n.statusText}`)}return n}))}fetchJson(e,s){return t(this,void 0,void 0,(function*(){return(yield this.fetch(e,s)).json()}))}}class o extends r{summary(e){return this.fetchJson("/lemur/v3/generate/summary",{method:"POST",body:JSON.stringify(e)})}questionAnswer(e){return this.fetchJson("/lemur/v3/generate/question-answer",{method:"POST",body:JSON.stringify(e)})}actionItems(e){return this.fetchJson("/lemur/v3/generate/action-items",{method:"POST",body:JSON.stringify(e)})}task(e){return this.fetchJson("/lemur/v3/generate/task",{method:"POST",body:JSON.stringify(e)})}getResponse(e){return this.fetchJson(`/lemur/v3/${e}`)}purgeRequestData(e){return this.fetchJson(`/lemur/v3/${e}`,{method:"DELETE"})}}const{WritableStream:a}="undefined"!=typeof window?window:"undefined"!=typeof global?global:globalThis;var c,l;const d=null!==(l=null!==(c=null!==WebSocket&&void 0!==WebSocket?WebSocket:null===global||void 0===global?void 0:global.WebSocket)&&void 0!==c?c:null===window||void 0===window?void 0:window.WebSocket)&&void 0!==l?l:null===self||void 0===self?void 0:self.WebSocket,h=(e,t)=>t?new d(e,t):new d(e),u={[4e3]:"Sample rate must be a positive integer",[4001]:"Not Authorized",[4002]:"Insufficient funds",[4003]:"This feature is paid-only and requires you to add a credit card. Please visit https://app.assemblyai.com/ to add a credit card to your account.",[4004]:"Session ID does not exist",[4008]:"Session has expired",[4010]:"Session is closed",[4029]:"Rate limited",[4030]:"Unique session violation",[4031]:"Session Timeout",[4032]:"Audio too short",[4033]:"Audio too long",[4034]:"Audio too small to transcode",[4100]:"Bad JSON",[4101]:"Bad schema",[4102]:"Too many streams",[4103]:"This session has been reconnected. This WebSocket is no longer valid.",[1013]:"Reconnect attempts exhausted",[4104]:"Could not parse word boost parameter"};class p extends Error{}const m={[4e3]:"Sample rate must be a positive integer",[4001]:"Not Authorized",[4002]:"Insufficient funds",[4003]:"This feature is paid-only and requires you to add a credit card. Please visit https://app.assemblyai.com/ to add a credit card to your account.",[4004]:"Session ID does not exist",[4008]:"Session has expired",[4010]:"Session is closed",[4029]:"Rate limited",[4030]:"Unique session violation",[4031]:"Session Timeout",[4032]:"Audio too short",[4033]:"Audio too long",[4034]:"Audio too small to transcode",[4101]:"Bad schema",[4102]:"Too many streams",[4103]:"This session has been reconnected. This WebSocket is no longer valid."};class f extends Error{}const v='{"terminate_session":true}';class y{constructor(e){var t,s;if(this.listeners={},this.realtimeUrl=null!==(t=e.realtimeUrl)&&void 0!==t?t:"wss://api.assemblyai.com/v2/realtime/ws",this.sampleRate=null!==(s=e.sampleRate)&&void 0!==s?s:16e3,this.wordBoost=e.wordBoost,this.encoding=e.encoding,this.endUtteranceSilenceThreshold=e.endUtteranceSilenceThreshold,this.disablePartialTranscripts=e.disablePartialTranscripts,"token"in e&&e.token&&(this.token=e.token),"apiKey"in e&&e.apiKey&&(this.apiKey=e.apiKey),!this.token&&!this.apiKey)throw new Error("API key or temporary token is required.")}connectionUrl(){const e=new URL(this.realtimeUrl);if("wss:"!==e.protocol)throw new Error("Invalid protocol, must be wss");const t=new URLSearchParams;return this.token&&t.set("token",this.token),t.set("sample_rate",this.sampleRate.toString()),this.wordBoost&&this.wordBoost.length>0&&t.set("word_boost",JSON.stringify(this.wordBoost)),this.encoding&&t.set("encoding",this.encoding),t.set("enable_extra_session_information","true"),this.disablePartialTranscripts&&t.set("disable_partial_transcripts",this.disablePartialTranscripts.toString()),e.search=t.toString(),e}on(e,t){this.listeners[e]=t}connect(){return new Promise((e=>{if(this.socket)throw new Error("Already connected");const t=this.connectionUrl();this.token?this.socket=h(t.toString()):(console.warn("API key authentication is not supported for the RealtimeTranscriber in browser environment. Use temporary token authentication instead.\nLearn more at https://github.com/AssemblyAI/assemblyai-node-sdk/blob/main/docs/compat.md#browser-compatibility."),this.socket=h(t.toString(),{headers:{Authorization:this.apiKey}})),this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{void 0!==this.endUtteranceSilenceThreshold&&null!==this.endUtteranceSilenceThreshold&&this.configureEndUtteranceSilenceThreshold(this.endUtteranceSilenceThreshold)},this.socket.onclose=({code:e,reason:t})=>{var s,i;t||e in u&&(t=u[e]),null===(i=(s=this.listeners).close)||void 0===i||i.call(s,e,t)},this.socket.onerror=e=>{var t,s,i,n;e.error?null===(s=(t=this.listeners).error)||void 0===s||s.call(t,e.error):null===(n=(i=this.listeners).error)||void 0===n||n.call(i,new Error(e.message))},this.socket.onmessage=({data:t})=>{var s,i,n,r,o,a,c,l,d,h,u,m,f,v,y;const b=JSON.parse(t.toString());if("error"in b)null===(i=(s=this.listeners).error)||void 0===i||i.call(s,new p(b.error));else switch(b.message_type){case"SessionBegins":{const t={sessionId:b.session_id,expiresAt:new Date(b.expires_at)};e(t),null===(r=(n=this.listeners).open)||void 0===r||r.call(n,t);break}case"PartialTranscript":b.created=new Date(b.created),null===(a=(o=this.listeners).transcript)||void 0===a||a.call(o,b),null===(l=(c=this.listeners)["transcript.partial"])||void 0===l||l.call(c,b);break;case"FinalTranscript":b.created=new Date(b.created),null===(h=(d=this.listeners).transcript)||void 0===h||h.call(d,b),null===(m=(u=this.listeners)["transcript.final"])||void 0===m||m.call(u,b);break;case"SessionInformation":null===(v=(f=this.listeners).session_information)||void 0===v||v.call(f,b);break;case"SessionTerminated":null===(y=this.sessionTerminatedResolve)||void 0===y||y.call(this)}}}))}sendAudio(e){this.send(e)}stream(){return new a({write:e=>{this.sendAudio(e)}})}forceEndUtterance(){this.send('{"force_end_utterance":true}')}configureEndUtteranceSilenceThreshold(e){this.send(`{"end_utterance_silence_threshold":${e}}`)}send(e){if(!this.socket||this.socket.readyState!==this.socket.OPEN)throw new Error("Socket is not open for communication");this.socket.send(e)}close(){return t(this,arguments,void 0,(function*(e=!0){var t;if(this.socket){if(this.socket.readyState===this.socket.OPEN)if(e){const e=new Promise((e=>{this.sessionTerminatedResolve=e}));this.socket.send(v),yield e}else this.socket.send(v);(null===(t=this.socket)||void 0===t?void 0:t.removeAllListeners)&&this.socket.removeAllListeners(),this.socket.close()}this.listeners={},this.socket=void 0}))}}class b extends r{constructor(e){super(e),this.rtFactoryParams=e}createService(e){return this.transcriber(e)}transcriber(e){const t=Object.assign({},e);return t.token||t.apiKey||(t.apiKey=this.rtFactoryParams.apiKey),new y(t)}createTemporaryToken(e){return t(this,void 0,void 0,(function*(){return(yield this.fetchJson("/v2/realtime/token",{method:"POST",body:JSON.stringify(e)})).token}))}}function w(e){return e.startsWith("http")||e.startsWith("https")||e.startsWith("data:")?null:e.startsWith("file://")?e.substring(7):e.startsWith("file:")?e.substring(5):e}class g extends r{constructor(e,t){super(e),this.files=t}transcribe(e,s){return t(this,void 0,void 0,(function*(){const t=yield this.submit(e);return yield this.waitUntilReady(t.id,s)}))}submit(e){return t(this,void 0,void 0,(function*(){let t,s;if("audio"in e){const{audio:i}=e,n=function(e,t){var s={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(s[i[n]]=e[i[n]])}return s}(e,["audio"]);if("string"==typeof i){const e=w(i);t=null!==e?yield this.files.upload(e):i.startsWith("data:")?yield this.files.upload(i):i}else t=yield this.files.upload(i);s=Object.assign(Object.assign({},n),{audio_url:t})}else s=e;return yield this.fetchJson("/v2/transcript",{method:"POST",body:JSON.stringify(s)})}))}create(e,s){return t(this,void 0,void 0,(function*(){var t;const i=w(e.audio_url);if(null!==i){const t=yield this.files.upload(i);e.audio_url=t}const n=yield this.fetchJson("/v2/transcript",{method:"POST",body:JSON.stringify(e)});return null===(t=null==s?void 0:s.poll)||void 0===t||t?yield this.waitUntilReady(n.id,s):n}))}waitUntilReady(e,s){return t(this,void 0,void 0,(function*(){var t,i;const n=null!==(t=null==s?void 0:s.pollingInterval)&&void 0!==t?t:3e3,r=null!==(i=null==s?void 0:s.pollingTimeout)&&void 0!==i?i:-1,o=Date.now();for(;;){const t=yield this.get(e);if("completed"===t.status||"error"===t.status)return t;if(r>0&&Date.now()-o>r)throw new Error("Polling timeout");yield new Promise((e=>setTimeout(e,n)))}}))}get(e){return this.fetchJson(`/v2/transcript/${e}`)}list(e){return t(this,void 0,void 0,(function*(){let t="/v2/transcript";"string"==typeof e?t=e:e&&(t=`${t}?${new URLSearchParams(Object.keys(e).map((t=>{var s;return[t,(null===(s=e[t])||void 0===s?void 0:s.toString())||""]})))}`);const s=yield this.fetchJson(t);for(const e of s.transcripts)e.created=new Date(e.created),e.completed&&(e.completed=new Date(e.completed));return s}))}delete(e){return this.fetchJson(`/v2/transcript/${e}`,{method:"DELETE"})}wordSearch(e,t){const s=new URLSearchParams({words:t.join(",")});return this.fetchJson(`/v2/transcript/${e}/word-search?${s.toString()}`)}sentences(e){return this.fetchJson(`/v2/transcript/${e}/sentences`)}paragraphs(e){return this.fetchJson(`/v2/transcript/${e}/paragraphs`)}subtitles(e){return t(this,arguments,void 0,(function*(e,t="srt",s){let i=`/v2/transcript/${e}/${t}`;if(s){const e=new URLSearchParams;e.set("chars_per_caption",s.toString()),i+=`?${e.toString()}`}const n=yield this.fetch(i);return yield n.text()}))}redactions(e){return this.redactedAudio(e)}redactedAudio(e){return this.fetchJson(`/v2/transcript/${e}/redacted-audio`)}redactedAudioFile(e){return t(this,void 0,void 0,(function*(){const{redacted_audio_url:t,status:s}=yield this.redactedAudio(e);if("redacted_audio_ready"!==s)throw new Error(`Redacted audio status is ${s}`);const i=yield fetch(t);if(!i.ok)throw new Error(`Failed to fetch redacted audio: ${i.statusText}`);return{arrayBuffer:i.arrayBuffer.bind(i),blob:i.blob.bind(i),body:i.body,bodyUsed:i.bodyUsed}}))}}class S extends r{upload(e){return t(this,void 0,void 0,(function*(){let s;s="string"==typeof e?e.startsWith("data:")?function(e){const t=e.split(","),s=t[0].match(/:(.*?);/)[1],i=atob(t[1]);let n=i.length;const r=new Uint8Array(n);for(;n--;)r[n]=i.charCodeAt(n);return new Blob([r],{type:s})}(e):yield function(e){return t(this,void 0,void 0,(function*(){throw new Error("Interacting with the file system is not supported in this environment.")}))}():e;return(yield this.fetchJson("/v2/upload",{method:"POST",body:s,headers:{"Content-Type":"application/octet-stream"},duplex:"half"})).upload_url}))}}const k='{"type":"Terminate"}';class T{constructor(e){if(this.listeners={},this.params=Object.assign(Object.assign({},e),{websocketBaseUrl:e.websocketBaseUrl||"wss://streaming.assemblyai.com/v3/ws"}),"token"in e&&e.token&&(this.token=e.token),"apiKey"in e&&e.apiKey&&(this.apiKey=e.apiKey),!this.token&&!this.apiKey)throw new Error("API key or temporary token is required.")}connectionUrl(){var e;const t=new URL(null!==(e=this.params.websocketBaseUrl)&&void 0!==e?e:"");if("wss:"!==t.protocol)throw new Error("Invalid protocol, must be wss");const s=new URLSearchParams;return s.set("sample_rate",this.params.sampleRate.toString()),this.params.endOfTurnConfidenceThreshold&&s.set("end_of_turn_confidence_threshold",this.params.endOfTurnConfidenceThreshold.toString()),this.params.minEndOfTurnSilenceWhenConfident&&s.set("min_end_of_turn_silence_when_confident",this.params.minEndOfTurnSilenceWhenConfident.toString()),this.params.maxTurnSilence&&s.set("max_turn_silence",this.params.maxTurnSilence.toString()),this.params.formatTurns&&s.set("format_turns",this.params.formatTurns.toString()),t.search=s.toString(),t}on(e,t){this.listeners[e]=t}connect(){return new Promise((e=>{if(this.socket)throw new Error("Already connected");const t=this.connectionUrl();this.socket=h(t.toString(),{headers:{Authorization:this.token||this.apiKey}}),this.socket.binaryType="arraybuffer",this.socket.onopen=()=>{},this.socket.onclose=({code:e,reason:t})=>{var s,i;t||e in m&&(t=m[e]),null===(i=(s=this.listeners).close)||void 0===i||i.call(s,e,t)},this.socket.onerror=e=>{var t,s,i,n;e.error?null===(s=(t=this.listeners).error)||void 0===s||s.call(t,e.error):null===(n=(i=this.listeners).error)||void 0===n||n.call(i,new Error(e.message))},this.socket.onmessage=({data:t})=>{var s,i,n,r,o,a,c;const l=JSON.parse(t.toString());if("error"in l)null===(i=(s=this.listeners).error)||void 0===i||i.call(s,new f(l.error));else switch(l.type){case"Begin":e(l),null===(r=(n=this.listeners).open)||void 0===r||r.call(n,l);break;case"Turn":null===(a=(o=this.listeners).turn)||void 0===a||a.call(o,l);break;case"Termination":null===(c=this.sessionTerminatedResolve)||void 0===c||c.call(this)}}}))}stream(){return new a({write:e=>{this.sendAudio(e)}})}sendAudio(e){this.send(e)}send(e){if(!this.socket||this.socket.readyState!==this.socket.OPEN)throw new Error("Socket is not open for communication");this.socket.send(e)}close(){return t(this,arguments,void 0,(function*(e=!0){var t;if(this.socket){if(this.socket.readyState===this.socket.OPEN)if(e){const e=new Promise((e=>{this.sessionTerminatedResolve=e}));this.socket.send(k),yield e}else this.socket.send(k);(null===(t=this.socket)||void 0===t?void 0:t.removeAllListeners)&&this.socket.removeAllListeners(),this.socket.close()}this.listeners={},this.socket=void 0}))}}class O extends r{constructor(e){super(e),this.baseServiceParams=e}transcriber(e){const t=Object.assign({},e);return t.token||t.apiKey||(t.apiKey=this.baseServiceParams.apiKey),new T(t)}createTemporaryToken(e){return t(this,void 0,void 0,(function*(){const t=new URLSearchParams;Object.entries(e).forEach((([e,s])=>{null!=s&&t.append(e,String(s))}));const s=t.toString(),i=s?`/v3/token?${s}`:"/v3/token";return(yield this.fetchJson(i,{method:"GET"})).token}))}}e.AssemblyAI=class{constructor(e){e.baseUrl=e.baseUrl||"https://api.assemblyai.com",e.baseUrl&&e.baseUrl.endsWith("/")&&(e.baseUrl=e.baseUrl.slice(0,-1)),this.files=new S(e),this.transcripts=new g(e,this.files),this.lemur=new o(e),this.realtime=new b(e),this.streaming=new O(Object.assign(Object.assign({},e),{baseUrl:e.streamingBaseUrl||"https://streaming.assemblyai.com"}))}},e.FileService=S,e.LemurService=o,e.RealtimeService=class extends y{},e.RealtimeServiceFactory=class extends b{},e.RealtimeTranscriber=y,e.RealtimeTranscriberFactory=b,e.StreamingTranscriber=T,e.TranscriptService=g}));
|
package/dist/browser.mjs
CHANGED
|
@@ -15,7 +15,7 @@ if (typeof navigator !== "undefined" && navigator.userAgent) {
|
|
|
15
15
|
defaultUserAgentString += navigator.userAgent;
|
|
16
16
|
}
|
|
17
17
|
const defaultUserAgent = {
|
|
18
|
-
sdk: { name: "JavaScript", version: "4.13.
|
|
18
|
+
sdk: { name: "JavaScript", version: "4.13.1" },
|
|
19
19
|
};
|
|
20
20
|
if (typeof process !== "undefined") {
|
|
21
21
|
if (process.versions.node && defaultUserAgentString.indexOf("Node") === -1) {
|
|
@@ -809,9 +809,6 @@ class StreamingTranscriber {
|
|
|
809
809
|
}
|
|
810
810
|
const searchParams = new URLSearchParams();
|
|
811
811
|
searchParams.set("sample_rate", this.params.sampleRate.toString());
|
|
812
|
-
if (this.params.wordFinalizationMaxWaitTime) {
|
|
813
|
-
searchParams.set("word_finalization_max_wait_time", this.params.wordFinalizationMaxWaitTime.toString());
|
|
814
|
-
}
|
|
815
812
|
if (this.params.endOfTurnConfidenceThreshold) {
|
|
816
813
|
searchParams.set("end_of_turn_confidence_threshold", this.params.endOfTurnConfidenceThreshold.toString());
|
|
817
814
|
}
|
|
@@ -821,8 +818,8 @@ class StreamingTranscriber {
|
|
|
821
818
|
if (this.params.maxTurnSilence) {
|
|
822
819
|
searchParams.set("max_turn_silence", this.params.maxTurnSilence.toString());
|
|
823
820
|
}
|
|
824
|
-
if (this.params.
|
|
825
|
-
searchParams.set("
|
|
821
|
+
if (this.params.formatTurns) {
|
|
822
|
+
searchParams.set("format_turns", this.params.formatTurns.toString());
|
|
826
823
|
}
|
|
827
824
|
url.search = searchParams.toString();
|
|
828
825
|
return url;
|
|
@@ -922,9 +919,14 @@ class StreamingTranscriber {
|
|
|
922
919
|
class StreamingTranscriberFactory extends BaseService {
|
|
923
920
|
constructor(params) {
|
|
924
921
|
super(params);
|
|
922
|
+
this.baseServiceParams = params;
|
|
925
923
|
}
|
|
926
924
|
transcriber(params) {
|
|
927
|
-
|
|
925
|
+
const serviceParams = { ...params };
|
|
926
|
+
if (!serviceParams.token && !serviceParams.apiKey) {
|
|
927
|
+
serviceParams.apiKey = this.baseServiceParams.apiKey;
|
|
928
|
+
}
|
|
929
|
+
return new StreamingTranscriber(serviceParams);
|
|
928
930
|
}
|
|
929
931
|
async createTemporaryToken(params) {
|
|
930
932
|
const searchParams = new URLSearchParams();
|
package/dist/bun.mjs
CHANGED
|
@@ -17,7 +17,7 @@ if (typeof navigator !== "undefined" && navigator.userAgent) {
|
|
|
17
17
|
defaultUserAgentString += navigator.userAgent;
|
|
18
18
|
}
|
|
19
19
|
const defaultUserAgent = {
|
|
20
|
-
sdk: { name: "JavaScript", version: "4.13.
|
|
20
|
+
sdk: { name: "JavaScript", version: "4.13.1" },
|
|
21
21
|
};
|
|
22
22
|
if (typeof process !== "undefined") {
|
|
23
23
|
if (process.versions.node && defaultUserAgentString.indexOf("Node") === -1) {
|
|
@@ -790,9 +790,6 @@ class StreamingTranscriber {
|
|
|
790
790
|
}
|
|
791
791
|
const searchParams = new URLSearchParams();
|
|
792
792
|
searchParams.set("sample_rate", this.params.sampleRate.toString());
|
|
793
|
-
if (this.params.wordFinalizationMaxWaitTime) {
|
|
794
|
-
searchParams.set("word_finalization_max_wait_time", this.params.wordFinalizationMaxWaitTime.toString());
|
|
795
|
-
}
|
|
796
793
|
if (this.params.endOfTurnConfidenceThreshold) {
|
|
797
794
|
searchParams.set("end_of_turn_confidence_threshold", this.params.endOfTurnConfidenceThreshold.toString());
|
|
798
795
|
}
|
|
@@ -802,8 +799,8 @@ class StreamingTranscriber {
|
|
|
802
799
|
if (this.params.maxTurnSilence) {
|
|
803
800
|
searchParams.set("max_turn_silence", this.params.maxTurnSilence.toString());
|
|
804
801
|
}
|
|
805
|
-
if (this.params.
|
|
806
|
-
searchParams.set("
|
|
802
|
+
if (this.params.formatTurns) {
|
|
803
|
+
searchParams.set("format_turns", this.params.formatTurns.toString());
|
|
807
804
|
}
|
|
808
805
|
url.search = searchParams.toString();
|
|
809
806
|
return url;
|
|
@@ -903,9 +900,14 @@ class StreamingTranscriber {
|
|
|
903
900
|
class StreamingTranscriberFactory extends BaseService {
|
|
904
901
|
constructor(params) {
|
|
905
902
|
super(params);
|
|
903
|
+
this.baseServiceParams = params;
|
|
906
904
|
}
|
|
907
905
|
transcriber(params) {
|
|
908
|
-
|
|
906
|
+
const serviceParams = { ...params };
|
|
907
|
+
if (!serviceParams.token && !serviceParams.apiKey) {
|
|
908
|
+
serviceParams.apiKey = this.baseServiceParams.apiKey;
|
|
909
|
+
}
|
|
910
|
+
return new StreamingTranscriber(serviceParams);
|
|
909
911
|
}
|
|
910
912
|
async createTemporaryToken(params) {
|
|
911
913
|
const searchParams = new URLSearchParams();
|
package/dist/deno.mjs
CHANGED
|
@@ -17,7 +17,7 @@ if (typeof navigator !== "undefined" && navigator.userAgent) {
|
|
|
17
17
|
defaultUserAgentString += navigator.userAgent;
|
|
18
18
|
}
|
|
19
19
|
const defaultUserAgent = {
|
|
20
|
-
sdk: { name: "JavaScript", version: "4.13.
|
|
20
|
+
sdk: { name: "JavaScript", version: "4.13.1" },
|
|
21
21
|
};
|
|
22
22
|
if (typeof process !== "undefined") {
|
|
23
23
|
if (process.versions.node && defaultUserAgentString.indexOf("Node") === -1) {
|
|
@@ -790,9 +790,6 @@ class StreamingTranscriber {
|
|
|
790
790
|
}
|
|
791
791
|
const searchParams = new URLSearchParams();
|
|
792
792
|
searchParams.set("sample_rate", this.params.sampleRate.toString());
|
|
793
|
-
if (this.params.wordFinalizationMaxWaitTime) {
|
|
794
|
-
searchParams.set("word_finalization_max_wait_time", this.params.wordFinalizationMaxWaitTime.toString());
|
|
795
|
-
}
|
|
796
793
|
if (this.params.endOfTurnConfidenceThreshold) {
|
|
797
794
|
searchParams.set("end_of_turn_confidence_threshold", this.params.endOfTurnConfidenceThreshold.toString());
|
|
798
795
|
}
|
|
@@ -802,8 +799,8 @@ class StreamingTranscriber {
|
|
|
802
799
|
if (this.params.maxTurnSilence) {
|
|
803
800
|
searchParams.set("max_turn_silence", this.params.maxTurnSilence.toString());
|
|
804
801
|
}
|
|
805
|
-
if (this.params.
|
|
806
|
-
searchParams.set("
|
|
802
|
+
if (this.params.formatTurns) {
|
|
803
|
+
searchParams.set("format_turns", this.params.formatTurns.toString());
|
|
807
804
|
}
|
|
808
805
|
url.search = searchParams.toString();
|
|
809
806
|
return url;
|
|
@@ -903,9 +900,14 @@ class StreamingTranscriber {
|
|
|
903
900
|
class StreamingTranscriberFactory extends BaseService {
|
|
904
901
|
constructor(params) {
|
|
905
902
|
super(params);
|
|
903
|
+
this.baseServiceParams = params;
|
|
906
904
|
}
|
|
907
905
|
transcriber(params) {
|
|
908
|
-
|
|
906
|
+
const serviceParams = { ...params };
|
|
907
|
+
if (!serviceParams.token && !serviceParams.apiKey) {
|
|
908
|
+
serviceParams.apiKey = this.baseServiceParams.apiKey;
|
|
909
|
+
}
|
|
910
|
+
return new StreamingTranscriber(serviceParams);
|
|
909
911
|
}
|
|
910
912
|
async createTemporaryToken(params) {
|
|
911
913
|
const searchParams = new URLSearchParams();
|
package/dist/index.cjs
CHANGED
|
@@ -63,7 +63,7 @@ if (typeof navigator !== "undefined" && navigator.userAgent) {
|
|
|
63
63
|
defaultUserAgentString += navigator.userAgent;
|
|
64
64
|
}
|
|
65
65
|
const defaultUserAgent = {
|
|
66
|
-
sdk: { name: "JavaScript", version: "4.13.
|
|
66
|
+
sdk: { name: "JavaScript", version: "4.13.1" },
|
|
67
67
|
};
|
|
68
68
|
if (typeof process !== "undefined") {
|
|
69
69
|
if (process.versions.node && defaultUserAgentString.indexOf("Node") === -1) {
|
|
@@ -881,9 +881,6 @@ class StreamingTranscriber {
|
|
|
881
881
|
}
|
|
882
882
|
const searchParams = new URLSearchParams();
|
|
883
883
|
searchParams.set("sample_rate", this.params.sampleRate.toString());
|
|
884
|
-
if (this.params.wordFinalizationMaxWaitTime) {
|
|
885
|
-
searchParams.set("word_finalization_max_wait_time", this.params.wordFinalizationMaxWaitTime.toString());
|
|
886
|
-
}
|
|
887
884
|
if (this.params.endOfTurnConfidenceThreshold) {
|
|
888
885
|
searchParams.set("end_of_turn_confidence_threshold", this.params.endOfTurnConfidenceThreshold.toString());
|
|
889
886
|
}
|
|
@@ -893,8 +890,8 @@ class StreamingTranscriber {
|
|
|
893
890
|
if (this.params.maxTurnSilence) {
|
|
894
891
|
searchParams.set("max_turn_silence", this.params.maxTurnSilence.toString());
|
|
895
892
|
}
|
|
896
|
-
if (this.params.
|
|
897
|
-
searchParams.set("
|
|
893
|
+
if (this.params.formatTurns) {
|
|
894
|
+
searchParams.set("format_turns", this.params.formatTurns.toString());
|
|
898
895
|
}
|
|
899
896
|
url.search = searchParams.toString();
|
|
900
897
|
return url;
|
|
@@ -1000,9 +997,14 @@ class StreamingTranscriber {
|
|
|
1000
997
|
class StreamingTranscriberFactory extends BaseService {
|
|
1001
998
|
constructor(params) {
|
|
1002
999
|
super(params);
|
|
1000
|
+
this.baseServiceParams = params;
|
|
1003
1001
|
}
|
|
1004
1002
|
transcriber(params) {
|
|
1005
|
-
|
|
1003
|
+
const serviceParams = Object.assign({}, params);
|
|
1004
|
+
if (!serviceParams.token && !serviceParams.apiKey) {
|
|
1005
|
+
serviceParams.apiKey = this.baseServiceParams.apiKey;
|
|
1006
|
+
}
|
|
1007
|
+
return new StreamingTranscriber(serviceParams);
|
|
1006
1008
|
}
|
|
1007
1009
|
createTemporaryToken(params) {
|
|
1008
1010
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/index.mjs
CHANGED
|
@@ -61,7 +61,7 @@ if (typeof navigator !== "undefined" && navigator.userAgent) {
|
|
|
61
61
|
defaultUserAgentString += navigator.userAgent;
|
|
62
62
|
}
|
|
63
63
|
const defaultUserAgent = {
|
|
64
|
-
sdk: { name: "JavaScript", version: "4.13.
|
|
64
|
+
sdk: { name: "JavaScript", version: "4.13.1" },
|
|
65
65
|
};
|
|
66
66
|
if (typeof process !== "undefined") {
|
|
67
67
|
if (process.versions.node && defaultUserAgentString.indexOf("Node") === -1) {
|
|
@@ -879,9 +879,6 @@ class StreamingTranscriber {
|
|
|
879
879
|
}
|
|
880
880
|
const searchParams = new URLSearchParams();
|
|
881
881
|
searchParams.set("sample_rate", this.params.sampleRate.toString());
|
|
882
|
-
if (this.params.wordFinalizationMaxWaitTime) {
|
|
883
|
-
searchParams.set("word_finalization_max_wait_time", this.params.wordFinalizationMaxWaitTime.toString());
|
|
884
|
-
}
|
|
885
882
|
if (this.params.endOfTurnConfidenceThreshold) {
|
|
886
883
|
searchParams.set("end_of_turn_confidence_threshold", this.params.endOfTurnConfidenceThreshold.toString());
|
|
887
884
|
}
|
|
@@ -891,8 +888,8 @@ class StreamingTranscriber {
|
|
|
891
888
|
if (this.params.maxTurnSilence) {
|
|
892
889
|
searchParams.set("max_turn_silence", this.params.maxTurnSilence.toString());
|
|
893
890
|
}
|
|
894
|
-
if (this.params.
|
|
895
|
-
searchParams.set("
|
|
891
|
+
if (this.params.formatTurns) {
|
|
892
|
+
searchParams.set("format_turns", this.params.formatTurns.toString());
|
|
896
893
|
}
|
|
897
894
|
url.search = searchParams.toString();
|
|
898
895
|
return url;
|
|
@@ -998,9 +995,14 @@ class StreamingTranscriber {
|
|
|
998
995
|
class StreamingTranscriberFactory extends BaseService {
|
|
999
996
|
constructor(params) {
|
|
1000
997
|
super(params);
|
|
998
|
+
this.baseServiceParams = params;
|
|
1001
999
|
}
|
|
1002
1000
|
transcriber(params) {
|
|
1003
|
-
|
|
1001
|
+
const serviceParams = Object.assign({}, params);
|
|
1002
|
+
if (!serviceParams.token && !serviceParams.apiKey) {
|
|
1003
|
+
serviceParams.apiKey = this.baseServiceParams.apiKey;
|
|
1004
|
+
}
|
|
1005
|
+
return new StreamingTranscriber(serviceParams);
|
|
1004
1006
|
}
|
|
1005
1007
|
createTemporaryToken(params) {
|
|
1006
1008
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/node.cjs
CHANGED
|
@@ -22,7 +22,7 @@ if (typeof navigator !== "undefined" && navigator.userAgent) {
|
|
|
22
22
|
defaultUserAgentString += navigator.userAgent;
|
|
23
23
|
}
|
|
24
24
|
const defaultUserAgent = {
|
|
25
|
-
sdk: { name: "JavaScript", version: "4.13.
|
|
25
|
+
sdk: { name: "JavaScript", version: "4.13.1" },
|
|
26
26
|
};
|
|
27
27
|
if (typeof process !== "undefined") {
|
|
28
28
|
if (process.versions.node && defaultUserAgentString.indexOf("Node") === -1) {
|
|
@@ -789,9 +789,6 @@ class StreamingTranscriber {
|
|
|
789
789
|
}
|
|
790
790
|
const searchParams = new URLSearchParams();
|
|
791
791
|
searchParams.set("sample_rate", this.params.sampleRate.toString());
|
|
792
|
-
if (this.params.wordFinalizationMaxWaitTime) {
|
|
793
|
-
searchParams.set("word_finalization_max_wait_time", this.params.wordFinalizationMaxWaitTime.toString());
|
|
794
|
-
}
|
|
795
792
|
if (this.params.endOfTurnConfidenceThreshold) {
|
|
796
793
|
searchParams.set("end_of_turn_confidence_threshold", this.params.endOfTurnConfidenceThreshold.toString());
|
|
797
794
|
}
|
|
@@ -801,8 +798,8 @@ class StreamingTranscriber {
|
|
|
801
798
|
if (this.params.maxTurnSilence) {
|
|
802
799
|
searchParams.set("max_turn_silence", this.params.maxTurnSilence.toString());
|
|
803
800
|
}
|
|
804
|
-
if (this.params.
|
|
805
|
-
searchParams.set("
|
|
801
|
+
if (this.params.formatTurns) {
|
|
802
|
+
searchParams.set("format_turns", this.params.formatTurns.toString());
|
|
806
803
|
}
|
|
807
804
|
url.search = searchParams.toString();
|
|
808
805
|
return url;
|
|
@@ -902,9 +899,14 @@ class StreamingTranscriber {
|
|
|
902
899
|
class StreamingTranscriberFactory extends BaseService {
|
|
903
900
|
constructor(params) {
|
|
904
901
|
super(params);
|
|
902
|
+
this.baseServiceParams = params;
|
|
905
903
|
}
|
|
906
904
|
transcriber(params) {
|
|
907
|
-
|
|
905
|
+
const serviceParams = { ...params };
|
|
906
|
+
if (!serviceParams.token && !serviceParams.apiKey) {
|
|
907
|
+
serviceParams.apiKey = this.baseServiceParams.apiKey;
|
|
908
|
+
}
|
|
909
|
+
return new StreamingTranscriber(serviceParams);
|
|
908
910
|
}
|
|
909
911
|
async createTemporaryToken(params) {
|
|
910
912
|
const searchParams = new URLSearchParams();
|
package/dist/node.mjs
CHANGED
|
@@ -20,7 +20,7 @@ if (typeof navigator !== "undefined" && navigator.userAgent) {
|
|
|
20
20
|
defaultUserAgentString += navigator.userAgent;
|
|
21
21
|
}
|
|
22
22
|
const defaultUserAgent = {
|
|
23
|
-
sdk: { name: "JavaScript", version: "4.13.
|
|
23
|
+
sdk: { name: "JavaScript", version: "4.13.1" },
|
|
24
24
|
};
|
|
25
25
|
if (typeof process !== "undefined") {
|
|
26
26
|
if (process.versions.node && defaultUserAgentString.indexOf("Node") === -1) {
|
|
@@ -787,9 +787,6 @@ class StreamingTranscriber {
|
|
|
787
787
|
}
|
|
788
788
|
const searchParams = new URLSearchParams();
|
|
789
789
|
searchParams.set("sample_rate", this.params.sampleRate.toString());
|
|
790
|
-
if (this.params.wordFinalizationMaxWaitTime) {
|
|
791
|
-
searchParams.set("word_finalization_max_wait_time", this.params.wordFinalizationMaxWaitTime.toString());
|
|
792
|
-
}
|
|
793
790
|
if (this.params.endOfTurnConfidenceThreshold) {
|
|
794
791
|
searchParams.set("end_of_turn_confidence_threshold", this.params.endOfTurnConfidenceThreshold.toString());
|
|
795
792
|
}
|
|
@@ -799,8 +796,8 @@ class StreamingTranscriber {
|
|
|
799
796
|
if (this.params.maxTurnSilence) {
|
|
800
797
|
searchParams.set("max_turn_silence", this.params.maxTurnSilence.toString());
|
|
801
798
|
}
|
|
802
|
-
if (this.params.
|
|
803
|
-
searchParams.set("
|
|
799
|
+
if (this.params.formatTurns) {
|
|
800
|
+
searchParams.set("format_turns", this.params.formatTurns.toString());
|
|
804
801
|
}
|
|
805
802
|
url.search = searchParams.toString();
|
|
806
803
|
return url;
|
|
@@ -900,9 +897,14 @@ class StreamingTranscriber {
|
|
|
900
897
|
class StreamingTranscriberFactory extends BaseService {
|
|
901
898
|
constructor(params) {
|
|
902
899
|
super(params);
|
|
900
|
+
this.baseServiceParams = params;
|
|
903
901
|
}
|
|
904
902
|
transcriber(params) {
|
|
905
|
-
|
|
903
|
+
const serviceParams = { ...params };
|
|
904
|
+
if (!serviceParams.token && !serviceParams.apiKey) {
|
|
905
|
+
serviceParams.apiKey = this.baseServiceParams.apiKey;
|
|
906
|
+
}
|
|
907
|
+
return new StreamingTranscriber(serviceParams);
|
|
906
908
|
}
|
|
907
909
|
async createTemporaryToken(params) {
|
|
908
910
|
const searchParams = new URLSearchParams();
|
|
@@ -2,6 +2,7 @@ import { BaseServiceParams, StreamingTokenParams, StreamingTranscriberParams } f
|
|
|
2
2
|
import { StreamingTranscriber } from "./service";
|
|
3
3
|
import { BaseService } from "../base";
|
|
4
4
|
export declare class StreamingTranscriberFactory extends BaseService {
|
|
5
|
+
private baseServiceParams;
|
|
5
6
|
constructor(params: BaseServiceParams);
|
|
6
7
|
transcriber(params: StreamingTranscriberParams): StreamingTranscriber;
|
|
7
8
|
createTemporaryToken(params: StreamingTokenParams): Promise<string>;
|
|
@@ -3,11 +3,10 @@ export type StreamingTranscriberParams = {
|
|
|
3
3
|
apiKey?: string;
|
|
4
4
|
token?: string;
|
|
5
5
|
sampleRate: number;
|
|
6
|
-
wordFinalizationMaxWaitTime?: number;
|
|
7
6
|
endOfTurnConfidenceThreshold?: number;
|
|
8
7
|
minEndOfTurnSilenceWhenConfident?: number;
|
|
9
8
|
maxTurnSilence?: number;
|
|
10
|
-
|
|
9
|
+
formatTurns?: boolean;
|
|
11
10
|
};
|
|
12
11
|
export type StreamingEvents = "open" | "close" | "turn" | "error";
|
|
13
12
|
export type StreamingListeners = {
|
|
@@ -17,8 +16,8 @@ export type StreamingListeners = {
|
|
|
17
16
|
error?: (error: Error) => void;
|
|
18
17
|
};
|
|
19
18
|
export type StreamingTokenParams = {
|
|
20
|
-
expires_in_seconds
|
|
21
|
-
max_session_duration_seconds
|
|
19
|
+
expires_in_seconds?: number;
|
|
20
|
+
max_session_duration_seconds?: number;
|
|
22
21
|
};
|
|
23
22
|
export type StreamingTemporaryTokenResponse = {
|
|
24
23
|
token: string;
|
|
@@ -55,11 +54,10 @@ export type StreamingTerminateSession = {
|
|
|
55
54
|
};
|
|
56
55
|
export type StreamingUpdateConfiguration = {
|
|
57
56
|
type: "UpdateConfiguration";
|
|
58
|
-
word_finalization_max_wait_time?: number;
|
|
59
57
|
end_of_turn_confidence_threshold?: number;
|
|
60
58
|
min_end_of_turn_silence_when_confident?: number;
|
|
61
59
|
max_turn_silence?: number;
|
|
62
|
-
|
|
60
|
+
format_turns?: boolean;
|
|
63
61
|
};
|
|
64
62
|
export type StreamingForceEndpoint = {
|
|
65
63
|
type: "ForceEndpoint";
|
package/dist/workerd.mjs
CHANGED
|
@@ -15,7 +15,7 @@ if (typeof navigator !== "undefined" && navigator.userAgent) {
|
|
|
15
15
|
defaultUserAgentString += navigator.userAgent;
|
|
16
16
|
}
|
|
17
17
|
const defaultUserAgent = {
|
|
18
|
-
sdk: { name: "JavaScript", version: "4.13.
|
|
18
|
+
sdk: { name: "JavaScript", version: "4.13.1" },
|
|
19
19
|
};
|
|
20
20
|
if (typeof process !== "undefined") {
|
|
21
21
|
if (process.versions.node && defaultUserAgentString.indexOf("Node") === -1) {
|
|
@@ -792,9 +792,6 @@ class StreamingTranscriber {
|
|
|
792
792
|
}
|
|
793
793
|
const searchParams = new URLSearchParams();
|
|
794
794
|
searchParams.set("sample_rate", this.params.sampleRate.toString());
|
|
795
|
-
if (this.params.wordFinalizationMaxWaitTime) {
|
|
796
|
-
searchParams.set("word_finalization_max_wait_time", this.params.wordFinalizationMaxWaitTime.toString());
|
|
797
|
-
}
|
|
798
795
|
if (this.params.endOfTurnConfidenceThreshold) {
|
|
799
796
|
searchParams.set("end_of_turn_confidence_threshold", this.params.endOfTurnConfidenceThreshold.toString());
|
|
800
797
|
}
|
|
@@ -804,8 +801,8 @@ class StreamingTranscriber {
|
|
|
804
801
|
if (this.params.maxTurnSilence) {
|
|
805
802
|
searchParams.set("max_turn_silence", this.params.maxTurnSilence.toString());
|
|
806
803
|
}
|
|
807
|
-
if (this.params.
|
|
808
|
-
searchParams.set("
|
|
804
|
+
if (this.params.formatTurns) {
|
|
805
|
+
searchParams.set("format_turns", this.params.formatTurns.toString());
|
|
809
806
|
}
|
|
810
807
|
url.search = searchParams.toString();
|
|
811
808
|
return url;
|
|
@@ -905,9 +902,14 @@ class StreamingTranscriber {
|
|
|
905
902
|
class StreamingTranscriberFactory extends BaseService {
|
|
906
903
|
constructor(params) {
|
|
907
904
|
super(params);
|
|
905
|
+
this.baseServiceParams = params;
|
|
908
906
|
}
|
|
909
907
|
transcriber(params) {
|
|
910
|
-
|
|
908
|
+
const serviceParams = { ...params };
|
|
909
|
+
if (!serviceParams.token && !serviceParams.apiKey) {
|
|
910
|
+
serviceParams.apiKey = this.baseServiceParams.apiKey;
|
|
911
|
+
}
|
|
912
|
+
return new StreamingTranscriber(serviceParams);
|
|
911
913
|
}
|
|
912
914
|
async createTemporaryToken(params) {
|
|
913
915
|
const searchParams = new URLSearchParams();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assemblyai",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.1",
|
|
4
4
|
"description": "The AssemblyAI JavaScript SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription, as well as the latest LeMUR models.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18"
|
|
@@ -8,12 +8,21 @@ import { StreamingTranscriber } from "./service";
|
|
|
8
8
|
import { BaseService } from "../base";
|
|
9
9
|
|
|
10
10
|
export class StreamingTranscriberFactory extends BaseService {
|
|
11
|
+
private baseServiceParams: BaseServiceParams;
|
|
12
|
+
|
|
11
13
|
constructor(params: BaseServiceParams) {
|
|
12
14
|
super(params);
|
|
15
|
+
this.baseServiceParams = params;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
transcriber(params: StreamingTranscriberParams): StreamingTranscriber {
|
|
16
|
-
|
|
19
|
+
const serviceParams = { ...params };
|
|
20
|
+
|
|
21
|
+
if (!serviceParams.token && !serviceParams.apiKey) {
|
|
22
|
+
serviceParams.apiKey = this.baseServiceParams.apiKey;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return new StreamingTranscriber(serviceParams);
|
|
17
26
|
}
|
|
18
27
|
|
|
19
28
|
async createTemporaryToken(params: StreamingTokenParams) {
|
|
@@ -71,13 +71,6 @@ export class StreamingTranscriber {
|
|
|
71
71
|
|
|
72
72
|
searchParams.set("sample_rate", this.params.sampleRate.toString());
|
|
73
73
|
|
|
74
|
-
if (this.params.wordFinalizationMaxWaitTime) {
|
|
75
|
-
searchParams.set(
|
|
76
|
-
"word_finalization_max_wait_time",
|
|
77
|
-
this.params.wordFinalizationMaxWaitTime.toString(),
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
74
|
if (this.params.endOfTurnConfidenceThreshold) {
|
|
82
75
|
searchParams.set(
|
|
83
76
|
"end_of_turn_confidence_threshold",
|
|
@@ -99,11 +92,8 @@ export class StreamingTranscriber {
|
|
|
99
92
|
);
|
|
100
93
|
}
|
|
101
94
|
|
|
102
|
-
if (this.params.
|
|
103
|
-
searchParams.set(
|
|
104
|
-
"formatted_finals",
|
|
105
|
-
this.params.formattedFinals.toString(),
|
|
106
|
-
);
|
|
95
|
+
if (this.params.formatTurns) {
|
|
96
|
+
searchParams.set("format_turns", this.params.formatTurns.toString());
|
|
107
97
|
}
|
|
108
98
|
|
|
109
99
|
url.search = searchParams.toString();
|
|
@@ -4,11 +4,10 @@ export type StreamingTranscriberParams = {
|
|
|
4
4
|
token?: string;
|
|
5
5
|
sampleRate: number;
|
|
6
6
|
|
|
7
|
-
wordFinalizationMaxWaitTime?: number;
|
|
8
7
|
endOfTurnConfidenceThreshold?: number;
|
|
9
8
|
minEndOfTurnSilenceWhenConfident?: number;
|
|
10
9
|
maxTurnSilence?: number;
|
|
11
|
-
|
|
10
|
+
formatTurns?: boolean;
|
|
12
11
|
};
|
|
13
12
|
|
|
14
13
|
export type StreamingEvents = "open" | "close" | "turn" | "error";
|
|
@@ -21,8 +20,8 @@ export type StreamingListeners = {
|
|
|
21
20
|
};
|
|
22
21
|
|
|
23
22
|
export type StreamingTokenParams = {
|
|
24
|
-
expires_in_seconds
|
|
25
|
-
max_session_duration_seconds
|
|
23
|
+
expires_in_seconds?: number;
|
|
24
|
+
max_session_duration_seconds?: number;
|
|
26
25
|
};
|
|
27
26
|
|
|
28
27
|
export type StreamingTemporaryTokenResponse = {
|
|
@@ -67,11 +66,10 @@ export type StreamingTerminateSession = {
|
|
|
67
66
|
|
|
68
67
|
export type StreamingUpdateConfiguration = {
|
|
69
68
|
type: "UpdateConfiguration";
|
|
70
|
-
word_finalization_max_wait_time?: number;
|
|
71
69
|
end_of_turn_confidence_threshold?: number;
|
|
72
70
|
min_end_of_turn_silence_when_confident?: number;
|
|
73
71
|
max_turn_silence?: number;
|
|
74
|
-
|
|
72
|
+
format_turns?: boolean;
|
|
75
73
|
};
|
|
76
74
|
|
|
77
75
|
export type StreamingForceEndpoint = {
|