Environment Variables
To call your LLM from a third-party service, you’ll likely need some environment variables to keep your API keys safe.
Since Evalite is based on Vitest, it should already pick them up from your vite.config.ts
.
Setting Up Env Variables
If you don’t have Vitest set up, here’s how to do it:
-
Create a
.env
file in the root of your project:.env OPENAI_API_KEY=your-api-key -
Add
.env
to your.gitignore
, if it’s not already there.gitignore .env -
Install
dotenv
:Terminal window pnpm add -D dotenv -
Add a
vite.config.ts
file:vite.config.ts import { defineConfig } from "vite";export default defineConfig({test: {setupFiles: ["dotenv/config"],},});
Now, your environment variables will be available in your evals.