From 8eaa71cbabe905fdab9c52b26b9879b49e69565e Mon Sep 17 00:00:00 2001 From: Joohyong Han Date: Wed, 17 Jul 2024 12:14:13 -0400 Subject: [PATCH] added json.loads() to convert user_metadata to json --- .../evaluation_tool__autoeval__colab.ipynb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/vertex_ai_conversation/evaluation_tool__autoeval__colab.ipynb b/examples/vertex_ai_conversation/evaluation_tool__autoeval__colab.ipynb index b20d118f..95bf2be0 100644 --- a/examples/vertex_ai_conversation/evaluation_tool__autoeval__colab.ipynb +++ b/examples/vertex_ai_conversation/evaluation_tool__autoeval__colab.ipynb @@ -804,6 +804,13 @@ " ) -> VertexConversationResponse:\n", " if session_id is None:\n", " session_id = self.sessions.build_session_id(self.agent_id)\n", + "\n", + " if user_metadata:\n", + " try:\n", + " user_metadata = json.loads(user_metadata)\n", + " except ValueError as err:\n", + " raise UserWarning(\"Invalid user metadata\") from err\n", + " \n", " response = self.detect_intent(\n", " agent_id=self.agent_id,\n", " session_id=session_id,\n",