Update index.ts
This commit is contained in:
parent
f88c728568
commit
4967536501
@ -23,6 +23,7 @@ export async function generateCompletions(
|
|||||||
switch (switchVariable) {
|
switch (switchVariable) {
|
||||||
case "openAI":
|
case "openAI":
|
||||||
const llm = new OpenAI();
|
const llm = new OpenAI();
|
||||||
|
try{
|
||||||
const completionResult = await generateOpenAICompletions({
|
const completionResult = await generateOpenAICompletions({
|
||||||
client: llm,
|
client: llm,
|
||||||
document: document,
|
document: document,
|
||||||
@ -41,6 +42,10 @@ export async function generateCompletions(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return completionResult;
|
return completionResult;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error generating completions: ${error}`);
|
||||||
|
throw new Error(`Error generating completions: ${error.message}`);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
throw new Error("Invalid client");
|
throw new Error("Invalid client");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user