This is the Azure Dynamic Sessions module.
This module provides the SessionsPythonREPLTool class for managing dynamic sessions in Azure.
Metadata for a file in the session.
Azure Dynamic Sessions tool.
Setup:
pip install -U langchain-azure-dynamic-sessions
import getpass
POOL_MANAGEMENT_ENDPOINT = getpass.getpass("Enter the management endpoint of the session pool: ")
Instantiation:
from langchain_azure_dynamic_sessions import SessionsPythonREPLTool
tool = SessionsPythonREPLTool(
pool_management_endpoint=POOL_MANAGEMENT_ENDPOINT
)
Invocation with args:
tool.invoke("6 * 7")
'{\\n "result": 42,\\n "stdout": "",\\n "stderr": ""\\n}'
Invocation with ToolCall:
tool.invoke({"args": {"input":"6 * 7"}, "id": "1", "name": tool.name, "type": "tool_call"})
'{\\n "result": 42,\\n "stdout": "",\\n "stderr": ""\\n}'
Azure Dynamic Sessions Bash tool for executing shell commands.
Setup:
pip install -U langchain-azure-dynamic-sessions
import getpass
POOL_MANAGEMENT_ENDPOINT = getpass.getpass("Enter the management endpoint of the session pool: ")
Instantiation:
from langchain_azure_dynamic_sessions import SessionsBashTool
tool = SessionsBashTool(
pool_management_endpoint=POOL_MANAGEMENT_ENDPOINT
)
Invocation with args:
tool.invoke("echo hello")
'{\\n "stdout": "hello\\n",\\n "stderr": "",\\n "exitCode": 0\\n}'
Invocation with ToolCall:
tool.invoke({"args": {"input":"echo hello"}, "id": "1", "name": tool.name, "type": "tool_call"})
'{\\n "stdout": "hello\\n",\\n "stderr": "",\\n "exitCode": 0\\n}'