mirror of
https://github.com/hwchase17/langchain
synced 2024-11-18 09:25:54 +00:00
c72bcda4f2
Remove the REPL from community, and suggest an alternative import from langchain_experimental. Fix for this issue: https://github.com/langchain-ai/langchain/issues/14345 This is not a bug in the code or an actual security risk. The python REPL itself is behaving as expected. The PR is done to appease blanket security policies that are just looking for the presence of exec in the code. --------- Co-authored-by: Erick Friis <erick@langchain.dev>
18 lines
640 B
Python
18 lines
640 B
Python
import logging
|
|
from typing import Any
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def __getattr__(name: str) -> Any:
|
|
if name in "PythonREPL":
|
|
raise AssertionError(
|
|
"PythonREPL has been deprecated from langchain_community due to being "
|
|
"flagged by security scanners. See: "
|
|
"https://github.com/langchain-ai/langchain/issues/14345 "
|
|
"If you need to use it, please use the version "
|
|
"from langchain_experimental. "
|
|
"from langchain_experimental.utilities.python import PythonREPL."
|
|
)
|
|
raise AttributeError(f"module {__name__} has no attribute {name}")
|