Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

langchain[patch]: add deprecation warnings #26853

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions libs/langchain/langchain/chains/combine_documents/map_reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from typing import Any, Dict, List, Optional, Tuple, Type

from langchain_core._api import deprecated
from langchain_core.callbacks import Callbacks
from langchain_core.documents import Document
from langchain_core.runnables.config import RunnableConfig
Expand All @@ -15,6 +16,15 @@
from langchain.chains.llm import LLMChain


@deprecated(
since="0.3.1",
removal="1.0",
message=(
"This class is deprecated. Please see the migration guide here for "
"a recommended replacement: "
"https://python.langchain.com/docs/versions/migrating_chains/map_reduce_chain/"
),
)
class MapReduceDocumentsChain(BaseCombineDocumentsChain):
"""Combining documents by mapping a chain over them, then combining results.

Expand Down
10 changes: 10 additions & 0 deletions libs/langchain/langchain/chains/combine_documents/map_rerank.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from typing import Any, Dict, List, Optional, Sequence, Tuple, Type, Union, cast

from langchain_core._api import deprecated
from langchain_core.callbacks import Callbacks
from langchain_core.documents import Document
from langchain_core.runnables.config import RunnableConfig
Expand All @@ -16,6 +17,15 @@
from langchain.output_parsers.regex import RegexParser


@deprecated(
since="0.3.1",
removal="1.0",
message=(
"This class is deprecated. Please see the migration guide here for "
"a recommended replacement: "
"https://python.langchain.com/docs/versions/migrating_chains/map_rerank_docs_chain/" # noqa: E501
),
)
class MapRerankDocumentsChain(BaseCombineDocumentsChain):
"""Combining documents by mapping a chain over them, then reranking results.

Expand Down
10 changes: 10 additions & 0 deletions libs/langchain/langchain/chains/combine_documents/reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from typing import Any, Callable, List, Optional, Protocol, Tuple

from langchain_core._api import deprecated
from langchain_core.callbacks import Callbacks
from langchain_core.documents import Document
from pydantic import ConfigDict
Expand Down Expand Up @@ -121,6 +122,15 @@ async def acollapse_docs(
return Document(page_content=result, metadata=combined_metadata)


@deprecated(
since="0.3.1",
removal="1.0",
message=(
"This class is deprecated. Please see the migration guide here for "
"a recommended replacement: "
"https://python.langchain.com/docs/versions/migrating_chains/map_reduce_chain/"
),
)
class ReduceDocumentsChain(BaseCombineDocumentsChain):
"""Combine documents by recursively reducing them.

Expand Down
10 changes: 10 additions & 0 deletions libs/langchain/langchain/chains/combine_documents/refine.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from typing import Any, Dict, List, Tuple

from langchain_core._api import deprecated
from langchain_core.callbacks import Callbacks
from langchain_core.documents import Document
from langchain_core.prompts import BasePromptTemplate, format_document
Expand All @@ -20,6 +21,15 @@ def _get_default_document_prompt() -> PromptTemplate:
return PromptTemplate(input_variables=["page_content"], template="{page_content}")


@deprecated(
since="0.3.1",
removal="1.0",
message=(
"This class is deprecated. Please see the migration guide here for "
"a recommended replacement: "
"https://python.langchain.com/docs/versions/migrating_chains/refine_docs_chain/" # noqa: E501
),
)
class RefineDocumentsChain(BaseCombineDocumentsChain):
"""Combine documents by doing a first pass and then refining on more documents.

Expand Down
Loading