summaryrefslogtreecommitdiff
path: root/continuedev/src
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-08-27 22:11:52 -0700
committerNate Sesti <sestinj@gmail.com>2023-08-27 22:11:52 -0700
commitdeb291c1b225425cba543dd3b4c5557089abfb59 (patch)
treeeec42ee46d2f52e7affbaf2c66255de1fd649c26 /continuedev/src
parent50491384158b36530a1435ec4517ed6b065a0bf0 (diff)
downloadsncontinue-deb291c1b225425cba543dd3b4c5557089abfb59.tar.gz
sncontinue-deb291c1b225425cba543dd3b4c5557089abfb59.tar.bz2
sncontinue-deb291c1b225425cba543dd3b4c5557089abfb59.zip
fix: :bug: fix togetherAI model json parsing
Diffstat (limited to 'continuedev/src')
-rw-r--r--continuedev/src/continuedev/core/models.py1
-rw-r--r--continuedev/src/continuedev/libs/llm/together.py5
-rw-r--r--continuedev/src/continuedev/server/gui.py4
3 files changed, 7 insertions, 3 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