()
| 267 | } |
| 268 | |
| 269 | async function createEnvBaseAIExample(): Promise<void> { |
| 270 | const envBaseAIExamplePath = path.join( |
| 271 | process.cwd(), |
| 272 | '.env.baseai.example' |
| 273 | ); |
| 274 | const envBaseAIExampleContent = `# !! SERVER SIDE ONLY !! |
| 275 | # Keep all your API keys secret — use only on the server side. |
| 276 | |
| 277 | # TODO: ADD: Both in your production and local env files. |
| 278 | # Langbase API key for your User or Org account. |
| 279 | # How to get this API key https://langbase.com/docs/api-reference/api-keys |
| 280 | LANGBASE_API_KEY= |
| 281 | |
| 282 | # TODO: ADD: LOCAL ONLY. Add only to local env files. |
| 283 | # Following keys are needed for local pipe runs. For providers you are using. |
| 284 | # For Langbase, please add the key to your LLM keysets. |
| 285 | # Read more: Langbase LLM Keysets https://langbase.com/docs/features/keysets |
| 286 | OPENAI_API_KEY= |
| 287 | ANTHROPIC_API_KEY= |
| 288 | COHERE_API_KEY= |
| 289 | FIREWORKS_API_KEY= |
| 290 | GOOGLE_API_KEY= |
| 291 | GROQ_API_KEY= |
| 292 | MISTRAL_API_KEY= |
| 293 | PERPLEXITY_API_KEY= |
| 294 | TOGETHER_API_KEY= |
| 295 | XAI_API_KEY= |
| 296 | `; |
| 297 | |
| 298 | try { |
| 299 | const exists = await checkFileExists(envBaseAIExamplePath); |
| 300 | if (!exists) { |
| 301 | await fs.writeFile(envBaseAIExamplePath, envBaseAIExampleContent); |
| 302 | // p.log.success('Created `.env.baseai.example` file.'); |
| 303 | } else { |
| 304 | // p.log.info( |
| 305 | // '`.env.baseai.example` file already exists. Skipping creation.' |
| 306 | // ); |
| 307 | } |
| 308 | } catch (error) { |
| 309 | p.log.error( |
| 310 | `Error creating .env.baseai.example: Check the example env file here https://github.com/LangbaseInc/baseai/blob/main/.env.baseai.example\n Error: ${error instanceof Error ? error.message : String(error)}` |
| 311 | ); |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | export async function init({ |
| 316 | calledAsCommand = false, |
no test coverage detected