langchain[patch]: add deprecation warnings (#26853)

This commit is contained in:
ccurme 2024-09-25 09:26:44 -04:00 committed by GitHub
parent 82b5b77940
commit 13acf9e6b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 40 additions and 0 deletions

View File

@ -4,6 +4,7 @@ from __future__ import annotations
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
@ -15,6 +16,15 @@ from langchain.chains.combine_documents.reduce import ReduceDocumentsChain
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.

View File

@ -4,6 +4,7 @@ from __future__ import annotations
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
@ -16,6 +17,15 @@ from langchain.chains.llm import LLMChain
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.

View File

@ -4,6 +4,7 @@ from __future__ import annotations
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
@ -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.

View File

@ -4,6 +4,7 @@ from __future__ import annotations
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
@ -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.