Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

black format patch for zephyr pr

Charles Packere47336ed48ef
diff --git a/memgpt/local_llm/chat_completion_proxy.py b/memgpt/local_llm/chat_completion_proxy.py
index b0b13d526..0497a6fe0 100644
--- a/memgpt/local_llm/chat_completion_proxy.py
+++ b/memgpt/local_llm/chat_completion_proxy.py
@@ -28,7 +28,7 @@ async def get_chat_completion(
llm_wrapper = airoboros.Airoboros21InnerMonologueWrapper()
elif model == "dolphin-2.1-mistral-7b":
llm_wrapper = dolphin.Dolphin21MistralWrapper()
- elif (model == "zephyr-7B-alpha" or model == "zephyr-7B-beta"):
+ elif model == "zephyr-7B-alpha" or model == "zephyr-7B-beta":
llm_wrapper = zephyr.ZephyrMistralInnerMonologueWrapper()
else:
# Warn the user that we're using the fallback
diff --git a/memgpt/local_llm/llm_chat_completion_wrappers/zephyr.py b/memgpt/local_llm/llm_chat_completion_wrappers/zephyr.py
index 83f8cc03f..b088e50ac 100644
--- a/memgpt/local_llm/llm_chat_completion_wrappers/zephyr.py
+++ b/memgpt/local_llm/llm_chat_completion_wrappers/zephyr.py
@@ -1,6 +1,7 @@
import json
from .wrapper_base import LLMChatCompletionWrapper
+
class ZephyrMistralWrapper(LLMChatCompletionWrapper):
"""
Wrapper for Zephyr Alpha and Beta, Mistral 7B:
@@ -33,7 +34,7 @@ class ZephyrMistralWrapper(LLMChatCompletionWrapper):
<|assistant|>
(source: https://huggingface.co/TheBloke/zephyr-7B-beta-GGUF#prompt-template-zephyr)
"""
-
+
prompt = ""
IM_START_TOKEN = "<s>"
@@ -72,7 +73,7 @@ class ZephyrMistralWrapper(LLMChatCompletionWrapper):
"params": json.loads(function_call["arguments"]),
}
return json.dumps(airo_func_call, indent=2)
-
+
for message in messages[1:]:
assert message["role"] in ["user", "assistant", "function"], message
@@ -166,6 +167,7 @@ class ZephyrMistralWrapper(LLMChatCompletionWrapper):
}
return message
+
class ZephyrMistralInnerMonologueWrapper(ZephyrMistralWrapper):
"""Still expect only JSON outputs from model, but add inner monologue as a field"""
@@ -191,7 +193,6 @@ class ZephyrMistralInnerMonologueWrapper(ZephyrMistralWrapper):
self.include_section_separators = include_section_separators
def chat_completion_to_prompt(self, messages, functions):
-
prompt = ""
IM_START_TOKEN = "<s>"
@@ -263,7 +264,7 @@ class ZephyrMistralInnerMonologueWrapper(ZephyrMistralWrapper):
raise ValueError(message)
# Add a sep for the response
- #if self.include_section_separators:
+ # if self.include_section_separators:
# prompt += "\n### RESPONSE"
if self.include_assistant_prefix: