langchain.tools.python.tool.PythonAstREPLTool¶
class langchain.tools.python.tool.PythonAstREPLTool[source]¶
Bases: BaseTool
A tool for running python code in a REPL.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param args_schema: Type[pydantic.main.BaseModel] = <class 'langchain.tools.python.tool.PythonInputs'>¶
Pydantic model class to validate and parse the tool’s input arguments.
param callback_manager: Optional[BaseCallbackManager] = None¶
Deprecated. Please use callbacks instead.
param callbacks: Callbacks = None¶
Callbacks to be called during tool execution.
param description: str = 'A Python shell. Use this to execute python commands. Input should be a valid python command. When using this tool, sometimes output is abbreviated - make sure it does not look abbreviated before using it in your answer.'¶
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
param globals: Optional[Dict] [Optional]¶
param handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = False¶
Handle the content of the ToolException thrown.
param locals: Optional[Dict] [Optional]¶
param metadata: Optional[Dict[str, Any]] = None¶
Optional metadata associated with the tool. Defaults to None
This metadata will be associated with each call to this tool,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a tool with its use case.
param name: str = 'python_repl_ast'¶
The unique name of the tool that clearly communicates its purpose.