From 49675365017f914a4fe62e0863350af39f78d10f Mon Sep 17 00:00:00 2001 From: Nicolas Date: Tue, 30 Apr 2024 18:19:55 -0700 Subject: [PATCH] Update index.ts --- apps/api/src/lib/LLM-extraction/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/api/src/lib/LLM-extraction/index.ts b/apps/api/src/lib/LLM-extraction/index.ts index 86e2f90..ea6ddfd 100644 --- a/apps/api/src/lib/LLM-extraction/index.ts +++ b/apps/api/src/lib/LLM-extraction/index.ts @@ -23,6 +23,7 @@ export async function generateCompletions( switch (switchVariable) { case "openAI": const llm = new OpenAI(); + try{ const completionResult = await generateOpenAICompletions({ client: llm, document: document, @@ -41,6 +42,10 @@ export async function generateCompletions( } return completionResult; + } catch (error) { + console.error(`Error generating completions: ${error}`); + throw new Error(`Error generating completions: ${error.message}`); + } default: throw new Error("Invalid client"); }