diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-08-27 22:11:52 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-08-27 22:11:52 -0700 |
commit | deb291c1b225425cba543dd3b4c5557089abfb59 (patch) | |
tree | eec42ee46d2f52e7affbaf2c66255de1fd649c26 | |
parent | 50491384158b36530a1435ec4517ed6b065a0bf0 (diff) | |
download | sncontinue-deb291c1b225425cba543dd3b4c5557089abfb59.tar.gz sncontinue-deb291c1b225425cba543dd3b4c5557089abfb59.tar.bz2 sncontinue-deb291c1b225425cba543dd3b4c5557089abfb59.zip |
fix: :bug: fix togetherAI model json parsing
-rw-r--r-- | continuedev/src/continuedev/core/models.py | 1 | ||||
-rw-r--r-- | continuedev/src/continuedev/libs/llm/together.py | 5 | ||||
-rw-r--r-- | continuedev/src/continuedev/server/gui.py | 4 | ||||
-rw-r--r-- | extension/react-app/src/components/ModelSelect.tsx | 2 |
4 files changed, 8 insertions, 4 deletions
diff --git a/continuedev/src/continuedev/core/models.py b/continuedev/src/continuedev/core/models.py index a8c97622..f03a8f29 100644 --- a/continuedev/src/continuedev/core/models.py +++ b/continuedev/src/continuedev/core/models.py @@ -46,6 +46,7 @@ MODEL_MODULE_NAMES = { "AnthropicLLM": "anthropic", "ReplicateLLM": "replicate", "Ollama": "ollama", + "LlamaCpp": "llamacpp", } diff --git a/continuedev/src/continuedev/libs/llm/together.py b/continuedev/src/continuedev/libs/llm/together.py index 9a28de2d..4baf0b6c 100644 --- a/continuedev/src/continuedev/libs/llm/together.py +++ b/continuedev/src/continuedev/libs/llm/together.py @@ -112,11 +112,12 @@ class TogetherLLM(LLM): "data: [DONE]" ): continue - if json_chunk.startswith("data: "): - json_chunk = json_chunk[6:] + chunks = json_chunk.split("\n") for chunk in chunks: if chunk.strip() != "": + if chunk.startswith("data: "): + chunk = chunk[6:] json_chunk = json.loads(chunk) if "choices" in json_chunk: yield { diff --git a/continuedev/src/continuedev/server/gui.py b/continuedev/src/continuedev/server/gui.py index 51dad8ed..08c5efc5 100644 --- a/continuedev/src/continuedev/server/gui.py +++ b/continuedev/src/continuedev/server/gui.py @@ -255,7 +255,9 @@ class GUIProtocolServer(AbstractGUIProtocolServer): # Replace default with either new one or existing from unused_models for unused_model in unused_models: if model_class == unused_model.__class__.__name__ and ( - "model" not in model or model["model"] == unused_model.model + "model" not in model + or model["model"] == unused_model.model + and model["model"].startswith("gpt") ): models.default = unused_model diff --git a/extension/react-app/src/components/ModelSelect.tsx b/extension/react-app/src/components/ModelSelect.tsx index 9699847c..9134cd7d 100644 --- a/extension/react-app/src/components/ModelSelect.tsx +++ b/extension/react-app/src/components/ModelSelect.tsx @@ -60,7 +60,7 @@ const MODEL_INFO: { title: string; class: string; args: any }[] = [ title: "TogetherAI", class: "TogetherLLM", args: { - model: "gpt-4", + model: "togethercomputer/CodeLlama-13b-Instruct", api_key: "<TOGETHER_API_KEY>", }, }, |