From 0475d015fe0eb4a997c7d37867e316a23dde8aaa Mon Sep 17 00:00:00 2001 From: James O'Dwyer <100361543+softboyjimbo@users.noreply.github.com> Date: Fri, 16 Jun 2023 23:36:18 -0400 Subject: [PATCH] Handle Managed Motorhead Data Key (#6169) # Handle Managed Motorhead Data Key Managed motorhead will return a payload with a `data` key. we need to handle this to properly access messages from the server. --- langchain/memory/motorhead_memory.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/langchain/memory/motorhead_memory.py b/langchain/memory/motorhead_memory.py index 37fb3cbf..4113265e 100644 --- a/langchain/memory/motorhead_memory.py +++ b/langchain/memory/motorhead_memory.py @@ -48,6 +48,8 @@ class MotorheadMemory(BaseChatMemory): headers=self.__get_headers(), ) res_data = res.json() + res_data = res_data.get("data", res_data) # Handle Managed Version + messages = res_data.get("messages", []) context = res_data.get("context", "NONE")