generaltranslation 1.1.12 → 1.1.13
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 +11 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,12 +64,8 @@ We continually benchmark AI models and add new models as they are released. That
|
|
|
64
64
|
Get the latest list of models for which there is data. Returns an array of model names.
|
|
65
65
|
|
|
66
66
|
```
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
console.log(models) // ['gpt-4', ... ]
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
main();
|
|
67
|
+
const models = await gt.getModelList();
|
|
68
|
+
console.log(models) // ['gpt-4', ... ]
|
|
73
69
|
```
|
|
74
70
|
|
|
75
71
|
### async getModelLanguages(model)
|
|
@@ -77,12 +73,8 @@ main();
|
|
|
77
73
|
Get all languages known to be compatible with a given AI model. Returns an array of languages codes, or null if the model is unknown.
|
|
78
74
|
|
|
79
75
|
```
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
console.log(languages) // ['en', 'fr', 'de', 'es', 'it']
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
main();
|
|
76
|
+
const languages = await gt.getModelLanguages('mixtral-8x7b')
|
|
77
|
+
console.log(languages) // ['en', 'fr', 'de', 'es', 'it']
|
|
86
78
|
```
|
|
87
79
|
|
|
88
80
|
### async isSupportedLanguage(model, code)
|
|
@@ -90,18 +82,16 @@ main();
|
|
|
90
82
|
Returns true if a model is known to be compatible with a given language, represented by an ISO-639 language code. Returns false otherwise.
|
|
91
83
|
|
|
92
84
|
```
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
console.log(supported) // true
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
main();
|
|
85
|
+
const supported = await gt.isSupportedLanguage('gpt-4', 'fr')
|
|
86
|
+
console.log(supported) // true
|
|
99
87
|
```
|
|
100
88
|
|
|
101
89
|
## API
|
|
102
90
|
|
|
103
91
|
For these functions, you need to sign up for an API key at <a href='https://generaltranslation.com' target='_blank'>generaltranslation.com</a>.
|
|
104
92
|
|
|
93
|
+
There's a small, free allowance to let you test out the API without payment information.
|
|
94
|
+
|
|
105
95
|
Add the API key to your code like this:
|
|
106
96
|
|
|
107
97
|
```
|
|
@@ -116,7 +106,9 @@ const gt = new GT({
|
|
|
116
106
|
|
|
117
107
|
Translates prompt into the language represented by an ISO-639 language code. Designed for translating prompts into other languages, to internationalize responses from AI models.
|
|
118
108
|
|
|
119
|
-
Just wrap `gt.getPrompt` around your prompt and go.
|
|
109
|
+
Just wrap `gt.getPrompt` around your prompt and go.
|
|
110
|
+
|
|
111
|
+
All of the following are valid:
|
|
120
112
|
|
|
121
113
|
```
|
|
122
114
|
const translatedPrompt = await gt.getPrompt('Tell me a story', 'es');
|