sarvam-ai-sdk 0.1.4 → 0.1.5-beta
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 +9 -8
- package/dist/index.d.mts +464 -349
- package/dist/index.d.ts +464 -349
- package/dist/index.js +1338 -1464
- package/dist/index.mjs +1318 -1486
- package/package.json +21 -18
- package/CHANGELOG.md +0 -7
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# Package
|
|
1
2
|
# AI SDK - Sarvam Provider
|
|
2
3
|
|
|
3
4
|
The **[Sarvam provider](https://v4.ai-sdk.dev/providers/ai-sdk-providers/sarvam)** for the [AI SDK](https://v4.ai-sdk.dev/docs)
|
|
@@ -8,7 +9,7 @@ contains language model support for the Sarvam chat completion, Text-to-Speech a
|
|
|
8
9
|
The **[Sarvam](http://sarvam.ai)** provider is available in the `sarvam-ai-sdk` module. You can install it with
|
|
9
10
|
|
|
10
11
|
```bash
|
|
11
|
-
npm i sarvam-ai-sdk
|
|
12
|
+
npm i sarvam-ai-sdk ai@4
|
|
12
13
|
```
|
|
13
14
|
|
|
14
15
|
> [!WARNING]
|
|
@@ -102,14 +103,14 @@ console.log(result.text); // Cooking continues, my friends
|
|
|
102
103
|
|
|
103
104
|
## Translation
|
|
104
105
|
|
|
105
|
-
> NB: Only transliterates `prompt` and `role:user` messages, not `system` not `assistant`.
|
|
106
|
+
> NB: Only transliterates `prompt` and `role:user` messages, not `role:system` not `role:assistant`.
|
|
106
107
|
|
|
107
108
|
```ts
|
|
108
109
|
import { sarvam } from "sarvam-ai-sdk";
|
|
109
110
|
import { generateText } from "ai";
|
|
110
111
|
|
|
111
112
|
const result = await generateText({
|
|
112
|
-
|
|
113
|
+
model: sarvam.translation("mayura:v1", {
|
|
113
114
|
"from": "ml-IN",
|
|
114
115
|
"to": "en-IN",
|
|
115
116
|
}),
|
|
@@ -121,7 +122,7 @@ console.log(result.text); // Shouldn't we be careful about this, Ambane?
|
|
|
121
122
|
|
|
122
123
|
## Transliterate
|
|
123
124
|
|
|
124
|
-
> NB: Only transliterates `prompt` and `role:user` messages, not `system` not `assistant`.
|
|
125
|
+
> NB: Only transliterates `prompt` and `role:user` messages, not `role:system` not `role:assistant`.
|
|
125
126
|
|
|
126
127
|
```ts
|
|
127
128
|
import { sarvam } from "sarvam-ai-sdk";
|
|
@@ -129,8 +130,8 @@ import { generateText } from "ai";
|
|
|
129
130
|
|
|
130
131
|
const result = await generateText({
|
|
131
132
|
model: sarvam.transliterate({
|
|
132
|
-
from: "en-IN",
|
|
133
133
|
to: "ml-IN",
|
|
134
|
+
from: "en-IN", // optional
|
|
134
135
|
}),
|
|
135
136
|
prompt: "eda mone, happy alle?",
|
|
136
137
|
});
|
|
@@ -140,7 +141,7 @@ console.log(result.text); // എടാ മോനെ, ഹാപ്പി അല
|
|
|
140
141
|
|
|
141
142
|
## Language Identification
|
|
142
143
|
|
|
143
|
-
> NB: Only identifies `prompt` and `role:user` messages, not `system` not `assistant`.
|
|
144
|
+
> NB: Only identifies `prompt` and `role:user` messages, not `role:system` not `role:assistant`.
|
|
144
145
|
|
|
145
146
|
```ts
|
|
146
147
|
import { sarvam } from "sarvam-ai-sdk";
|
|
@@ -221,10 +222,10 @@ sarvam("sarvam-105b");
|
|
|
221
222
|
sarvam.languageModel("sarvam-30b");
|
|
222
223
|
|
|
223
224
|
// Text-to-Text + Transliteration
|
|
224
|
-
sarvam.transliterate({
|
|
225
|
+
sarvam.transliterate({ to: "ml-IN", from: "en-IN" });
|
|
225
226
|
|
|
226
227
|
// Text-to-Text + Translation
|
|
227
|
-
sarvam.translation({ from: "en-IN", to: "ml-IN" });
|
|
228
|
+
sarvam.translation("mayura:v1", { from: "en-IN", to: "ml-IN" });
|
|
228
229
|
|
|
229
230
|
// Text-to-Text + Language identification
|
|
230
231
|
sarvam.languageIdentification();
|