sarvamai 1.1.7 → 1.1.8-alpha.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/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +17 -12
- package/dist/cjs/api/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/index.js +3 -1
- package/dist/cjs/api/resources/speechToText/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/speechToText/client/Client.js +2 -2
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/client/Client.d.ts +34 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/client/Client.js +85 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/client/Socket.d.ts +54 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/client/Socket.js +170 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/client/index.js +2 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/exports.d.ts +2 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/exports.js +21 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/index.d.ts +2 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/index.js +18 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingEndpointing.d.ts +11 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingEndpointing.js +14 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingLanguageCode.d.ts +59 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingLanguageCode.js +62 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingMode.d.ts +21 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingMode.js +24 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingStreamType.d.ts +13 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingStreamType.js +16 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/types/index.d.ts +4 -0
- package/dist/cjs/api/resources/speechToTextRealtimeStreaming/types/index.js +20 -0
- package/dist/cjs/api/types/DocDigitizationJobParameters.d.ts +2 -2
- package/dist/cjs/api/types/FilesRequest.d.ts +5 -0
- package/dist/cjs/api/types/RealtimeAudioInput.d.ts +10 -0
- package/dist/cjs/api/types/RealtimeAudioInput.js +3 -0
- package/dist/cjs/api/types/RealtimeEnd.d.ts +7 -0
- package/dist/cjs/api/types/RealtimeEnd.js +3 -0
- package/dist/cjs/api/types/RealtimeError.d.ts +42 -0
- package/dist/cjs/api/types/RealtimeError.js +15 -0
- package/dist/cjs/api/types/RealtimePing.d.ts +6 -0
- package/dist/cjs/api/types/RealtimePing.js +3 -0
- package/dist/cjs/api/types/RealtimePong.d.ts +6 -0
- package/dist/cjs/api/types/RealtimePong.js +3 -0
- package/dist/cjs/api/types/RealtimeSessionBegin.d.ts +35 -0
- package/dist/cjs/api/types/RealtimeSessionBegin.js +3 -0
- package/dist/cjs/api/types/RealtimeSessionEnd.d.ts +15 -0
- package/dist/cjs/api/types/RealtimeSessionEnd.js +3 -0
- package/dist/cjs/api/types/RealtimeSpeechEnd.d.ts +7 -0
- package/dist/cjs/api/types/RealtimeSpeechEnd.js +3 -0
- package/dist/cjs/api/types/RealtimeSpeechStart.d.ts +7 -0
- package/dist/cjs/api/types/RealtimeSpeechStart.js +3 -0
- package/dist/cjs/api/types/RealtimeTranscriptFinal.d.ts +16 -0
- package/dist/cjs/api/types/RealtimeTranscriptFinal.js +3 -0
- package/dist/cjs/api/types/RealtimeTranscriptPartial.d.ts +17 -0
- package/dist/cjs/api/types/RealtimeTranscriptPartial.js +3 -0
- package/dist/cjs/api/types/RealtimeTurnEnd.d.ts +6 -0
- package/dist/cjs/api/types/RealtimeTurnEnd.js +3 -0
- package/dist/cjs/api/types/RealtimeVadSpeechEnd.d.ts +10 -0
- package/dist/cjs/api/types/RealtimeVadSpeechEnd.js +3 -0
- package/dist/cjs/api/types/RealtimeVadSpeechStart.d.ts +10 -0
- package/dist/cjs/api/types/RealtimeVadSpeechStart.js +3 -0
- package/dist/cjs/api/types/index.d.ts +14 -0
- package/dist/cjs/api/types/index.js +14 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +5 -0
- package/dist/esm/api/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/index.mjs +2 -0
- package/dist/esm/api/resources/speechToText/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/speechToText/client/Client.mjs +2 -2
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/client/Client.d.mts +34 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/client/Client.mjs +48 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/client/Socket.d.mts +54 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/client/Socket.mjs +133 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/client/index.d.mts +1 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/client/index.mjs +1 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/exports.d.mts +2 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/exports.mjs +3 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/index.d.mts +2 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/index.mjs +2 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingEndpointing.d.mts +11 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingEndpointing.mjs +11 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingLanguageCode.d.mts +59 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingLanguageCode.mjs +59 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingMode.d.mts +21 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingMode.mjs +21 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingStreamType.d.mts +13 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/types/SpeechToTextRealtimeStreamingStreamType.mjs +13 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/types/index.d.mts +4 -0
- package/dist/esm/api/resources/speechToTextRealtimeStreaming/types/index.mjs +4 -0
- package/dist/esm/api/types/DocDigitizationJobParameters.d.mts +2 -2
- package/dist/esm/api/types/FilesRequest.d.mts +5 -0
- package/dist/esm/api/types/RealtimeAudioInput.d.mts +10 -0
- package/dist/esm/api/types/RealtimeAudioInput.mjs +2 -0
- package/dist/esm/api/types/RealtimeEnd.d.mts +7 -0
- package/dist/esm/api/types/RealtimeEnd.mjs +2 -0
- package/dist/esm/api/types/RealtimeError.d.mts +42 -0
- package/dist/esm/api/types/RealtimeError.mjs +12 -0
- package/dist/esm/api/types/RealtimePing.d.mts +6 -0
- package/dist/esm/api/types/RealtimePing.mjs +2 -0
- package/dist/esm/api/types/RealtimePong.d.mts +6 -0
- package/dist/esm/api/types/RealtimePong.mjs +2 -0
- package/dist/esm/api/types/RealtimeSessionBegin.d.mts +35 -0
- package/dist/esm/api/types/RealtimeSessionBegin.mjs +2 -0
- package/dist/esm/api/types/RealtimeSessionEnd.d.mts +15 -0
- package/dist/esm/api/types/RealtimeSessionEnd.mjs +2 -0
- package/dist/esm/api/types/RealtimeSpeechEnd.d.mts +7 -0
- package/dist/esm/api/types/RealtimeSpeechEnd.mjs +2 -0
- package/dist/esm/api/types/RealtimeSpeechStart.d.mts +7 -0
- package/dist/esm/api/types/RealtimeSpeechStart.mjs +2 -0
- package/dist/esm/api/types/RealtimeTranscriptFinal.d.mts +16 -0
- package/dist/esm/api/types/RealtimeTranscriptFinal.mjs +2 -0
- package/dist/esm/api/types/RealtimeTranscriptPartial.d.mts +17 -0
- package/dist/esm/api/types/RealtimeTranscriptPartial.mjs +2 -0
- package/dist/esm/api/types/RealtimeTurnEnd.d.mts +6 -0
- package/dist/esm/api/types/RealtimeTurnEnd.mjs +2 -0
- package/dist/esm/api/types/RealtimeVadSpeechEnd.d.mts +10 -0
- package/dist/esm/api/types/RealtimeVadSpeechEnd.mjs +2 -0
- package/dist/esm/api/types/RealtimeVadSpeechStart.d.mts +10 -0
- package/dist/esm/api/types/RealtimeVadSpeechStart.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +14 -0
- package/dist/esm/api/types/index.mjs +14 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +13 -1
- package/reference.md +14 -4
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "sarvamai",
|
|
46
|
-
"X-Fern-SDK-Version": "1.1.
|
|
47
|
-
"User-Agent": "sarvamai/1.1.
|
|
46
|
+
"X-Fern-SDK-Version": "1.1.8-alpha.1",
|
|
47
|
+
"User-Agent": "sarvamai/1.1.8-alpha.1",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { DocumentIntelligenceClient } from "./api/resources/documentIntelligence
|
|
|
3
3
|
import { PronunciationDictionaryClient } from "./api/resources/pronunciationDictionary/client/Client.js";
|
|
4
4
|
import { SpeechToTextClient } from "./api/resources/speechToText/client/Client.js";
|
|
5
5
|
import { SpeechToTextJobClient } from "./api/resources/speechToTextJob/client/Client.js";
|
|
6
|
+
import { SpeechToTextRealtimeStreamingClient } from "./api/resources/speechToTextRealtimeStreaming/client/Client.js";
|
|
6
7
|
import { SpeechToTextStreamingClient } from "./api/resources/speechToTextStreaming/client/Client.js";
|
|
7
8
|
import { SpeechToTextTranslateJobClient } from "./api/resources/speechToTextTranslateJob/client/Client.js";
|
|
8
9
|
import { SpeechToTextTranslateStreamingClient } from "./api/resources/speechToTextTranslateStreaming/client/Client.js";
|
|
@@ -28,6 +29,7 @@ export declare class SarvamAIClient {
|
|
|
28
29
|
protected _documentIntelligence: DocumentIntelligenceClient | undefined;
|
|
29
30
|
protected _speechToTextStreaming: SpeechToTextStreamingClient | undefined;
|
|
30
31
|
protected _speechToTextTranslateStreaming: SpeechToTextTranslateStreamingClient | undefined;
|
|
32
|
+
protected _speechToTextRealtimeStreaming: SpeechToTextRealtimeStreamingClient | undefined;
|
|
31
33
|
protected _textToSpeechStreaming: TextToSpeechStreamingClient | undefined;
|
|
32
34
|
constructor(options?: SarvamAIClient.Options);
|
|
33
35
|
get text(): TextClient;
|
|
@@ -40,5 +42,6 @@ export declare class SarvamAIClient {
|
|
|
40
42
|
get documentIntelligence(): DocumentIntelligenceClient;
|
|
41
43
|
get speechToTextStreaming(): SpeechToTextStreamingClient;
|
|
42
44
|
get speechToTextTranslateStreaming(): SpeechToTextTranslateStreamingClient;
|
|
45
|
+
get speechToTextRealtimeStreaming(): SpeechToTextRealtimeStreamingClient;
|
|
43
46
|
get textToSpeechStreaming(): TextToSpeechStreamingClient;
|
|
44
47
|
}
|
package/dist/cjs/Client.js
CHANGED
|
@@ -7,12 +7,13 @@ const Client_js_2 = require("./api/resources/documentIntelligence/client/Client.
|
|
|
7
7
|
const Client_js_3 = require("./api/resources/pronunciationDictionary/client/Client.js");
|
|
8
8
|
const Client_js_4 = require("./api/resources/speechToText/client/Client.js");
|
|
9
9
|
const Client_js_5 = require("./api/resources/speechToTextJob/client/Client.js");
|
|
10
|
-
const Client_js_6 = require("./api/resources/
|
|
11
|
-
const Client_js_7 = require("./api/resources/
|
|
12
|
-
const Client_js_8 = require("./api/resources/
|
|
13
|
-
const Client_js_9 = require("./api/resources/
|
|
14
|
-
const Client_js_10 = require("./api/resources/
|
|
15
|
-
const Client_js_11 = require("./api/resources/
|
|
10
|
+
const Client_js_6 = require("./api/resources/speechToTextRealtimeStreaming/client/Client.js");
|
|
11
|
+
const Client_js_7 = require("./api/resources/speechToTextStreaming/client/Client.js");
|
|
12
|
+
const Client_js_8 = require("./api/resources/speechToTextTranslateJob/client/Client.js");
|
|
13
|
+
const Client_js_9 = require("./api/resources/speechToTextTranslateStreaming/client/Client.js");
|
|
14
|
+
const Client_js_10 = require("./api/resources/text/client/Client.js");
|
|
15
|
+
const Client_js_11 = require("./api/resources/textToSpeech/client/Client.js");
|
|
16
|
+
const Client_js_12 = require("./api/resources/textToSpeechStreaming/client/Client.js");
|
|
16
17
|
const BaseClient_js_1 = require("./BaseClient.js");
|
|
17
18
|
class SarvamAIClient {
|
|
18
19
|
constructor(options = {}) {
|
|
@@ -20,7 +21,7 @@ class SarvamAIClient {
|
|
|
20
21
|
}
|
|
21
22
|
get text() {
|
|
22
23
|
var _a;
|
|
23
|
-
return ((_a = this._text) !== null && _a !== void 0 ? _a : (this._text = new
|
|
24
|
+
return ((_a = this._text) !== null && _a !== void 0 ? _a : (this._text = new Client_js_10.TextClient(this._options)));
|
|
24
25
|
}
|
|
25
26
|
get speechToText() {
|
|
26
27
|
var _a;
|
|
@@ -28,7 +29,7 @@ class SarvamAIClient {
|
|
|
28
29
|
}
|
|
29
30
|
get textToSpeech() {
|
|
30
31
|
var _a;
|
|
31
|
-
return ((_a = this._textToSpeech) !== null && _a !== void 0 ? _a : (this._textToSpeech = new
|
|
32
|
+
return ((_a = this._textToSpeech) !== null && _a !== void 0 ? _a : (this._textToSpeech = new Client_js_11.TextToSpeechClient(this._options)));
|
|
32
33
|
}
|
|
33
34
|
get pronunciationDictionary() {
|
|
34
35
|
var _a;
|
|
@@ -44,7 +45,7 @@ class SarvamAIClient {
|
|
|
44
45
|
}
|
|
45
46
|
get speechToTextTranslateJob() {
|
|
46
47
|
var _a;
|
|
47
|
-
return ((_a = this._speechToTextTranslateJob) !== null && _a !== void 0 ? _a : (this._speechToTextTranslateJob = new
|
|
48
|
+
return ((_a = this._speechToTextTranslateJob) !== null && _a !== void 0 ? _a : (this._speechToTextTranslateJob = new Client_js_8.SpeechToTextTranslateJobClient(this._options)));
|
|
48
49
|
}
|
|
49
50
|
get documentIntelligence() {
|
|
50
51
|
var _a;
|
|
@@ -52,15 +53,19 @@ class SarvamAIClient {
|
|
|
52
53
|
}
|
|
53
54
|
get speechToTextStreaming() {
|
|
54
55
|
var _a;
|
|
55
|
-
return ((_a = this._speechToTextStreaming) !== null && _a !== void 0 ? _a : (this._speechToTextStreaming = new
|
|
56
|
+
return ((_a = this._speechToTextStreaming) !== null && _a !== void 0 ? _a : (this._speechToTextStreaming = new Client_js_7.SpeechToTextStreamingClient(this._options)));
|
|
56
57
|
}
|
|
57
58
|
get speechToTextTranslateStreaming() {
|
|
58
59
|
var _a;
|
|
59
|
-
return ((_a = this._speechToTextTranslateStreaming) !== null && _a !== void 0 ? _a : (this._speechToTextTranslateStreaming = new
|
|
60
|
+
return ((_a = this._speechToTextTranslateStreaming) !== null && _a !== void 0 ? _a : (this._speechToTextTranslateStreaming = new Client_js_9.SpeechToTextTranslateStreamingClient(this._options)));
|
|
61
|
+
}
|
|
62
|
+
get speechToTextRealtimeStreaming() {
|
|
63
|
+
var _a;
|
|
64
|
+
return ((_a = this._speechToTextRealtimeStreaming) !== null && _a !== void 0 ? _a : (this._speechToTextRealtimeStreaming = new Client_js_6.SpeechToTextRealtimeStreamingClient(this._options)));
|
|
60
65
|
}
|
|
61
66
|
get textToSpeechStreaming() {
|
|
62
67
|
var _a;
|
|
63
|
-
return ((_a = this._textToSpeechStreaming) !== null && _a !== void 0 ? _a : (this._textToSpeechStreaming = new
|
|
68
|
+
return ((_a = this._textToSpeechStreaming) !== null && _a !== void 0 ? _a : (this._textToSpeechStreaming = new Client_js_12.TextToSpeechStreamingClient(this._options)));
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
71
|
exports.SarvamAIClient = SarvamAIClient;
|
|
@@ -8,6 +8,8 @@ export * from "./speechToText/client/requests/index.js";
|
|
|
8
8
|
export * as speechToText from "./speechToText/index.js";
|
|
9
9
|
export * from "./speechToTextJob/client/requests/index.js";
|
|
10
10
|
export * as speechToTextJob from "./speechToTextJob/index.js";
|
|
11
|
+
export * as speechToTextRealtimeStreaming from "./speechToTextRealtimeStreaming/index.js";
|
|
12
|
+
export * from "./speechToTextRealtimeStreaming/types/index.js";
|
|
11
13
|
export * as speechToTextStreaming from "./speechToTextStreaming/index.js";
|
|
12
14
|
export * from "./speechToTextStreaming/types/index.js";
|
|
13
15
|
export * from "./speechToTextTranslateJob/client/requests/index.js";
|
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.textToSpeechStreaming = exports.textToSpeech = exports.text = exports.speechToTextTranslateStreaming = exports.speechToTextTranslateJob = exports.speechToTextStreaming = exports.speechToTextJob = exports.speechToText = exports.pronunciationDictionary = exports.documentIntelligence = exports.chat = void 0;
|
|
39
|
+
exports.textToSpeechStreaming = exports.textToSpeech = exports.text = exports.speechToTextTranslateStreaming = exports.speechToTextTranslateJob = exports.speechToTextStreaming = exports.speechToTextRealtimeStreaming = exports.speechToTextJob = exports.speechToText = exports.pronunciationDictionary = exports.documentIntelligence = exports.chat = void 0;
|
|
40
40
|
__exportStar(require("./chat/client/requests/index.js"), exports);
|
|
41
41
|
exports.chat = __importStar(require("./chat/index.js"));
|
|
42
42
|
__exportStar(require("./documentIntelligence/client/requests/index.js"), exports);
|
|
@@ -47,6 +47,8 @@ __exportStar(require("./speechToText/client/requests/index.js"), exports);
|
|
|
47
47
|
exports.speechToText = __importStar(require("./speechToText/index.js"));
|
|
48
48
|
__exportStar(require("./speechToTextJob/client/requests/index.js"), exports);
|
|
49
49
|
exports.speechToTextJob = __importStar(require("./speechToTextJob/index.js"));
|
|
50
|
+
exports.speechToTextRealtimeStreaming = __importStar(require("./speechToTextRealtimeStreaming/index.js"));
|
|
51
|
+
__exportStar(require("./speechToTextRealtimeStreaming/types/index.js"), exports);
|
|
50
52
|
exports.speechToTextStreaming = __importStar(require("./speechToTextStreaming/index.js"));
|
|
51
53
|
__exportStar(require("./speechToTextStreaming/types/index.js"), exports);
|
|
52
54
|
__exportStar(require("./speechToTextTranslateJob/client/requests/index.js"), exports);
|
|
@@ -23,7 +23,7 @@ export declare class SpeechToTextClient {
|
|
|
23
23
|
* ### Note:
|
|
24
24
|
* - Pricing differs for REST and Batch APIs
|
|
25
25
|
* - Diarization is only available in Batch API with separate pricing
|
|
26
|
-
* - Please refer to [here](https://docs.sarvam.ai/api-reference-docs/
|
|
26
|
+
* - Please refer to [here](https://docs.sarvam.ai/api-reference-docs/pricing) for detailed pricing information
|
|
27
27
|
*
|
|
28
28
|
* @param {SarvamAI.SpeechToTextTranscriptionRequest} request
|
|
29
29
|
* @param {SpeechToTextClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -56,7 +56,7 @@ export declare class SpeechToTextClient {
|
|
|
56
56
|
* ### Note:
|
|
57
57
|
* - Pricing differs for REST and Batch APIs
|
|
58
58
|
* - Diarization is only available in Batch API with separate pricing
|
|
59
|
-
* - Please refer to [here](https://docs.sarvam.ai/api-reference-docs/
|
|
59
|
+
* - Please refer to [here](https://docs.sarvam.ai/api-reference-docs/pricing) for detailed pricing information
|
|
60
60
|
*
|
|
61
61
|
* @param {SarvamAI.SpeechToTextTranslationRequest} request
|
|
62
62
|
* @param {SpeechToTextClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -68,7 +68,7 @@ class SpeechToTextClient {
|
|
|
68
68
|
* ### Note:
|
|
69
69
|
* - Pricing differs for REST and Batch APIs
|
|
70
70
|
* - Diarization is only available in Batch API with separate pricing
|
|
71
|
-
* - Please refer to [here](https://docs.sarvam.ai/api-reference-docs/
|
|
71
|
+
* - Please refer to [here](https://docs.sarvam.ai/api-reference-docs/pricing) for detailed pricing information
|
|
72
72
|
*
|
|
73
73
|
* @param {SarvamAI.SpeechToTextTranscriptionRequest} request
|
|
74
74
|
* @param {SpeechToTextClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -164,7 +164,7 @@ class SpeechToTextClient {
|
|
|
164
164
|
* ### Note:
|
|
165
165
|
* - Pricing differs for REST and Batch APIs
|
|
166
166
|
* - Diarization is only available in Batch API with separate pricing
|
|
167
|
-
* - Please refer to [here](https://docs.sarvam.ai/api-reference-docs/
|
|
167
|
+
* - Please refer to [here](https://docs.sarvam.ai/api-reference-docs/pricing) for detailed pricing information
|
|
168
168
|
*
|
|
169
169
|
* @param {SarvamAI.SpeechToTextTranslationRequest} request
|
|
170
170
|
* @param {SpeechToTextClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { BaseClientOptions } from "../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptions } from "../../../../BaseClient.js";
|
|
3
|
+
import type * as SarvamAI from "../../../index.js";
|
|
4
|
+
import { SpeechToTextRealtimeStreamingSocket } from "./Socket.js";
|
|
5
|
+
export declare namespace SpeechToTextRealtimeStreamingClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface ConnectArgs {
|
|
8
|
+
"language-code": SarvamAI.SpeechToTextRealtimeStreamingLanguageCode;
|
|
9
|
+
model?: "saaras:v3-realtime";
|
|
10
|
+
"stream-type"?: SarvamAI.SpeechToTextRealtimeStreamingStreamType;
|
|
11
|
+
mode?: SarvamAI.SpeechToTextRealtimeStreamingMode;
|
|
12
|
+
endpointing?: SarvamAI.SpeechToTextRealtimeStreamingEndpointing;
|
|
13
|
+
encoding?: "linear16";
|
|
14
|
+
sample_rate?: string;
|
|
15
|
+
vad_sot_threshold?: string;
|
|
16
|
+
vad_min_speech_ms?: string;
|
|
17
|
+
vad_min_silence_ms?: string;
|
|
18
|
+
vad_smoothing_alpha?: string;
|
|
19
|
+
"Api-Subscription-Key": string;
|
|
20
|
+
/** Additional query parameters to send with the websocket connect request. */
|
|
21
|
+
queryParams?: Record<string, unknown>;
|
|
22
|
+
/** Arbitrary headers to send with the websocket connect request. */
|
|
23
|
+
headers?: Record<string, string>;
|
|
24
|
+
/** Enable debug mode on the websocket. Defaults to false. */
|
|
25
|
+
debug?: boolean;
|
|
26
|
+
/** Number of reconnect attempts. Defaults to 30. */
|
|
27
|
+
reconnectAttempts?: number;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export declare class SpeechToTextRealtimeStreamingClient {
|
|
31
|
+
protected readonly _options: NormalizedClientOptions<SpeechToTextRealtimeStreamingClient.Options>;
|
|
32
|
+
constructor(options?: SpeechToTextRealtimeStreamingClient.Options);
|
|
33
|
+
connect(args: SpeechToTextRealtimeStreamingClient.ConnectArgs): Promise<SpeechToTextRealtimeStreamingSocket>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.SpeechToTextRealtimeStreamingClient = void 0;
|
|
47
|
+
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
48
|
+
const headers_js_1 = require("../../../../core/headers.js");
|
|
49
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
50
|
+
const environments = __importStar(require("../../../../environments.js"));
|
|
51
|
+
const Socket_js_1 = require("./Socket.js");
|
|
52
|
+
class SpeechToTextRealtimeStreamingClient {
|
|
53
|
+
constructor(options = {}) {
|
|
54
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
|
|
55
|
+
}
|
|
56
|
+
connect(args) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
const { "language-code": languageCode, model, "stream-type": streamType, mode, endpointing, encoding, sample_rate: sampleRate, vad_sot_threshold: vadSotThreshold, vad_min_speech_ms: vadMinSpeechMs, vad_min_silence_ms: vadMinSilenceMs, vad_smoothing_alpha: vadSmoothingAlpha, queryParams, headers, debug, reconnectAttempts, } = args;
|
|
60
|
+
const _queryParams = {
|
|
61
|
+
"language-code": languageCode,
|
|
62
|
+
model: model != null ? model : undefined,
|
|
63
|
+
"stream-type": streamType != null ? streamType : undefined,
|
|
64
|
+
mode: mode != null ? mode : undefined,
|
|
65
|
+
endpointing: endpointing != null ? endpointing : undefined,
|
|
66
|
+
encoding: encoding != null ? encoding : undefined,
|
|
67
|
+
sample_rate: sampleRate,
|
|
68
|
+
vad_sot_threshold: vadSotThreshold,
|
|
69
|
+
vad_min_speech_ms: vadMinSpeechMs,
|
|
70
|
+
vad_min_silence_ms: vadMinSilenceMs,
|
|
71
|
+
vad_smoothing_alpha: vadSmoothingAlpha,
|
|
72
|
+
};
|
|
73
|
+
const _headers = (0, headers_js_1.mergeHeaders)((0, headers_js_1.mergeOnlyDefinedHeaders)({ "Api-Subscription-Key": args["Api-Subscription-Key"] }), headers);
|
|
74
|
+
const socket = new core.ReconnectingWebSocket({
|
|
75
|
+
url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SarvamAIEnvironment.Production).production, "/speech-to-text-realtime/ws"),
|
|
76
|
+
protocols: [],
|
|
77
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), queryParams),
|
|
78
|
+
headers: _headers,
|
|
79
|
+
options: { debug: debug !== null && debug !== void 0 ? debug : false, maxRetries: reconnectAttempts !== null && reconnectAttempts !== void 0 ? reconnectAttempts : 30 },
|
|
80
|
+
});
|
|
81
|
+
return new Socket_js_1.SpeechToTextRealtimeStreamingSocket({ socket });
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.SpeechToTextRealtimeStreamingClient = SpeechToTextRealtimeStreamingClient;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as core from "../../../../core/index.js";
|
|
2
|
+
import type * as SarvamAI from "../../../index.js";
|
|
3
|
+
export declare namespace SpeechToTextRealtimeStreamingSocket {
|
|
4
|
+
interface Args {
|
|
5
|
+
socket: core.ReconnectingWebSocket;
|
|
6
|
+
}
|
|
7
|
+
type Response = SarvamAI.RealtimeSessionBegin | SarvamAI.RealtimeVadSpeechStart | SarvamAI.RealtimeVadSpeechEnd | SarvamAI.RealtimeTranscriptPartial | SarvamAI.RealtimeTranscriptFinal | SarvamAI.RealtimePong | SarvamAI.RealtimeSessionEnd | SarvamAI.RealtimeError;
|
|
8
|
+
type EventHandlers = {
|
|
9
|
+
open?: () => void;
|
|
10
|
+
message?: (message: Response) => void;
|
|
11
|
+
close?: (event: core.CloseEvent) => void;
|
|
12
|
+
error?: (error: Error) => void;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare class SpeechToTextRealtimeStreamingSocket {
|
|
16
|
+
readonly socket: core.ReconnectingWebSocket;
|
|
17
|
+
protected readonly eventHandlers: SpeechToTextRealtimeStreamingSocket.EventHandlers;
|
|
18
|
+
private handleOpen;
|
|
19
|
+
private handleMessage;
|
|
20
|
+
private handleClose;
|
|
21
|
+
private handleError;
|
|
22
|
+
constructor(args: SpeechToTextRealtimeStreamingSocket.Args);
|
|
23
|
+
/** The current state of the connection; this is one of the readyState constants. */
|
|
24
|
+
get readyState(): number;
|
|
25
|
+
/**
|
|
26
|
+
* @param event - The event to attach to.
|
|
27
|
+
* @param callback - The callback to run when the event is triggered.
|
|
28
|
+
* Usage:
|
|
29
|
+
* ```typescript
|
|
30
|
+
* this.on('open', () => {
|
|
31
|
+
* console.log('The websocket is open');
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
on<T extends keyof SpeechToTextRealtimeStreamingSocket.EventHandlers>(event: T, callback: SpeechToTextRealtimeStreamingSocket.EventHandlers[T]): void;
|
|
36
|
+
sendRealtimeAudioInput(message: SarvamAI.RealtimeAudioInput): void;
|
|
37
|
+
sendRealtimeSpeechStart(message: SarvamAI.RealtimeSpeechStart): void;
|
|
38
|
+
sendRealtimeSpeechEnd(message: SarvamAI.RealtimeSpeechEnd): void;
|
|
39
|
+
sendRealtimeTurnEnd(message: SarvamAI.RealtimeTurnEnd): void;
|
|
40
|
+
sendRealtimeEnd(message: SarvamAI.RealtimeEnd): void;
|
|
41
|
+
sendRealtimePing(message: SarvamAI.RealtimePing): void;
|
|
42
|
+
/** Connect to the websocket and register event handlers. */
|
|
43
|
+
connect(): SpeechToTextRealtimeStreamingSocket;
|
|
44
|
+
/** Close the websocket and unregister event handlers. */
|
|
45
|
+
close(): void;
|
|
46
|
+
/** Returns a promise that resolves when the websocket is open. */
|
|
47
|
+
waitForOpen(): Promise<core.ReconnectingWebSocket>;
|
|
48
|
+
/** Asserts that the websocket is open. */
|
|
49
|
+
private assertSocketIsOpen;
|
|
50
|
+
/** Send a binary payload to the websocket. */
|
|
51
|
+
protected sendBinary(payload: ArrayBufferLike | Blob | ArrayBufferView): void;
|
|
52
|
+
/** Send a JSON payload to the websocket. */
|
|
53
|
+
protected sendJson(payload: SarvamAI.RealtimeAudioInput | SarvamAI.RealtimeSpeechStart | SarvamAI.RealtimeSpeechEnd | SarvamAI.RealtimeTurnEnd | SarvamAI.RealtimeEnd | SarvamAI.RealtimePing): void;
|
|
54
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.SpeechToTextRealtimeStreamingSocket = void 0;
|
|
47
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
48
|
+
const json_js_1 = require("../../../../core/json.js");
|
|
49
|
+
class SpeechToTextRealtimeStreamingSocket {
|
|
50
|
+
constructor(args) {
|
|
51
|
+
this.eventHandlers = {};
|
|
52
|
+
this.handleOpen = () => {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
(_b = (_a = this.eventHandlers).open) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
55
|
+
};
|
|
56
|
+
this.handleMessage = (event) => {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
const data = (0, json_js_1.fromJson)(event.data);
|
|
59
|
+
(_b = (_a = this.eventHandlers).message) === null || _b === void 0 ? void 0 : _b.call(_a, data);
|
|
60
|
+
};
|
|
61
|
+
this.handleClose = (event) => {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
(_b = (_a = this.eventHandlers).close) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
64
|
+
};
|
|
65
|
+
this.handleError = (event) => {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
const message = event.message;
|
|
68
|
+
(_b = (_a = this.eventHandlers).error) === null || _b === void 0 ? void 0 : _b.call(_a, new Error(message));
|
|
69
|
+
};
|
|
70
|
+
this.socket = args.socket;
|
|
71
|
+
this.socket.addEventListener("open", this.handleOpen);
|
|
72
|
+
this.socket.addEventListener("message", this.handleMessage);
|
|
73
|
+
this.socket.addEventListener("close", this.handleClose);
|
|
74
|
+
this.socket.addEventListener("error", this.handleError);
|
|
75
|
+
}
|
|
76
|
+
/** The current state of the connection; this is one of the readyState constants. */
|
|
77
|
+
get readyState() {
|
|
78
|
+
return this.socket.readyState;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @param event - The event to attach to.
|
|
82
|
+
* @param callback - The callback to run when the event is triggered.
|
|
83
|
+
* Usage:
|
|
84
|
+
* ```typescript
|
|
85
|
+
* this.on('open', () => {
|
|
86
|
+
* console.log('The websocket is open');
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
on(event, callback) {
|
|
91
|
+
this.eventHandlers[event] = callback;
|
|
92
|
+
}
|
|
93
|
+
sendRealtimeAudioInput(message) {
|
|
94
|
+
this.assertSocketIsOpen();
|
|
95
|
+
this.sendJson(message);
|
|
96
|
+
}
|
|
97
|
+
sendRealtimeSpeechStart(message) {
|
|
98
|
+
this.assertSocketIsOpen();
|
|
99
|
+
this.sendJson(message);
|
|
100
|
+
}
|
|
101
|
+
sendRealtimeSpeechEnd(message) {
|
|
102
|
+
this.assertSocketIsOpen();
|
|
103
|
+
this.sendJson(message);
|
|
104
|
+
}
|
|
105
|
+
sendRealtimeTurnEnd(message) {
|
|
106
|
+
this.assertSocketIsOpen();
|
|
107
|
+
this.sendJson(message);
|
|
108
|
+
}
|
|
109
|
+
sendRealtimeEnd(message) {
|
|
110
|
+
this.assertSocketIsOpen();
|
|
111
|
+
this.sendJson(message);
|
|
112
|
+
}
|
|
113
|
+
sendRealtimePing(message) {
|
|
114
|
+
this.assertSocketIsOpen();
|
|
115
|
+
this.sendJson(message);
|
|
116
|
+
}
|
|
117
|
+
/** Connect to the websocket and register event handlers. */
|
|
118
|
+
connect() {
|
|
119
|
+
this.socket.reconnect();
|
|
120
|
+
this.socket.addEventListener("open", this.handleOpen);
|
|
121
|
+
this.socket.addEventListener("message", this.handleMessage);
|
|
122
|
+
this.socket.addEventListener("close", this.handleClose);
|
|
123
|
+
this.socket.addEventListener("error", this.handleError);
|
|
124
|
+
return this;
|
|
125
|
+
}
|
|
126
|
+
/** Close the websocket and unregister event handlers. */
|
|
127
|
+
close() {
|
|
128
|
+
this.socket.close();
|
|
129
|
+
this.handleClose({ code: 1000 });
|
|
130
|
+
this.socket.removeEventListener("open", this.handleOpen);
|
|
131
|
+
this.socket.removeEventListener("message", this.handleMessage);
|
|
132
|
+
this.socket.removeEventListener("close", this.handleClose);
|
|
133
|
+
this.socket.removeEventListener("error", this.handleError);
|
|
134
|
+
}
|
|
135
|
+
/** Returns a promise that resolves when the websocket is open. */
|
|
136
|
+
waitForOpen() {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
if (this.socket.readyState === core.ReconnectingWebSocket.OPEN) {
|
|
139
|
+
return this.socket;
|
|
140
|
+
}
|
|
141
|
+
return new Promise((resolve, reject) => {
|
|
142
|
+
this.socket.addEventListener("open", () => {
|
|
143
|
+
resolve(this.socket);
|
|
144
|
+
});
|
|
145
|
+
this.socket.addEventListener("error", (event) => {
|
|
146
|
+
reject(event);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/** Asserts that the websocket is open. */
|
|
152
|
+
assertSocketIsOpen() {
|
|
153
|
+
if (!this.socket) {
|
|
154
|
+
throw new Error("Socket is not connected.");
|
|
155
|
+
}
|
|
156
|
+
if (this.socket.readyState !== core.ReconnectingWebSocket.OPEN) {
|
|
157
|
+
throw new Error("Socket is not open.");
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/** Send a binary payload to the websocket. */
|
|
161
|
+
sendBinary(payload) {
|
|
162
|
+
this.socket.send(payload);
|
|
163
|
+
}
|
|
164
|
+
/** Send a JSON payload to the websocket. */
|
|
165
|
+
sendJson(payload) {
|
|
166
|
+
const jsonPayload = (0, json_js_1.toJson)(payload);
|
|
167
|
+
this.socket.send(jsonPayload);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
exports.SpeechToTextRealtimeStreamingSocket = SpeechToTextRealtimeStreamingSocket;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.SpeechToTextRealtimeStreamingClient = void 0;
|
|
19
|
+
var Client_js_1 = require("./client/Client.js");
|
|
20
|
+
Object.defineProperty(exports, "SpeechToTextRealtimeStreamingClient", { enumerable: true, get: function () { return Client_js_1.SpeechToTextRealtimeStreamingClient; } });
|
|
21
|
+
__exportStar(require("./client/index.js"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./client/index.js"), exports);
|
|
18
|
+
__exportStar(require("./types/index.js"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turn detection strategy.
|
|
3
|
+
*
|
|
4
|
+
* - **vad** (default): Voice Activity Detection automatically detects turn boundaries.
|
|
5
|
+
* - **manual**: The client signals turn boundaries with `speech_start` / `speech_end` events.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SpeechToTextRealtimeStreamingEndpointing: {
|
|
8
|
+
readonly Vad: "vad";
|
|
9
|
+
readonly Manual: "manual";
|
|
10
|
+
};
|
|
11
|
+
export type SpeechToTextRealtimeStreamingEndpointing = (typeof SpeechToTextRealtimeStreamingEndpointing)[keyof typeof SpeechToTextRealtimeStreamingEndpointing];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SpeechToTextRealtimeStreamingEndpointing = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Turn detection strategy.
|
|
7
|
+
*
|
|
8
|
+
* - **vad** (default): Voice Activity Detection automatically detects turn boundaries.
|
|
9
|
+
* - **manual**: The client signals turn boundaries with `speech_start` / `speech_end` events.
|
|
10
|
+
*/
|
|
11
|
+
exports.SpeechToTextRealtimeStreamingEndpointing = {
|
|
12
|
+
Vad: "vad",
|
|
13
|
+
Manual: "manual",
|
|
14
|
+
};
|