From 9ca30aaa18570c85631d48331ba61b238cc690b6 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 25 Oct 2024 15:01:55 -0400 Subject: [PATCH] runs --- ...riptape_cloud_conversation_memory_driver.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/griptape/drivers/memory/conversation/griptape_cloud_conversation_memory_driver.py b/griptape/drivers/memory/conversation/griptape_cloud_conversation_memory_driver.py index dde99473f..55ab2a133 100644 --- a/griptape/drivers/memory/conversation/griptape_cloud_conversation_memory_driver.py +++ b/griptape/drivers/memory/conversation/griptape_cloud_conversation_memory_driver.py @@ -126,17 +126,15 @@ def load(self) -> tuple[list[Run], dict[str, Any]]: # retrieve the Thread to get the metadata thread_response = self._call_api("get", f"/threads/{thread_id}").json() - runs = [] - for m in messages_response.get("messages", []): - run_id = m["metadata"].pop("run_id", None) - run = Run( - meta=m["metadata"], - input=BaseArtifact.from_json(m["input"]), - output=BaseArtifact.from_json(m["output"]), + runs = [ + Run( + **({"id": message["metadata"]} if "metadata" in message else {}), + meta=message["metadata"], + input=BaseArtifact.from_json(message["input"]), + output=BaseArtifact.from_json(message["output"]), ) - if run_id is not None: - run.id = run_id - runs.append(run) + for message in messages_response.get("messages", []) + ] return runs, thread_response.get("metadata", {})