This commit is contained in:
Eugene Yurtsev
2024-05-02 15:16:23 -04:00
parent a260e7a2d4
commit fa2cb98a16
3 changed files with 25 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
from langchain.chains.ernie_functions.base import (
from langchain_community.chains.ernie_functions.base import (
convert_to_ernie_function,
create_ernie_fn_chain,
create_ernie_fn_runnable,

View File

@@ -3,20 +3,27 @@ from typing import TYPE_CHECKING, Any
from langchain._api import create_importer
if TYPE_CHECKING:
from langchain_community.chains.ernie_functions.base import convert_python_function_to_ernie_function, convert_to_ernie_function, create_ernie_fn_chain, create_ernie_fn_runnable, create_structured_output_chain, create_structured_output_runnable, get_ernie_output_parser
from langchain_community.chains.ernie_functions.base import (
convert_python_function_to_ernie_function,
convert_to_ernie_function,
create_ernie_fn_chain,
create_ernie_fn_runnable,
create_structured_output_chain,
create_structured_output_runnable,
get_ernie_output_parser,
)
# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED_LOOKUP = {
"convert_python_function_to_ernie_function": "langchain_community.chains.ernie_functions.base",
"convert_to_ernie_function": "langchain_community.chains.ernie_functions.base",
"create_ernie_fn_chain": "langchain_community.chains.ernie_functions.base",
"create_ernie_fn_runnable": "langchain_community.chains.ernie_functions.base",
"create_structured_output_chain": "langchain_community.chains.ernie_functions.base",
"create_structured_output_runnable": "langchain_community.chains.ernie_functions.base",
"get_ernie_output_parser": "langchain_community.chains.ernie_functions.base",
"convert_python_function_to_ernie_function": "langchain_community.chains.ernie_functions.base",
"convert_to_ernie_function": "langchain_community.chains.ernie_functions.base",
"create_ernie_fn_chain": "langchain_community.chains.ernie_functions.base",
"create_ernie_fn_runnable": "langchain_community.chains.ernie_functions.base",
"create_structured_output_chain": "langchain_community.chains.ernie_functions.base",
"create_structured_output_runnable": "langchain_community.chains.ernie_functions.base",
"get_ernie_output_parser": "langchain_community.chains.ernie_functions.base",
}
_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)
@@ -28,11 +35,11 @@ def __getattr__(name: str) -> Any:
__all__ = [
"convert_python_function_to_ernie_function",
"convert_to_ernie_function",
"create_ernie_fn_chain",
"create_ernie_fn_runnable",
"create_structured_output_chain",
"create_structured_output_runnable",
"get_ernie_output_parser"
"convert_python_function_to_ernie_function",
"convert_to_ernie_function",
"create_ernie_fn_chain",
"create_ernie_fn_runnable",
"create_structured_output_chain",
"create_structured_output_runnable",
"get_ernie_output_parser",
]

View File

@@ -4,7 +4,7 @@ import numpy as np
from langchain_core.callbacks.manager import Callbacks
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_core.pydantic_v1 import root_validator, Field
from langchain_core.pydantic_v1 import Field, root_validator
from langchain.retrievers.document_compressors.base import (
BaseDocumentCompressor,