diff options
-rw-r--r-- | continuedev/src/continuedev/libs/llm/ggml.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/continuedev/src/continuedev/libs/llm/ggml.py b/continuedev/src/continuedev/libs/llm/ggml.py index 1668fb65..06fb2658 100644 --- a/continuedev/src/continuedev/libs/llm/ggml.py +++ b/continuedev/src/continuedev/libs/llm/ggml.py @@ -126,6 +126,11 @@ class GGML(LLM): }, ) as resp: text = await resp.text() - completion = json.loads(text)["choices"][0]["text"] - self.write_log(f"Completion: \n\n{completion}") - return completion + try: + completion = json.loads(text)["choices"][0]["text"] + self.write_log(f"Completion: \n\n{completion}") + return completion + except Exception as e: + raise Exception( + f"Error calling /completion endpoint: {e}\n\nResponse text: {text}" + ) |