Skip to content
Snippets Groups Projects
Commit 9f327d01 authored by timothycarambat's avatar timothycarambat
Browse files

update error handling for OpenAI providers

parent 196c4c13
No related branches found
No related tags found
No related merge requests found
...@@ -97,7 +97,7 @@ class GenericOpenAiLLM { ...@@ -97,7 +97,7 @@ class GenericOpenAiLLM {
max_tokens: this.maxTokens, max_tokens: this.maxTokens,
}) })
.catch((e) => { .catch((e) => {
throw new Error(e.response.data.error.message); throw new Error(e.message);
}); });
if (!result.hasOwnProperty("choices") || result.choices.length === 0) if (!result.hasOwnProperty("choices") || result.choices.length === 0)
......
...@@ -103,7 +103,7 @@ class GroqLLM { ...@@ -103,7 +103,7 @@ class GroqLLM {
temperature, temperature,
}) })
.catch((e) => { .catch((e) => {
throw new Error(e.response.data.error.message); throw new Error(e.message);
}); });
if (!result.hasOwnProperty("choices") || result.choices.length === 0) if (!result.hasOwnProperty("choices") || result.choices.length === 0)
......
...@@ -92,7 +92,7 @@ class KoboldCPPLLM { ...@@ -92,7 +92,7 @@ class KoboldCPPLLM {
temperature, temperature,
}) })
.catch((e) => { .catch((e) => {
throw new Error(e.response.data.error.message); throw new Error(e.message);
}); });
if (!result.hasOwnProperty("choices") || result.choices.length === 0) if (!result.hasOwnProperty("choices") || result.choices.length === 0)
......
...@@ -93,7 +93,7 @@ class LiteLLM { ...@@ -93,7 +93,7 @@ class LiteLLM {
max_tokens: parseInt(this.maxTokens), // LiteLLM requires int max_tokens: parseInt(this.maxTokens), // LiteLLM requires int
}) })
.catch((e) => { .catch((e) => {
throw new Error(e.response.data.error.message); throw new Error(e.message);
}); });
if (!result.hasOwnProperty("choices") || result.choices.length === 0) if (!result.hasOwnProperty("choices") || result.choices.length === 0)
......
...@@ -130,7 +130,7 @@ class OpenAiLLM { ...@@ -130,7 +130,7 @@ class OpenAiLLM {
temperature, temperature,
}) })
.catch((e) => { .catch((e) => {
throw new Error(e.response.data.error.message); throw new Error(e.message);
}); });
if (!result.hasOwnProperty("choices") || result.choices.length === 0) if (!result.hasOwnProperty("choices") || result.choices.length === 0)
......
...@@ -142,7 +142,7 @@ class OpenRouterLLM { ...@@ -142,7 +142,7 @@ class OpenRouterLLM {
temperature, temperature,
}) })
.catch((e) => { .catch((e) => {
throw new Error(e.response.data.error.message); throw new Error(e.message);
}); });
if (!result.hasOwnProperty("choices") || result.choices.length === 0) if (!result.hasOwnProperty("choices") || result.choices.length === 0)
......
...@@ -93,7 +93,7 @@ class PerplexityLLM { ...@@ -93,7 +93,7 @@ class PerplexityLLM {
temperature, temperature,
}) })
.catch((e) => { .catch((e) => {
throw new Error(e.response.data.error.message); throw new Error(e.message);
}); });
if (!result.hasOwnProperty("choices") || result.choices.length === 0) if (!result.hasOwnProperty("choices") || result.choices.length === 0)
......
...@@ -89,7 +89,7 @@ class TextGenWebUILLM { ...@@ -89,7 +89,7 @@ class TextGenWebUILLM {
temperature, temperature,
}) })
.catch((e) => { .catch((e) => {
throw new Error(e.response.data.error.message); throw new Error(e.message);
}); });
if (!result.hasOwnProperty("choices") || result.choices.length === 0) if (!result.hasOwnProperty("choices") || result.choices.length === 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment