@gringow/gringow 0.1.3 → 0.1.4

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
@@ -1,6 +1,18 @@
1
1
  # @gringow/gringow
2
2
 
3
- Core library for Gringow to translate strings and template strings using different LLM providers.
3
+ [![npm version](https://img.shields.io/npm/v/@gringow/gringow)](https://www.npmjs.com/package/@gringow/gringow)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ AI-powered translation library for template strings using multiple LLM providers (Hugging Face, Anthropic, Gemini). Gringow provides smart caching, deterministic content hashing, and seamless integration for modern JavaScript/TypeScript projects.
7
+
8
+ ## Features
9
+
10
+ - 🌍 **Multi-language translation** using LLM providers
11
+ - 🏷️ **Tagged template literal** syntax for inline translations
12
+ - 💾 **Smart caching** with content-based hashing
13
+ - 🔌 **Three LLM providers**: Hugging Face (local), Anthropic, Gemini
14
+ - 🚀 **Zero configuration** - works out of the box with Hugging Face
15
+ - 📦 **Optimized builds** via Vite/Next.js plugins
4
16
 
5
17
  ## Installation
6
18
 
@@ -12,45 +24,90 @@ pnpm add @gringow/gringow
12
24
  yarn add @gringow/gringow
13
25
  ```
14
26
 
15
- ## Usage
27
+ ## Quick Start
16
28
 
17
29
  ```typescript
18
- import Gringow, { rebuild } from '@gringow/gringow'
30
+ import Gringow from '@gringow/gringow'
19
31
 
20
32
  // Simple string translation
21
33
  const { cacheId, translation } = await Gringow`Hello world`
22
- console.log(cacheId) // deterministic cache ID created from the flattened string
23
- console.log(translation.translation) // { "pt-BR": "Olá mundo", "fr-CA": "Bonjour le monde" }
34
+ console.log(translation.translation)
35
+ // => { "pt-BR": "Olá mundo", "fr-CA": "Bonjour le monde" }
24
36
 
25
- // Template string translation (values are flattened before hashing)
37
+ // Template string with dynamic values
26
38
  const name = 'John'
27
- const { translation: hiJohn } = await Gringow`Hello ${name}`
28
- console.log(hiJohn.translation) // { "pt-BR": "Olá John", "fr-CA": "Bonjour John" }
39
+ const { translation: result } = await Gringow`Welcome, ${name}!`
40
+ console.log(result.translation)
41
+ // => { "pt-BR": "Bem-vindo, John!", "fr-CA": "Bienvenue, John!" }
42
+ ```
43
+
44
+ ## Usage Examples
29
45
 
30
- // Re-run an existing cache entry against the configured LLM
46
+ ### Basic Translation
47
+
48
+ ```typescript
49
+ import Gringow from '@gringow/gringow'
50
+
51
+ // Translate a static string
52
+ const { translation } = await Gringow`Hello world`
53
+ console.log(translation.translation['pt-BR']) // "Olá mundo"
54
+ ```
55
+
56
+ ### Dynamic Content
57
+
58
+ ```typescript
59
+ // Template literals are flattened before hashing - dynamic values preserved
60
+ const user = { name: 'Alice', role: 'admin' }
61
+ const { translation } = await Gringow`User ${user.name} has ${user.role} privileges`
62
+
63
+ console.log(translation.translation['pt-BR'])
64
+ // => "Usuário Alice tem privilégios de admin"
65
+ ```
66
+
67
+ ### Cache Management
68
+
69
+ ```typescript
70
+ import Gringow, { rebuild, checkCache } from '@gringow/gringow'
71
+
72
+ const { cacheId } = await Gringow`Hello world`
73
+
74
+ // Check if translation exists in cache
75
+ const cached = await checkCache(cacheId)
76
+ console.log(cached) // GringowCacheItem or undefined
77
+
78
+ // Force re-translation by rebuilding cache entry
31
79
  const refreshed = await rebuild(cacheId)
32
80
  console.log(refreshed.translation.translation)
33
81
  ```
34
82
 
35
- Gringow always returns a `{ cacheId, translation }` object. The `translation` payload can include optional
36
- `prepend`/`append` strings when you use custom prompts.
83
+ ### Browser Usage
84
+
85
+ For client-side interpolation without Node.js dependencies:
86
+
87
+ ```typescript
88
+ import { interpolateTemplate } from '@gringow/gringow/browser'
89
+
90
+ const template = 'Hello {name}, you have {count} messages'
91
+ const result = interpolateTemplate(template, { name: 'Alice', count: 5 })
92
+ console.log(result) // "Hello Alice, you have 5 messages"
93
+ ```
37
94
 
38
95
  ## Configuration
39
96
 
40
- Gringow loads configuration via `cosmiconfig` using the `gringow` namespace. You can place any of the supported
41
- formats in your project root (e.g. `gringow.config.js`, `gringow.config.mjs`, `gringow.config.json`). Missing fields
42
- are merged with the defaults below and validated with Zod.
97
+ Gringow uses [cosmiconfig](https://github.com/cosmiconfig/cosmiconfig) to load configuration from your project root. Supported formats: `gringow.config.js`, `gringow.config.mjs`, `gringow.config.json`, or a `gringow` field in `package.json`.
98
+
99
+ ### Default Configuration
43
100
 
44
101
  ```js
45
102
  // gringow.config.js
46
103
  export default {
47
104
  debug: false,
48
- log: { level: 'debug' },
105
+ log: { level: 'info' },
49
106
  cache: {
50
107
  dir: './gringow',
51
108
  file: 'gringow.json',
52
109
  prefix: 'grw',
53
- write: true, // set to false to skip writing to disk
110
+ write: true,
54
111
  },
55
112
  keys: {
56
113
  anthropicApiKey: process.env.ANTHROPIC_API_KEY,
@@ -63,35 +120,171 @@ export default {
63
120
  model: 'Xenova/nllb-200-distilled-600M',
64
121
  temperature: 1.0,
65
122
  sleep: 0,
66
- // Prompt shaping (all optional)
67
- prePrompt: undefined,
68
- postPrompt: undefined,
69
- prePromptAppend: undefined,
70
- postPromptPrepend: undefined,
71
- prePromptReplace: undefined,
72
- postPromptReplace: undefined,
73
123
  },
74
- // Files scanned by the Vite/Next.js plugins when building caches
75
124
  globby: './src/**/*.{js,jsx,ts,tsx}',
76
125
  }
77
126
  ```
78
127
 
79
- > For `anthropic` or `gemini`, the corresponding API key **must** be present or config validation will fail.
128
+ ### Example: Using Gemini
129
+
130
+ ```js
131
+ // gringow.config.js
132
+ export default {
133
+ keys: {
134
+ geminiApiKey: process.env.GEMINI_API_KEY,
135
+ },
136
+ llm: {
137
+ choice: 'gemini',
138
+ model: 'gemini-2.0-flash',
139
+ prePromptAppend: 'Please respond in a friendly tone.',
140
+ },
141
+ languages: ['es-ES', 'de-DE', 'ja-JP'],
142
+ }
143
+ ```
144
+
145
+ ### Example: Using Anthropic
146
+
147
+ ```js
148
+ // gringow.config.js
149
+ export default {
150
+ keys: {
151
+ anthropicApiKey: process.env.ANTHROPIC_API_KEY,
152
+ },
153
+ llm: {
154
+ choice: 'anthropic',
155
+ model: 'claude-3-5-sonnet-20241022',
156
+ temperature: 0.7,
157
+ },
158
+ }
159
+ ```
160
+
161
+ ### Prompt Customization
162
+
163
+ Fine-tune LLM behavior with prompt options:
164
+
165
+ ```js
166
+ export default {
167
+ llm: {
168
+ choice: 'huggingface',
169
+ prePrompt: 'Translate the following text:', // Default prompt prefix
170
+ postPrompt: 'Ensure translations are natural.', // Additional context
171
+ prePromptAppend: 'Use formal language.', // Appended to pre-prompt
172
+ postPromptPrepend: 'Maintain original formatting.', // Prepended to post-prompt
173
+ prePromptReplace: 'Custom instruction here', // Replaces entire pre-prompt
174
+ },
175
+ }
176
+ ```
80
177
 
81
178
  ## LLM Providers
82
179
 
83
- - **Hugging Face** (default): Runs local models, no API key required.
84
- - **Anthropic**: Requires `keys.anthropicApiKey`.
85
- - **Gemini**: Requires `keys.geminiApiKey`.
180
+ ### Hugging Face (Default)
86
181
 
87
- ## API surface
182
+ Runs local models via `@huggingface/transformers`. **No API key required.**
183
+
184
+ ```js
185
+ // gringow.config.js
186
+ export default {
187
+ llm: {
188
+ choice: 'huggingface',
189
+ model: 'Xenova/nllb-200-distilled-600M', // Multilingual translation model
190
+ },
191
+ }
192
+ ```
88
193
 
89
- - `default export Gringow(strings, ...values)` — translate a string or tagged template. Returns a `Promise<GringowResponse>`.
90
- - `rebuild(cacheId)` — re-asks the configured LLM for a cached entry and writes it back when `cache.write` is true.
91
- - Cache helpers: `checkCache`, `getCache`, `getOrCreateCache`, `writeCacheToDisk`, `deleteCacheItem`, `clearCache`.
92
- - Utilities: `createCacheId`, `flatTemplateString`, `interpolateTemplate` (browser build), `awaitedConfig`, `isLocalConfigFound`, `getConfigSource`.
194
+ **Pros**: Free, private, offline-capable
195
+ **Cons**: Slower first run (model download), higher memory usage
93
196
 
94
- ```ts
197
+ ### Anthropic
198
+
199
+ Uses Claude models via Anthropic API. **Requires API key.**
200
+
201
+ ```js
202
+ // gringow.config.js
203
+ export default {
204
+ keys: {
205
+ anthropicApiKey: process.env.ANTHROPIC_API_KEY,
206
+ },
207
+ llm: {
208
+ choice: 'anthropic',
209
+ model: 'claude-3-5-sonnet-20241022',
210
+ },
211
+ }
212
+ ```
213
+
214
+ **Pros**: High-quality translations, fast
215
+ **Cons**: API costs, requires internet
216
+
217
+ ### Gemini
218
+
219
+ Uses Google's Gemini models. **Requires API key.**
220
+
221
+ ```js
222
+ // gringow.config.js
223
+ export default {
224
+ keys: {
225
+ geminiApiKey: process.env.GEMINI_API_KEY,
226
+ },
227
+ llm: {
228
+ choice: 'gemini',
229
+ model: 'gemini-2.0-flash',
230
+ },
231
+ }
232
+ ```
233
+
234
+ **Pros**: Fast, cost-effective
235
+ **Cons**: API costs, requires internet
236
+
237
+ ## API Reference
238
+
239
+ ### Core Functions
240
+
241
+ #### `Gringow(strings, ...values): Promise<GringowResponse>`
242
+
243
+ Main translation function. Accepts tagged template literals or plain strings.
244
+
245
+ ```typescript
246
+ const result = await Gringow`Hello ${name}`
247
+ ```
248
+
249
+ **Returns**: `Promise<GringowResponse>` with `{ cacheId, translation }`
250
+
251
+ #### `rebuild(cacheId: string): Promise<GringowResponse>`
252
+
253
+ Re-translates a cached entry using the current LLM configuration.
254
+
255
+ ```typescript
256
+ const refreshed = await rebuild('grw_abc123')
257
+ ```
258
+
259
+ ### Cache Helpers
260
+
261
+ ```typescript
262
+ import {
263
+ checkCache, // Check if cacheId exists
264
+ getCache, // Get entire cache object
265
+ getOrCreateCache,// Get cache or create empty one
266
+ writeCacheToDisk,// Manually write cache entry
267
+ deleteCacheItem, // Remove cache entry
268
+ clearCache, // Clear all cache entries
269
+ } from '@gringow/gringow'
270
+ ```
271
+
272
+ ### Utilities
273
+
274
+ ```typescript
275
+ import {
276
+ createCacheId, // Generate cache ID from string
277
+ flatTemplateString, // Flatten template literal to string
278
+ interpolateTemplate, // Browser-safe interpolation (from /browser export)
279
+ awaitedConfig, // Access resolved configuration
280
+ isLocalConfigFound, // Check if local config exists
281
+ getConfigSource, // Get config file path
282
+ } from '@gringow/gringow'
283
+ ```
284
+
285
+ ### Type Definitions
286
+
287
+ ```typescript
95
288
  type GringowTranslation = Record<string, string>
96
289
 
97
290
  type GringowCacheItem = {
@@ -108,22 +301,65 @@ type GringowResponse = {
108
301
  }
109
302
  ```
110
303
 
304
+ ## How It Works
305
+
306
+ 1. **Input Processing**: Template strings are flattened to plain text (preserving dynamic values)
307
+ 2. **Cache ID Generation**: Content-based hash created using `createCacheId()`
308
+ 3. **Cache Lookup**: Check `./gringow/gringow.json` for existing translation
309
+ 4. **LLM Query**: If not cached, request translation from configured provider
310
+ 5. **Response Parsing**: Parse provider response to `GringowCacheItem` format
311
+ 6. **Cache Storage**: Write to disk when `cache.write` is `true`
312
+
313
+ **Example cache structure:**
314
+
315
+ ```json
316
+ {
317
+ "grw_a1b2c3": {
318
+ "original": "Hello world",
319
+ "translation": {
320
+ "pt-BR": "Olá mundo",
321
+ "fr-CA": "Bonjour le monde"
322
+ }
323
+ }
324
+ }
325
+ ```
326
+
111
327
  ## Development
112
328
 
113
329
  ```bash
330
+ # Install dependencies
114
331
  pnpm install
115
- pnpm run build # builds the package
116
- pnpm run test # vitest suite
332
+
333
+ # Build the package
334
+ pnpm run build
335
+
336
+ # Run tests
337
+ pnpm run test
338
+
339
+ # Watch mode
340
+ pnpm run test:watch
117
341
  ```
118
342
 
343
+ ## Integrations
344
+
345
+ Gringow has official integrations for modern web frameworks:
346
+
347
+ - **[@gringow/cli](https://www.npmjs.com/package/@gringow/gringow-cli)** - Command-line interface for cache management and translations
348
+ - **[@gringow/gringow-vite](https://www.npmjs.com/package/@gringow/gringow-vite)** - Vite plugin for build-time translation extraction
349
+ - **[@gringow/gringow-react](https://www.npmjs.com/package/@gringow/gringow-react)** - React hooks and components
350
+ - **[@gringow/gringow-shadow](https://www.npmjs.com/package/@gringow/gringow-shadow)** - Web Component layer (vanilla JS)
351
+ - **[@gringow/gringow-nextjs](https://www.npmjs.com/package/@gringow/gringow-nextjs)** - Next.js plugin (experimental)
352
+
353
+ ## Related Resources
354
+
355
+ - [Documentation](https://gringow.dev)
356
+ - [GitHub Repository](https://github.com/rntgspr/gringow)
357
+ - [Examples](https://github.com/rntgspr/gringow/tree/main/example-gringow-vite)
358
+
119
359
  ## License
120
360
 
121
- MIT
361
+ MIT © [Renato Gaspar](https://github.com/rntgspr)
122
362
 
123
- ## Related Packages (npm)
363
+ ---
124
364
 
125
- - [@gringow/gringow-cli](https://www.npmjs.com/package/@gringow/gringow-cli) - Command-line interface
126
- - [@gringow/gringow-shadow](https://www.npmjs.com/package/@gringow/gringow-shadow) - Web Component layer powering the React bindings
127
- - [@gringow/gringow-react](https://www.npmjs.com/package/@gringow/gringow-react) - React bindings
128
- - [@gringow/gringow-vite](https://www.npmjs.com/package/@gringow/gringow-vite) - Vite plugin
129
- - [@gringow/gringow-nextjs](https://www.npmjs.com/package/@gringow/gringow-nextjs) - Experimental Next.js plugin
365
+ **Questions or Issues?** Open an issue on [GitHub](https://github.com/rntgspr/gringow/issues)
package/dist/config.d.mts CHANGED
@@ -40,6 +40,7 @@ declare const awaitedConfig: Promise<{
40
40
  write?: boolean | undefined;
41
41
  };
42
42
  sourceLanguage: string;
43
+ defaultLanguage: string;
43
44
  languages: string[];
44
45
  llm: {
45
46
  choice: "gemini" | "anthropic" | "huggingface";
package/dist/config.mjs CHANGED
@@ -18,6 +18,7 @@ var defaultConfig = {
18
18
  },
19
19
  keys: {},
20
20
  sourceLanguage: "en-US",
21
+ defaultLanguage: "pt-BR",
21
22
  languages: ["pt-BR", "fr-CA"],
22
23
  llm: {
23
24
  choice: "huggingface",
@@ -45,6 +46,7 @@ var configSchema = z.object({
45
46
  geminiApiKey: z.string().optional()
46
47
  }),
47
48
  sourceLanguage: languageSchema,
49
+ defaultLanguage: languageSchema,
48
50
  languages: z.array(languageSchema),
49
51
  llm: z.object({
50
52
  choice: llmOptionsSchema,
@@ -18135,6 +18135,7 @@ var defaultConfig = {
18135
18135
  },
18136
18136
  keys: {},
18137
18137
  sourceLanguage: "en-US",
18138
+ defaultLanguage: "pt-BR",
18138
18139
  languages: ["pt-BR", "fr-CA"],
18139
18140
  llm: {
18140
18141
  choice: "huggingface",
@@ -18162,6 +18163,7 @@ var configSchema = z.object({
18162
18163
  geminiApiKey: z.string().optional()
18163
18164
  }),
18164
18165
  sourceLanguage: languageSchema,
18166
+ defaultLanguage: languageSchema,
18165
18167
  languages: z.array(languageSchema),
18166
18168
  llm: z.object({
18167
18169
  choice: llmOptionsSchema,
@@ -12,6 +12,7 @@ var defaultConfig = {
12
12
  },
13
13
  keys: {},
14
14
  sourceLanguage: "en-US",
15
+ defaultLanguage: "pt-BR",
15
16
  languages: ["pt-BR", "fr-CA"],
16
17
  llm: {
17
18
  choice: "huggingface",
@@ -21,6 +21,7 @@ var defaultConfig = {
21
21
  },
22
22
  keys: {},
23
23
  sourceLanguage: "en-US",
24
+ defaultLanguage: "pt-BR",
24
25
  languages: ["pt-BR", "fr-CA"],
25
26
  llm: {
26
27
  choice: "huggingface",
@@ -48,6 +49,7 @@ var configSchema = z.object({
48
49
  geminiApiKey: z.string().optional()
49
50
  }),
50
51
  sourceLanguage: languageSchema,
52
+ defaultLanguage: languageSchema,
51
53
  languages: z.array(languageSchema),
52
54
  llm: z.object({
53
55
  choice: llmOptionsSchema,
@@ -21,6 +21,7 @@ var defaultConfig = {
21
21
  },
22
22
  keys: {},
23
23
  sourceLanguage: "en-US",
24
+ defaultLanguage: "pt-BR",
24
25
  languages: ["pt-BR", "fr-CA"],
25
26
  llm: {
26
27
  choice: "huggingface",
@@ -48,6 +49,7 @@ var configSchema = z.object({
48
49
  geminiApiKey: z.string().optional()
49
50
  }),
50
51
  sourceLanguage: languageSchema,
52
+ defaultLanguage: languageSchema,
51
53
  languages: z.array(languageSchema),
52
54
  llm: z.object({
53
55
  choice: llmOptionsSchema,
@@ -225,6 +225,7 @@ var defaultConfig = {
225
225
  },
226
226
  keys: {},
227
227
  sourceLanguage: "en-US",
228
+ defaultLanguage: "pt-BR",
228
229
  languages: ["pt-BR", "fr-CA"],
229
230
  llm: {
230
231
  choice: "huggingface",
@@ -252,6 +253,7 @@ var configSchema = z.object({
252
253
  geminiApiKey: z.string().optional()
253
254
  }),
254
255
  sourceLanguage: languageSchema,
256
+ defaultLanguage: languageSchema,
255
257
  languages: z.array(languageSchema),
256
258
  llm: z.object({
257
259
  choice: llmOptionsSchema,
@@ -21,6 +21,7 @@ var defaultConfig = {
21
21
  },
22
22
  keys: {},
23
23
  sourceLanguage: "en-US",
24
+ defaultLanguage: "pt-BR",
24
25
  languages: ["pt-BR", "fr-CA"],
25
26
  llm: {
26
27
  choice: "huggingface",
@@ -48,6 +49,7 @@ var configSchema = z.object({
48
49
  geminiApiKey: z.string().optional()
49
50
  }),
50
51
  sourceLanguage: languageSchema,
52
+ defaultLanguage: languageSchema,
51
53
  languages: z.array(languageSchema),
52
54
  llm: z.object({
53
55
  choice: llmOptionsSchema,
@@ -21,6 +21,7 @@ var defaultConfig = {
21
21
  },
22
22
  keys: {},
23
23
  sourceLanguage: "en-US",
24
+ defaultLanguage: "pt-BR",
24
25
  languages: ["pt-BR", "fr-CA"],
25
26
  llm: {
26
27
  choice: "huggingface",
@@ -48,6 +49,7 @@ var configSchema = z.object({
48
49
  geminiApiKey: z.string().optional()
49
50
  }),
50
51
  sourceLanguage: languageSchema,
52
+ defaultLanguage: languageSchema,
51
53
  languages: z.array(languageSchema),
52
54
  llm: z.object({
53
55
  choice: llmOptionsSchema,
@@ -21,6 +21,7 @@ var defaultConfig = {
21
21
  },
22
22
  keys: {},
23
23
  sourceLanguage: "en-US",
24
+ defaultLanguage: "pt-BR",
24
25
  languages: ["pt-BR", "fr-CA"],
25
26
  llm: {
26
27
  choice: "huggingface",
@@ -48,6 +49,7 @@ var configSchema = z.object({
48
49
  geminiApiKey: z.string().optional()
49
50
  }),
50
51
  sourceLanguage: languageSchema,
52
+ defaultLanguage: languageSchema,
51
53
  languages: z.array(languageSchema),
52
54
  llm: z.object({
53
55
  choice: llmOptionsSchema,
@@ -21,6 +21,7 @@ var defaultConfig = {
21
21
  },
22
22
  keys: {},
23
23
  sourceLanguage: "en-US",
24
+ defaultLanguage: "pt-BR",
24
25
  languages: ["pt-BR", "fr-CA"],
25
26
  llm: {
26
27
  choice: "huggingface",
@@ -48,6 +49,7 @@ var configSchema = z.object({
48
49
  geminiApiKey: z.string().optional()
49
50
  }),
50
51
  sourceLanguage: languageSchema,
52
+ defaultLanguage: languageSchema,
51
53
  languages: z.array(languageSchema),
52
54
  llm: z.object({
53
55
  choice: llmOptionsSchema,
@@ -21,6 +21,7 @@ var defaultConfig = {
21
21
  },
22
22
  keys: {},
23
23
  sourceLanguage: "en-US",
24
+ defaultLanguage: "pt-BR",
24
25
  languages: ["pt-BR", "fr-CA"],
25
26
  llm: {
26
27
  choice: "huggingface",
@@ -48,6 +49,7 @@ var configSchema = z.object({
48
49
  geminiApiKey: z.string().optional()
49
50
  }),
50
51
  sourceLanguage: languageSchema,
52
+ defaultLanguage: languageSchema,
51
53
  languages: z.array(languageSchema),
52
54
  llm: z.object({
53
55
  choice: llmOptionsSchema,
package/dist/gringow.mjs CHANGED
@@ -24,6 +24,7 @@ var defaultConfig = {
24
24
  },
25
25
  keys: {},
26
26
  sourceLanguage: "en-US",
27
+ defaultLanguage: "pt-BR",
27
28
  languages: ["pt-BR", "fr-CA"],
28
29
  llm: {
29
30
  choice: "huggingface",
@@ -51,6 +52,7 @@ var configSchema = z.object({
51
52
  geminiApiKey: z.string().optional()
52
53
  }),
53
54
  sourceLanguage: languageSchema,
55
+ defaultLanguage: languageSchema,
54
56
  languages: z.array(languageSchema),
55
57
  llm: z.object({
56
58
  choice: llmOptionsSchema,
package/dist/index.mjs CHANGED
@@ -24,6 +24,7 @@ var defaultConfig = {
24
24
  },
25
25
  keys: {},
26
26
  sourceLanguage: "en-US",
27
+ defaultLanguage: "pt-BR",
27
28
  languages: ["pt-BR", "fr-CA"],
28
29
  llm: {
29
30
  choice: "huggingface",
@@ -51,6 +52,7 @@ var configSchema = z.object({
51
52
  geminiApiKey: z.string().optional()
52
53
  }),
53
54
  sourceLanguage: languageSchema,
55
+ defaultLanguage: languageSchema,
54
56
  languages: z.array(languageSchema),
55
57
  llm: z.object({
56
58
  choice: llmOptionsSchema,
@@ -19,6 +19,7 @@ var defaultConfig = {
19
19
  },
20
20
  keys: {},
21
21
  sourceLanguage: "en-US",
22
+ defaultLanguage: "pt-BR",
22
23
  languages: ["pt-BR", "fr-CA"],
23
24
  llm: {
24
25
  choice: "huggingface",
@@ -46,6 +47,7 @@ var configSchema = z.object({
46
47
  geminiApiKey: z.string().optional()
47
48
  }),
48
49
  sourceLanguage: languageSchema,
50
+ defaultLanguage: languageSchema,
49
51
  languages: z.array(languageSchema),
50
52
  llm: z.object({
51
53
  choice: llmOptionsSchema,
@@ -19,6 +19,7 @@ var defaultConfig = {
19
19
  },
20
20
  keys: {},
21
21
  sourceLanguage: "en-US",
22
+ defaultLanguage: "pt-BR",
22
23
  languages: ["pt-BR", "fr-CA"],
23
24
  llm: {
24
25
  choice: "huggingface",
@@ -46,6 +47,7 @@ var configSchema = z.object({
46
47
  geminiApiKey: z.string().optional()
47
48
  }),
48
49
  sourceLanguage: languageSchema,
50
+ defaultLanguage: languageSchema,
49
51
  languages: z.array(languageSchema),
50
52
  llm: z.object({
51
53
  choice: llmOptionsSchema,
@@ -22,6 +22,7 @@ var defaultConfig = {
22
22
  },
23
23
  keys: {},
24
24
  sourceLanguage: "en-US",
25
+ defaultLanguage: "pt-BR",
25
26
  languages: ["pt-BR", "fr-CA"],
26
27
  llm: {
27
28
  choice: "huggingface",
@@ -49,6 +50,7 @@ var configSchema = z.object({
49
50
  geminiApiKey: z.string().optional()
50
51
  }),
51
52
  sourceLanguage: languageSchema,
53
+ defaultLanguage: languageSchema,
52
54
  languages: z.array(languageSchema),
53
55
  llm: z.object({
54
56
  choice: llmOptionsSchema,
@@ -19,6 +19,7 @@ var defaultConfig = {
19
19
  },
20
20
  keys: {},
21
21
  sourceLanguage: "en-US",
22
+ defaultLanguage: "pt-BR",
22
23
  languages: ["pt-BR", "fr-CA"],
23
24
  llm: {
24
25
  choice: "huggingface",
@@ -46,6 +47,7 @@ var configSchema = z.object({
46
47
  geminiApiKey: z.string().optional()
47
48
  }),
48
49
  sourceLanguage: languageSchema,
50
+ defaultLanguage: languageSchema,
49
51
  languages: z.array(languageSchema),
50
52
  llm: z.object({
51
53
  choice: llmOptionsSchema,
@@ -19,6 +19,7 @@ var defaultConfig = {
19
19
  },
20
20
  keys: {},
21
21
  sourceLanguage: "en-US",
22
+ defaultLanguage: "pt-BR",
22
23
  languages: ["pt-BR", "fr-CA"],
23
24
  llm: {
24
25
  choice: "huggingface",
@@ -46,6 +47,7 @@ var configSchema = z.object({
46
47
  geminiApiKey: z.string().optional()
47
48
  }),
48
49
  sourceLanguage: languageSchema,
50
+ defaultLanguage: languageSchema,
49
51
  languages: z.array(languageSchema),
50
52
  llm: z.object({
51
53
  choice: llmOptionsSchema,
@@ -20,6 +20,7 @@ var defaultConfig = {
20
20
  },
21
21
  keys: {},
22
22
  sourceLanguage: "en-US",
23
+ defaultLanguage: "pt-BR",
23
24
  languages: ["pt-BR", "fr-CA"],
24
25
  llm: {
25
26
  choice: "huggingface",
@@ -47,6 +48,7 @@ var configSchema = z.object({
47
48
  geminiApiKey: z.string().optional()
48
49
  }),
49
50
  sourceLanguage: languageSchema,
51
+ defaultLanguage: languageSchema,
50
52
  languages: z.array(languageSchema),
51
53
  llm: z.object({
52
54
  choice: llmOptionsSchema,
@@ -20,6 +20,7 @@ var defaultConfig = {
20
20
  },
21
21
  keys: {},
22
22
  sourceLanguage: "en-US",
23
+ defaultLanguage: "pt-BR",
23
24
  languages: ["pt-BR", "fr-CA"],
24
25
  llm: {
25
26
  choice: "huggingface",
@@ -47,6 +48,7 @@ var configSchema = z.object({
47
48
  geminiApiKey: z.string().optional()
48
49
  }),
49
50
  sourceLanguage: languageSchema,
51
+ defaultLanguage: languageSchema,
50
52
  languages: z.array(languageSchema),
51
53
  llm: z.object({
52
54
  choice: llmOptionsSchema,
@@ -38,6 +38,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
38
38
  geminiApiKey?: string | undefined;
39
39
  }>;
40
40
  sourceLanguage: z.ZodString;
41
+ defaultLanguage: z.ZodString;
41
42
  languages: z.ZodArray<z.ZodString, "many">;
42
43
  llm: z.ZodObject<{
43
44
  choice: z.ZodEnum<["gemini", "anthropic", "huggingface"]>;
@@ -89,6 +90,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
89
90
  write?: boolean | undefined;
90
91
  };
91
92
  sourceLanguage: string;
93
+ defaultLanguage: string;
92
94
  languages: string[];
93
95
  llm: {
94
96
  choice: "gemini" | "anthropic" | "huggingface";
@@ -119,6 +121,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
119
121
  write?: boolean | undefined;
120
122
  };
121
123
  sourceLanguage: string;
124
+ defaultLanguage: string;
122
125
  languages: string[];
123
126
  llm: {
124
127
  choice: "gemini" | "anthropic" | "huggingface";
@@ -149,6 +152,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
149
152
  write?: boolean | undefined;
150
153
  };
151
154
  sourceLanguage: string;
155
+ defaultLanguage: string;
152
156
  languages: string[];
153
157
  llm: {
154
158
  choice: "gemini" | "anthropic" | "huggingface";
@@ -179,6 +183,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
179
183
  write?: boolean | undefined;
180
184
  };
181
185
  sourceLanguage: string;
186
+ defaultLanguage: string;
182
187
  languages: string[];
183
188
  llm: {
184
189
  choice: "gemini" | "anthropic" | "huggingface";
@@ -19,6 +19,7 @@ var configSchema = z.object({
19
19
  geminiApiKey: z.string().optional()
20
20
  }),
21
21
  sourceLanguage: languageSchema,
22
+ defaultLanguage: languageSchema,
22
23
  languages: z.array(languageSchema),
23
24
  llm: z.object({
24
25
  choice: llmOptionsSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gringow/gringow",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "main": "./dist/index.mjs",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.mts",