diff --git a/client/lib/aiSummarization.ts b/client/lib/aiSummarization.ts index ec10fc3..5e449d1 100644 --- a/client/lib/aiSummarization.ts +++ b/client/lib/aiSummarization.ts @@ -7,6 +7,12 @@ export interface CaseSummary { suggestedNextSteps: string[]; } +async function callGroqAPI(prompt: string): Promise { + const apiKey = process.env.GROQ_API_KEY; + if (!apiKey) { + throw new Error("GROQ_API_KEY environment variable is not set"); + } + const GROQ_API_KEY = process.env.GROQ_API_KEY; /** @@ -22,7 +28,7 @@ async function callGroqAPI(prompt: string): Promise { method: "POST", headers: { "Content-Type": "application/json", - Authorization: `Bearer ${GROQ_API_KEY}`, + Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ model: "llama-3.1-8b-instant",