Skip to content

Commit

Permalink
langchain[patch]: add deprecation warnings (#26853)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccurme committed Sep 25, 2024
1 parent 82b5b77 commit 13acf9e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
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

0 comments on commit 13acf9e

Please sign in to comment.