A tool that runs Python code server-side to help generate a response.
The model can write and execute Python code within a sandboxed container and include the results in its response.
Wraps :class:openai.types.responses.tool_param.CodeInterpreter.
Example::
from langchain.chat_models import init_chat_model
from langchain_azure_ai.tools.builtin import CodeInterpreterTool
from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
model = init_chat_model(model="azure_ai:gpt-4.1", credential=credential)
tool = CodeInterpreterTool()
model_with_code = model.bind_tools([tool])
response = model_with_code.invoke("Plot a sine wave using Python")
Network access policy for the container.
.. seealso::
:class:~openai.types.responses. tool_param.CodeInterpreterContainerCodeInterpreterToolAutoNetworkPolicy