Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Update index.ts

Nicolas49675365017f
diff --git a/apps/api/src/lib/LLM-extraction/index.ts b/apps/api/src/lib/LLM-extraction/index.ts
index 86e2f90f0..ea6ddfdf5 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");
}