mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-16 23:13:31 +00:00
community[major]: breaking change in some APIs to force users to opt-in for pickling (#18696)
This is a PR that adds a dangerous load parameter to force users to opt in to use pickle. This is a PR that's meant to raise user awareness that the pickling module is involved.
This commit is contained in:
@@ -44,8 +44,9 @@ def test_serde_transform_input_fn(monkeypatch: MonkeyPatch) -> None:
|
||||
monkeypatch.setenv("DATABRICKS_TOKEN", "my-default-token")
|
||||
|
||||
llm = Databricks(
|
||||
endpoint_name="databricks-mixtral-8x7b-instruct",
|
||||
endpoint_name="some_end_point_name", # Value should not matter for this test
|
||||
transform_input_fn=transform_input,
|
||||
allow_dangerous_deserialization=True,
|
||||
)
|
||||
params = llm._default_params
|
||||
pickled_string = cloudpickle.dumps(transform_input).hex()
|
||||
|
@@ -608,7 +608,9 @@ def test_faiss_local_save_load() -> None:
|
||||
temp_timestamp = datetime.datetime.utcnow().strftime("%Y%m%d-%H%M%S")
|
||||
with tempfile.TemporaryDirectory(suffix="_" + temp_timestamp + "/") as temp_folder:
|
||||
docsearch.save_local(temp_folder)
|
||||
new_docsearch = FAISS.load_local(temp_folder, FakeEmbeddings())
|
||||
new_docsearch = FAISS.load_local(
|
||||
temp_folder, FakeEmbeddings(), allow_dangerous_deserialization=True
|
||||
)
|
||||
assert new_docsearch.index is not None
|
||||
|
||||
|
||||
@@ -620,7 +622,9 @@ async def test_faiss_async_local_save_load() -> None:
|
||||
temp_timestamp = datetime.datetime.utcnow().strftime("%Y%m%d-%H%M%S")
|
||||
with tempfile.TemporaryDirectory(suffix="_" + temp_timestamp + "/") as temp_folder:
|
||||
docsearch.save_local(temp_folder)
|
||||
new_docsearch = FAISS.load_local(temp_folder, FakeEmbeddings())
|
||||
new_docsearch = FAISS.load_local(
|
||||
temp_folder, FakeEmbeddings(), allow_dangerous_deserialization=True
|
||||
)
|
||||
assert new_docsearch.index is not None
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user