From 151e61545245c37192b95fd4881b8eecafef9c77 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 25 Oct 2023 14:25:12 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20small=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/continuedev/core/models.py | 10 +++++++--- server/continuedev/libs/llm/ollama.py | 5 +++++ server/continuedev/models/generate_json_schema.py | 7 ++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/server/continuedev/core/models.py b/server/continuedev/core/models.py index 6b4d3ca7e..0ddc5d159 100644 --- a/server/continuedev/core/models.py +++ b/server/continuedev/core/models.py @@ -14,6 +14,7 @@ from ..libs.llm.openai import OpenAI from ..libs.llm.openai_free_trial import OpenAIFreeTrial from ..libs.llm.replicate import ReplicateLLM from ..libs.llm.together import TogetherLLM +from ..libs.llm.text_gen_webui import TextGenWebUI class ContinueSDK(BaseModel): @@ -41,6 +42,7 @@ MODEL_CLASSES = { HuggingFaceInferenceAPI, HuggingFaceTGI, GooglePaLMAPI, + TextGenWebUI, ] } @@ -56,7 +58,7 @@ MODEL_MODULE_NAMES = { "HuggingFaceInferenceAPI": "hf_inference_api", "HuggingFaceTGI": "hf_tgi", "GooglePaLMAPI": "google_palm_api", - "TextGenWebUI": "text_gen_webui" + "TextGenWebUI": "text_gen_webui", } @@ -89,14 +91,16 @@ class Models(BaseModel): if self.sdk: return self.sdk.config.system_message return None - + @property def temperature(self) -> Optional[float]: if self.sdk: return self.sdk.config.temperature return None - def set_main_config_params(self, system_msg: Optional[str], temperature: Optional[float]): + def set_main_config_params( + self, system_msg: Optional[str], temperature: Optional[float] + ): for model in self.all_models: model.set_main_config_params(system_msg, temperature) diff --git a/server/continuedev/libs/llm/ollama.py b/server/continuedev/libs/llm/ollama.py index b9842eb75..d0bf98b91 100644 --- a/server/continuedev/libs/llm/ollama.py +++ b/server/continuedev/libs/llm/ollama.py @@ -99,6 +99,11 @@ class Ollama(LLM): f"Ollama returned an error: {txt}{extra_msg}", "Invalid request to Ollama", ) + elif resp.status == 404: + raise ContinueCustomException( + f"Ollama not found. Please make sure the server is running.\n\n{await resp.text()}", + "Ollama not found. Please make sure the server is running.", + ) elif resp.status != 200: raise ContinueCustomException( f"Ollama returned an error: {await resp.text()}", diff --git a/server/continuedev/models/generate_json_schema.py b/server/continuedev/models/generate_json_schema.py index 88a1db684..1faa3665d 100644 --- a/server/continuedev/models/generate_json_schema.py +++ b/server/continuedev/models/generate_json_schema.py @@ -4,7 +4,12 @@ from pydantic import schema_json_of from ..core.config import ContinueConfig from ..core.context import ContextItem -from ..core.main import FullState, History, HistoryNode, SessionInfo +from ..core.main import ( + FullState, + History, + HistoryNode, + SessionInfo, +) from ..core.models import Models from ..libs.llm.base import LLM from .filesystem import FileEdit, RangeInFile