From dc821ffd1608e8421884db2e3bcf2162cee7609d Mon Sep 17 00:00:00 2001 From: Evan Mattson Date: Mon, 9 Dec 2024 09:32:07 +0900 Subject: [PATCH 1/2] Include the sessions plugin status key in return value --- .../core_plugins/sessions_python_tool/sessions_python_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/semantic_kernel/core_plugins/sessions_python_tool/sessions_python_plugin.py b/python/semantic_kernel/core_plugins/sessions_python_tool/sessions_python_plugin.py index 7467ac6cd03b..5ff153b0d7b6 100644 --- a/python/semantic_kernel/core_plugins/sessions_python_tool/sessions_python_plugin.py +++ b/python/semantic_kernel/core_plugins/sessions_python_tool/sessions_python_plugin.py @@ -200,7 +200,7 @@ async def execute_code(self, code: Annotated[str, "The valid Python code to exec ) response.raise_for_status() result = response.json()["properties"] - return f"Result:\n{result['result']}Stdout:\n{result['stdout']}Stderr:\n{result['stderr']}" + return f"Status:\n{result['status']}Result:\n{result['result']}Stdout:\n{result['stdout']}Stderr:\n{result['stderr']}" # noqa: E501 except HTTPStatusError as e: error_message = e.response.text if e.response.text else e.response.reason_phrase raise FunctionExecutionException( From 3bba534f48224f534a6f9848dfe6dcd61a9d5c93 Mon Sep 17 00:00:00 2001 From: Evan Mattson Date: Tue, 10 Dec 2024 05:49:33 +0900 Subject: [PATCH 2/2] Add new line after each field. --- .../sessions_python_tool/sessions_python_plugin.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/semantic_kernel/core_plugins/sessions_python_tool/sessions_python_plugin.py b/python/semantic_kernel/core_plugins/sessions_python_tool/sessions_python_plugin.py index 5ff153b0d7b6..0edd04cb08df 100644 --- a/python/semantic_kernel/core_plugins/sessions_python_tool/sessions_python_plugin.py +++ b/python/semantic_kernel/core_plugins/sessions_python_tool/sessions_python_plugin.py @@ -200,7 +200,12 @@ async def execute_code(self, code: Annotated[str, "The valid Python code to exec ) response.raise_for_status() result = response.json()["properties"] - return f"Status:\n{result['status']}Result:\n{result['result']}Stdout:\n{result['stdout']}Stderr:\n{result['stderr']}" # noqa: E501 + return ( + f"Status:\n{result['status']}\n" + f"Result:\n{result['result']}\n" + f"Stdout:\n{result['stdout']}\n" + f"Stderr:\n{result['stderr']}" + ) except HTTPStatusError as e: error_message = e.response.text if e.response.text else e.response.reason_phrase raise FunctionExecutionException(