sarvam-ai-sdk 0.3.0-beta → 0.4.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/README.md +3 -34
- package/dist/{index.mjs → index.cjs} +215 -310
- package/dist/{index.d.mts → index.d.cts} +84 -169
- package/dist/index.d.ts +84 -169
- package/dist/index.js +188 -337
- package/package.json +12 -9
package/README.md
CHANGED
|
@@ -68,19 +68,6 @@ import { sarvam } from "sarvam-ai-sdk";
|
|
|
68
68
|
import { experimental_transcribe as transcribe } from "ai";
|
|
69
69
|
import { readFile } from "fs/promises";
|
|
70
70
|
|
|
71
|
-
const { text } = await transcribe({
|
|
72
|
-
model: sarvam.transcription("saarika:v2.5", "ml-IN"),
|
|
73
|
-
audio: await readFile("./src/transcript-test.wav"),
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
console.log(text); // പാചകം തുടരും സുഹൃത്തുക്കളെ
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
```ts
|
|
80
|
-
import { sarvam } from "sarvam-ai-sdk";
|
|
81
|
-
import { experimental_transcribe as transcribe } from "ai";
|
|
82
|
-
import { readFile } from "fs/promises";
|
|
83
|
-
|
|
84
71
|
const { text } = await transcribe({
|
|
85
72
|
model: sarvam.transcription("saaras:v3", "en-IN"),
|
|
86
73
|
audio: await readFile("./src/transcript-test.wav"),
|
|
@@ -89,24 +76,9 @@ const { text } = await transcribe({
|
|
|
89
76
|
console.log(text); // Pachakam thudaroo, suhruthukkale.
|
|
90
77
|
```
|
|
91
78
|
|
|
92
|
-
## Speech-to-Text-Translate
|
|
93
|
-
|
|
94
|
-
```ts
|
|
95
|
-
import { sarvam } from "sarvam-ai-sdk";
|
|
96
|
-
import { experimental_transcribe as transcribe } from "ai";
|
|
97
|
-
import { readFile } from "fs/promises";
|
|
98
|
-
|
|
99
|
-
const result = await transcribe({
|
|
100
|
-
model: sarvam.speechTranslation("saaras:v2.5"),
|
|
101
|
-
audio: await readFile("./src/transcript-test.wav"),
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
console.log(result.text); // Cooking continues, my friends
|
|
105
|
-
```
|
|
106
|
-
|
|
107
79
|
## Translation
|
|
108
80
|
|
|
109
|
-
> NB: Only
|
|
81
|
+
> NB: Only translates `prompt` and `role:user` messages, not `role:system` not `role:assistant`.
|
|
110
82
|
|
|
111
83
|
```ts
|
|
112
84
|
import { sarvam } from "sarvam-ai-sdk";
|
|
@@ -232,11 +204,8 @@ sarvam.languageIdentification();
|
|
|
232
204
|
// Text-to-Speech
|
|
233
205
|
sarvam.speech("bulbul:v3", "ml-IN");
|
|
234
206
|
|
|
235
|
-
// Speech-to-Text
|
|
236
|
-
sarvam.transcription("
|
|
237
|
-
|
|
238
|
-
// Speech-to-Text + Translate to English
|
|
239
|
-
sarvam.speechTranslation("saaras:v3");
|
|
207
|
+
// Speech-to-Text
|
|
208
|
+
sarvam.transcription("saaras:v3");
|
|
240
209
|
```
|
|
241
210
|
|
|
242
211
|
|