generaltranslation 1.0.4 → 1.0.6

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 CHANGED
@@ -12,9 +12,9 @@ npm i generaltranslation
12
12
 
13
13
  ## Toolkit
14
14
 
15
- ### getLanguageName
15
+ ### getLanguageName(codes)
16
16
 
17
- Returns a language name from a two or three-letter ISO 639 language code.
17
+ Returns a language name from a two or three-letter ISO-639 language code, or an array of codes.
18
18
 
19
19
  ```
20
20
  import { getLanguageName } from 'generaltranslation'
@@ -22,8 +22,48 @@ import { getLanguageName } from 'generaltranslation'
22
22
  const language = getLanguageName('en');
23
23
  console.log(language) // 'English'
24
24
 
25
- const otherLanguage = getLanguageName('spa') // 'spa' is equivalent to 'es'
26
- console.log(otherLanguage) // 'Spanish'
25
+ const languages = getLanguageName(['fr', 'es'])
26
+ console.log(languages) // ['French', 'Spanish']
27
+ ```
28
+
29
+ ### getLanguageCode(languages)
30
+
31
+ Returns an ISO-639 code from a language name or an array of language names.
32
+
33
+ ```
34
+ import { getLanguageCode } from 'generaltranslation'
35
+
36
+ const code = getLanguageCode('English');
37
+ console.log(language) // 'en'
38
+
39
+ const codes = getLanguageCodes(['French', 'Spanish'])
40
+ console.log(codes) // ['fr', 'es']
41
+ ```
42
+
43
+ ### getModelLanguages(model)
44
+
45
+ <i>in beta!</i>
46
+
47
+ Get all languages known to be compatible with a given LLM. Returns an array of languages codes, [] if the model is unknown.
48
+
49
+ ```
50
+ import { getModelLanguages } from 'generaltranslation'
51
+
52
+ const languages = getModelLanguages('mixtral-8x7b')
53
+ console.log(languages) // ['en', 'fr', 'de', 'es', 'it']
54
+ ```
55
+
56
+ ### isSupportedLanguage(model, language)
57
+
58
+ <i>in beta!</i>
59
+
60
+ Returns true if a model is known to be compatible with a given language, represented by an ISO-639 language code. Returns false otherwise.
61
+
62
+ ```
63
+ import { isSupportedLanguage } from 'generaltranslation'
64
+
65
+ const supported = isSupportedLanguage('gpt-4', 'fr')
66
+ console.log(supported) // true
27
67
  ```
28
68
 
29
69
  ## API
@@ -5,6 +5,7 @@
5
5
  "gpt-4-0125-preview": "gpt-4",
6
6
  "gpt-4-vision-preview": "gpt-4",
7
7
  "gpt-4-turbo-preview": "gpt-4",
8
+ "gpt-4-turbo": "gpt-4",
8
9
  "gpt-3.5-turbo": "gpt-3.5-turbo",
9
10
  "gpt-3.5-turbo-16k": "gpt-3.5-turbo",
10
11
  "gpt-3.5-turbo-16k-0613": "gpt-3.5-turbo",
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "gpt-4": {
3
3
  "languages": [
4
- "en", "fr", "de", "es", "it",
5
- "zh", "ja", "ko",
6
- "grc", "la"
7
- ]
4
+ "ja", "af", "ko", "grc", "la", "ar", "lv", "zh", "pl", "en", "ru",
5
+ "fr", "es", "de", "sw", "el", "tr", "is", "uk", "id", "cy", "it"
6
+ ]
8
7
  },
9
8
  "gpt-3.5-turbo": {
10
9
  "languages": [
package/models/models.js CHANGED
@@ -19,7 +19,7 @@ const getModelLanguages = model => {
19
19
  return getModelInfo(model)?.languages || [];
20
20
  }
21
21
 
22
- // Returns true if a model is rated for a language
22
+ // Returns true if a model is known to be compatible with a language
23
23
  // Returns false otherwise
24
24
  const isLanguageSupported = (model, code) => {
25
25
  return getModelLanguages(model)?.includes(language);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generaltranslation",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "A language toolkit for AI developers",
5
5
  "main": "index.js",
6
6
  "scripts": {