mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-05 12:48:12 +00:00
langchain[patch]: add deprecation warnings (#26853)
This commit is contained in:
parent
82b5b77940
commit
13acf9e6b0
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any, Dict, List, Optional, Tuple, Type
|
from typing import Any, Dict, List, Optional, Tuple, Type
|
||||||
|
|
||||||
|
from langchain_core._api import deprecated
|
||||||
from langchain_core.callbacks import Callbacks
|
from langchain_core.callbacks import Callbacks
|
||||||
from langchain_core.documents import Document
|
from langchain_core.documents import Document
|
||||||
from langchain_core.runnables.config import RunnableConfig
|
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
|
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):
|
class MapReduceDocumentsChain(BaseCombineDocumentsChain):
|
||||||
"""Combining documents by mapping a chain over them, then combining results.
|
"""Combining documents by mapping a chain over them, then combining results.
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any, Dict, List, Optional, Sequence, Tuple, Type, Union, cast
|
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.callbacks import Callbacks
|
||||||
from langchain_core.documents import Document
|
from langchain_core.documents import Document
|
||||||
from langchain_core.runnables.config import RunnableConfig
|
from langchain_core.runnables.config import RunnableConfig
|
||||||
@ -16,6 +17,15 @@ from langchain.chains.llm import LLMChain
|
|||||||
from langchain.output_parsers.regex import RegexParser
|
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):
|
class MapRerankDocumentsChain(BaseCombineDocumentsChain):
|
||||||
"""Combining documents by mapping a chain over them, then reranking results.
|
"""Combining documents by mapping a chain over them, then reranking results.
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any, Callable, List, Optional, Protocol, Tuple
|
from typing import Any, Callable, List, Optional, Protocol, Tuple
|
||||||
|
|
||||||
|
from langchain_core._api import deprecated
|
||||||
from langchain_core.callbacks import Callbacks
|
from langchain_core.callbacks import Callbacks
|
||||||
from langchain_core.documents import Document
|
from langchain_core.documents import Document
|
||||||
from pydantic import ConfigDict
|
from pydantic import ConfigDict
|
||||||
@ -121,6 +122,15 @@ async def acollapse_docs(
|
|||||||
return Document(page_content=result, metadata=combined_metadata)
|
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):
|
class ReduceDocumentsChain(BaseCombineDocumentsChain):
|
||||||
"""Combine documents by recursively reducing them.
|
"""Combine documents by recursively reducing them.
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Any, Dict, List, Tuple
|
from typing import Any, Dict, List, Tuple
|
||||||
|
|
||||||
|
from langchain_core._api import deprecated
|
||||||
from langchain_core.callbacks import Callbacks
|
from langchain_core.callbacks import Callbacks
|
||||||
from langchain_core.documents import Document
|
from langchain_core.documents import Document
|
||||||
from langchain_core.prompts import BasePromptTemplate, format_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}")
|
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):
|
class RefineDocumentsChain(BaseCombineDocumentsChain):
|
||||||
"""Combine documents by doing a first pass and then refining on more documents.
|
"""Combine documents by doing a first pass and then refining on more documents.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user