
    Ng                         d dl Z d dlmZmZmZmZ d dlmZmZ d dl	m
Z
 h dZdddddedeeeef                  d	eeeef                  d
ee         deegef         f
dZdS )    N)AnyCallableDictOptional)internalwarn_deprecated)is_interactive_env>   	langchainlangchain_corelangchain_community)module_lookupdeprecated_lookupsfallback_modulepackager   r   r   returnc                P     i pi |pi dt           dt          f fd}|S )a^  Create a function that helps retrieve objects from their new locations.

    The goal of this function is to help users transition from deprecated
    imports to new imports.

    The function will raise deprecation warning on loops using
    deprecated_lookups or fallback_module.

    Module lookups will import without deprecation warnings (used to speed
    up imports from large namespaces like llms or chat models).

    This function should ideally only be used with deprecated imports not with
    existing imports that are valid, as in addition to raising deprecation warnings
    the dynamic imports can create other issues for developers (e.g.,
    loss of type information, IDE support for going to definition etc).

    Args:
        package: current package. Use __package__
        module_lookup: maps name of object to the module where it is defined.
            e.g.,
            {
                "MyDocumentLoader": (
                    "langchain_community.document_loaders.my_document_loader"
                )
            }
        deprecated_lookups: same as module look up, but will raise
            deprecation warnings.
        fallback_module: module to import from if the object is not found in
            module_lookup or if module_lookup is not provided.

    Returns:
        A function that imports objects from the specified modules.
    namer   c                    r%| v r |          }|                     d          d         t          vrt          d| dt                     	 t          j        |          }n<# t
          $ r/}|                    d          rt          d| d          | d}~ww xY w	 t          ||           }t                      sAr?| v r;t          j
        d	
          s&t          dddd|  d d d|  d| d|  d           |S # t          $ r}t          d| d|            |d}~ww xY wr	 t          j                  }t          ||           }t                      s;t          j
        d	
          s&t          dddd|  d d d|  d d|  d           |S # t          $ r}t          d d|            |d}~ww xY wt          d d|            )z'Import stores from langchain_community..r   zImporting from z1 is not allowed. Allowed top-level packages are: r   zModule z not found. Please install langchain-community to access this module. You can install it using `pip install -U langchain-community`N   )depthz0.1Fz1.0z
Importing z from z< is deprecated. Please replace deprecated imports:

>> from z import z 

with new imports of:

>> from z
You can use the langchain cli to **automatically** upgrade many imports. Please see documentation here <https://python.langchain.com/docs/versions/v0_2/>)sincependingremovalmessagezmodule z has no attribute )splitALLOWED_TOP_LEVEL_PKGSAssertionError	importlibimport_moduleModuleNotFoundError
startswithgetattrr	   r   is_caller_internalr   	ExceptionAttributeError)	r   
new_modulemoduleeresultall_module_lookupr   r   r   s	        X/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain/_api/module_import.pyimport_by_namez'create_importer.<locals>.import_by_name9   sn     3	):!:!:*40J$$Q'/EEE$Pj P P7MP P  
	"0<<&   (()>?? -X* X X X  	
   ..*,,*  222 $6Q??? '"'$)$)!UT !U !U !U !U+2!U !U<@!U !U ,6	!U !U @D	!U !U !U       $BjBBDBB 
  	"0AA ..)++  $6Q??? '"'$)$)!UT !U !U !U !U+2!U !U<@!U !U ,;	!U !U EI	!U !U !U       $GoGGGG 
 HwHH$HHIIIsJ   A$ $
B.*BB!A D 
D'D""D'-A.F 
G&F<<G)strr   )r   r   r   r   r-   r+   s   ` `` @r,   create_importerr/      s    P P.4"O-:M2OYJS YJS YJ YJ YJ YJ YJ YJ YJ YJ YJv     )r   typingr   r   r   r   langchain_core._apir   r   langchain._api.interactive_envr	   r   r.   r/    r0   r,   <module>r5      s
       0 0 0 0 0 0 0 0 0 0 0 0 9 9 9 9 9 9 9 9 = = = = = =    /337%)E E EE DcN+E !c3h0	E
 c]E seSjE E E E E Er0   