Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: fix summarizer for tool_calls (#1350)
Sarah Wooders486d1c55c027
diff --git a/configs/memgpt_hosted.json b/configs/memgpt_hosted.jsonindex 9e5d55c5d..3fd85a4c1 100644--- a/configs/memgpt_hosted.json+++ b/configs/memgpt_hosted.json@@ -1,5 +1,5 @@{- "context_window": 16384,+ "context_window": 8192,"model_endpoint_type": "openai","model_endpoint": "https://inference.memgpt.ai","model": "memgpt-openai",diff --git a/memgpt/local_llm/llm_chat_completion_wrappers/simple_summary_wrapper.py b/memgpt/local_llm/llm_chat_completion_wrappers/simple_summary_wrapper.pyindex 1f0c72d7e..e3dee6d26 100644--- a/memgpt/local_llm/llm_chat_completion_wrappers/simple_summary_wrapper.py+++ b/memgpt/local_llm/llm_chat_completion_wrappers/simple_summary_wrapper.py@@ -108,8 +108,10 @@ class SimpleSummaryWrapper(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 "tool_calls" in message and message["tool_calls"]:+ prompt += f"\n{create_function_call(message['tool_calls'][0]['function'])}"elif message["role"] in ["function", "tool"]:# TODO find a good way to add this# prompt += f"\nASSISTANT: (function return) {message['content']}"diff --git a/tests/test_summarize.py b/tests/test_summarize.pyindex c52b753f6..bf74e8408 100644--- a/tests/test_summarize.py+++ b/tests/test_summarize.py@@ -10,6 +10,9 @@ test_agent_name = f"test_client_{str(uuid.uuid4())}"client = Noneagent_obj = None+# TODO: these tests should include looping through LLM providers, since behavior may vary across providers+# TODO: these tests should add function calls into the summarized message sequence:W+def create_test_agent():"""Create a test agent that we can call functions on"""