Update index.ts

This commit is contained in:
Nicolas 2024-04-30 18:19:55 -07:00
parent f88c728568
commit 4967536501
1 changed files with 5 additions and 0 deletions

View File

@ -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");
}