🐛 small fixes

This commit is contained in:
Nate Sesti 2023-10-25 14:25:12 -07:00
parent f3d1ef79be
commit 151e615452
3 changed files with 18 additions and 4 deletions

View file

@ -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)

View file

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

View file

@ -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