You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(compiler): google ai support in compiler (#875) (#897)
* feat: update some types to support google as an ai provider
* feat: more type updates for google ai
* feat: change ai logic for more google ai support
* feat: centralize llm error handling logic in lcp/api
* feat: improve llm api key validation and config
* chore: pnpm new
Co-authored-by: Best Codes <106822363+The-Best-Codes@users.noreply.github.com>
💡 You're using Lingo.dev Localization Compiler in your project, which requires a GROQ API key to work.
262
+
💡 Lingo.dev Localization Compiler is configured to use the following LLM provider(s): ${configuredProviders.join(", ")}.
263
+
264
+
The compiler requires API keys for these providers to work, but the following keys are missing:
265
+
`);
266
+
267
+
for(constproviderIdofmissingProviders){
268
+
conststatus=keyStatuses[providerId];
269
+
if(!status)continue;
270
+
console.log(dedent`
271
+
⚠️ ${status.details.name} API key is missing. Set ${status.details.apiKeyEnvVar} environment variable.
200
272
201
-
👉 You can set the API key in one of the following ways:
202
-
1. User-wide: Run npx lingo.dev@latest config set llm.groqApiKey <your-api-key>
203
-
2. Project-wide: Add GROQ_API_KEY=<your-api-key> to .env file in every project that uses Lingo.dev Localization Compiler
204
-
3. Session-wide: Run export GROQ_API_KEY=<your-api-key> in your terminal before running the compiler to set the API key for the current session
273
+
👉 You can set the API key in one of the following ways:
274
+
1. User-wide: Run npx lingo.dev@latest config set ${status.details.apiKeyConfigKey||"<config-key-not-available>"} <your-api-key>
275
+
2. Project-wide: Add ${status.details.apiKeyEnvVar}=<your-api-key> to .env file in every project that uses Lingo.dev Localization Compiler
276
+
3. Session-wide: Run export ${status.details.apiKeyEnvVar}=<your-api-key> in your terminal before running the compiler to set the API key for the current session
205
277
278
+
⭐️ If you don't yet have a ${status.details.name} API key, get one for free at ${status.details.getKeyLink}
279
+
`);
280
+
}
281
+
282
+
console.log(dedent`
283
+
\n
206
284
⭐️ Also:
207
-
1. If you don't yet have a GROQ API key, get one for free at https://groq.com
208
-
2. If you want to use a different LLM, raise an issue in our open-source repo: https://lingo.dev/go/gh
285
+
1. If you want to use a different LLM, update your configuration. Refer to documentation for help: https://docs.lingo.dev/
286
+
2. If the model/provider you want to use isn't supported yet, raise an issue in our open-source repo: https://lingo.dev/go/gh
209
287
3. If you have questions, feature requests, or would like to contribute, join our Discord: https://lingo.dev/go/discord
210
288
211
289
✨
212
290
`);
213
291
process.exit(1);
214
-
}elseif(groq.fromEnv&&groq.fromRc){
215
-
console.log(
216
-
dedent`
217
-
🔑 GROQ API key detected in both environment variables and your user-wide configuration.
218
-
219
-
👉 The compiler will use the key from the environment because it has higher priority.
220
-
221
-
• To update the user-wide key run: npx lingo.dev@latest config set llm.groqApiKey <your-api-key>
222
-
• To remove it run: npx lingo.dev@latest config unset llm.groqApiKey
223
-
• To remove the env variable from the current session run: unset GROQ_API_KEY
224
-
`,
225
-
);
226
-
}elseif(groq.fromEnv&&!groq.fromRc){
227
-
console.log(
228
-
dedent`
229
-
🔑 GROQ API key loaded from environment variables.
230
-
231
-
• You can also save the key user-wide with: npx lingo.dev@latest config set llm.groqApiKey <your-api-key>
232
-
• Or remove the env variable from the current session with: unset GROQ_API_KEY
233
-
`,
234
-
);
235
-
}elseif(!groq.fromEnv&&groq.fromRc){
236
-
console.log(
237
-
dedent`
238
-
🔑 GROQ API key loaded from your user-wide configuration.
239
-
`,
240
-
);
292
+
}elseif(foundProviders.length>0){
293
+
console.log(dedent`
294
+
\n
295
+
🔑 LLM API keys detected for configured providers: ${foundProviders.join(", ")}.
296
+
`);
297
+
for(constproviderIdoffoundProviders){
298
+
conststatus=keyStatuses[providerId];
299
+
if(!status)continue;
300
+
letsourceMessage="";
301
+
if(status.foundInEnv&&status.foundInRc){
302
+
sourceMessage=`from both environment variables (${status.details.apiKeyEnvVar}) and your user-wide configuration. The key from the environment will be used because it has higher priority.`;
0 commit comments