Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
Fixing some dict value checking for function_call (#249)
Mo Nuaimat8adef204e682
diff --git a/memgpt/local_llm/llm_chat_completion_wrappers/airoboros.py b/memgpt/local_llm/llm_chat_completion_wrappers/airoboros.pyindex d5a71eaeb..cdf394d4f 100644--- a/memgpt/local_llm/llm_chat_completion_wrappers/airoboros.py+++ b/memgpt/local_llm/llm_chat_completion_wrappers/airoboros.py@@ -133,7 +133,7 @@ class Airoboros21Wrapper(LLMChatCompletionWrapper):elif message["role"] == "assistant":prompt += f"\nASSISTANT: {message['content']}"# need to add the function call if there was one- if message["function_call"]:+ if "function_call" in message and message["function_call"]:prompt += f"\n{create_function_call(message['function_call'])}"elif message["role"] == "function":# TODO find a good way to add this@@ -339,7 +339,7 @@ class Airoboros21InnerMonologueWrapper(Airoboros21Wrapper):prompt += f"\nASSISTANT:"# need to add the function call if there was oneinner_thoughts = message["content"]- if message["function_call"]:+ if "function_call" in message and message["function_call"]:prompt += f"\n{create_function_call(message['function_call'], inner_thoughts=inner_thoughts)}"elif message["role"] == "function":# TODO find a good way to add thisdiff --git a/memgpt/local_llm/llm_chat_completion_wrappers/dolphin.py b/memgpt/local_llm/llm_chat_completion_wrappers/dolphin.pyindex b645dc4df..e1516e9fa 100644--- a/memgpt/local_llm/llm_chat_completion_wrappers/dolphin.py+++ b/memgpt/local_llm/llm_chat_completion_wrappers/dolphin.py@@ -165,7 +165,7 @@ class Dolphin21MistralWrapper(LLMChatCompletionWrapper):prompt += f"\n{message['content']}"# prompt += f"\nASSISTANT: {message['content']}"# need to add the function call if there was one- if message["function_call"]:+ if "function_call" in message and message["function_call"]:prompt += f"\n{create_function_call(message['function_call'])}"prompt += f"{IM_END_TOKEN}"elif message["role"] == "function":diff --git a/memgpt/local_llm/llm_chat_completion_wrappers/zephyr.py b/memgpt/local_llm/llm_chat_completion_wrappers/zephyr.pyindex 4afacd37f..83005254d 100644--- a/memgpt/local_llm/llm_chat_completion_wrappers/zephyr.py+++ b/memgpt/local_llm/llm_chat_completion_wrappers/zephyr.py@@ -96,7 +96,7 @@ class ZephyrMistralWrapper(LLMChatCompletionWrapper):prompt += f"\n{message['content']}"# prompt += f"\nASSISTANT: {message['content']}"# need to add the function call if there was one- if message["function_call"]:+ if "function_call" in message and message["function_call"]:prompt += f"\n{create_function_call(message['function_call'])}"prompt += f"{IM_END_TOKEN}"elif message["role"] == "function":@@ -259,7 +259,7 @@ class ZephyrMistralInnerMonologueWrapper(ZephyrMistralWrapper):prompt += f"\n<|assistant|>"# need to add the function call if there was oneinner_thoughts = message["content"]- if message["function_call"]:+ if "function_call" in message and message["function_call"]:prompt += f"\n{create_function_call(message['function_call'], inner_thoughts=inner_thoughts)}"elif message["role"] == "function":# TODO find a good way to add this