
    Mi^)                        % S r SSKrSSKrSSKJr  SSKJr  SSKJr  S\	\   S\S\4S	 jr
S
S\
4SS\
4SSS 4SS\
4SS\
4SS\
4SSS 4SS\
4SS\
4SS\
4S.
r\\\\\\S \4   4   4   \S!'    \R                   " \" \5      S"9S#\S\S \4   4S$ j5       rS\4S% jrS&\S\\\4   4S' jrSS(.S)\S#\S-  S\\\4   4S* jjrSS(.S)\S#\S-  S\S\4S+ jjrS,S-/rg).z!Factory functions for embeddings.    N)Callable)Any)
Embeddingsclskwargsreturnc                     U " S0 UD6$ )N r
   )r   r   s     s/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/langchain/embeddings/base.py_callr      s    ==    zlangchain_azure_ai.embeddingsAzureAIOpenAIApiEmbeddingsModellangchain_openaiAzureOpenAIEmbeddingslangchain_awsBedrockEmbeddingsc                     U " SSU0UD6$ )Nmodel_idr
   r
   r   modelr   s      r   <lambda>r      s    S%B%%B6%Br   langchain_cohereCohereEmbeddingslangchain_google_genaiGoogleGenerativeAIEmbeddingslangchain_google_vertexaiVertexAIEmbeddingslangchain_huggingfaceHuggingFaceEmbeddingsc                     U " SSU0UD6$ )N
model_namer
   r
   r   s      r   r   r      s    S%DE%DV%Dr   langchain_mistralaiMistralAIEmbeddingslangchain_ollamaOllamaEmbeddingsOpenAIEmbeddings)
azure_aiazure_openaibedrockcoheregoogle_genaigoogle_vertexaihuggingface	mistralaiollamaopenai._BUILTIN_PROVIDERS)maxsizeproviderc                 d   U [         ;  a  SU  S[        5        3n[        U5      e[         U    u  p#n [        R                  " U5      n[        XS5      n[        R                  " XHS9$ ! [
         a=  nUR                  SSS9S   R                  SS5      nS	U S
U S3n[        U5      UeSnAff = f)a   Return a factory function that creates an embeddings model for the given provider.

This function is cached to avoid repeated module imports.

Args:
    provider: The name of the model provider (e.g., `'openai'`, `'cohere'`).

        Must be a key in `_BUILTIN_PROVIDERS`.

Returns:
    A callable that accepts model kwargs and returns an `Embeddings` instance for
        the specified provider.

Raises:
    ValueError: If the provider is not in `_BUILTIN_PROVIDERS`.
    ImportError: If the provider's integration package is not installed.

Provider 'E' is not supported.
Supported providers and their required packages:
.   )maxsplitr   _-zCould not import z5 python package. Please install it with `pip install `N)r   )r1   _get_provider_list
ValueError	importlibimport_moduleImportErrorsplitreplacegetattr	functoolspartial)	r3   msgmodule_name
class_namecreator_funcmoduleepkgr   s	            r   _get_embeddings_class_creatorrN   9   s    & ))
 #A!#$& 	
 o,>x,H)K\&((5 &
%C\33  &a03;;CE!#&[\_[``ab#A%&s   A( (
B/28B**B/c                  V    SR                  S [        R                  5        5       5      $ )z3Get formatted list of providers and their packages.
c              3   \   #    U  H"  u  pS U SUS   R                  SS5       3v   M$     g7f)z  - z: r   r:   r;   N)rC   ).0prM   s      r   	<genexpr>%_get_provider_list.<locals>.<genexpr>b   s3      =W61$qcCFNN3,-.=Ws   *,)joinr1   itemsr
   r   r   r=   r=   `   s)    99 =O=U=U=W  r   r!   c                 T   SU ;  a%  SU  S[         R                  5        3n[        U5      eU R                  SS5      u  p#UR	                  5       R                  5       nUR                  5       nU[         ;  a  SU S[        5        3n[        U5      eU(       d  Sn[        U5      eX#4$ )a  Parse a model string into provider and model name components.

The model string should be in the format 'provider:model-name', where provider
is one of the supported providers.

Args:
    model_name: A model string in the format 'provider:model-name'

Returns:
    A tuple of (provider, model_name)

Example:
    ```python
    _parse_model_string("openai:text-embedding-3-small")
    # Returns: ("openai", "text-embedding-3-small")

    _parse_model_string("bedrock:amazon.titan-embed-text-v1")
    # Returns: ("bedrock", "amazon.titan-embed-text-v1")
    ```

Raises:
    ValueError: If the model string is not in the correct format or
        the provider is unsupported

:zInvalid model format 'z'.
Model name must be in format 'provider:model-name'
Example valid model strings:
  - openai:text-embedding-3-small
  - bedrock:amazon.titan-embed-text-v1
  - cohere:embed-english-v3.0
Supported providers: r8   r5   r6   Model name cannot be empty)r1   keysr>   rB   lowerstripr=   )r!   rG   r3   r   s       r   _parse_model_stringr^   g   s    4 *$ZL 1$ %7$;$;$=#>@ 	 o &&sA.OH~~%%'HKKME))
 #A!#$& 	
 o*o?r   r3   r   c                   U R                  5       (       d  Sn[        U5      eUc  SU ;   a  [        U 5      u  pOU nU(       d"  S[        R	                  5        3n[        U5      eU[        ;  a  SU S[        5        3n[        U5      eX4$ )NrZ   rY   zMust specify either:
1. A model string in format 'provider:model-name'
   Example: 'openai:text-embedding-3-small'
2. Or explicitly set provider from: r5   r6   )r]   r>   r^   r1   r[   r=   )r   r3   rG   r!   s       r   _infer_model_and_providerra      s    
 ;;==*oC5L259*
3 "&&()	+ 	 o))
 #A!#$& 	
 or   c                    U (       d3  [         R                  5       nSSR                  U5       3n[        U5      e[	        XS9u  p[        U5      " SSU0UD6$ )aC  Initialize an embedding model from a model name and optional provider.

!!! note

    Requires the integration package for the chosen model provider to be installed.

    See the `model_provider` parameter below for specific package names
    (e.g., `pip install langchain-openai`).

    Refer to the [provider integration's API reference](https://docs.langchain.com/oss/python/integrations/providers)
    for supported model parameters to use as `**kwargs`.

Args:
    model: The name of the model, e.g. `'openai:text-embedding-3-small'`.

        You can also specify model and model provider in a single argument using
        `'{model_provider}:{model}'` format, e.g. `'openai:text-embedding-3-small'`.
    provider: The model provider if not specified as part of the model arg
        (see above).

        Supported `provider` values and the corresponding integration package
        are:

        - `openai`                  -> [`langchain-openai`](https://docs.langchain.com/oss/python/integrations/providers/openai)
        - `azure_ai`                -> [`langchain-azure-ai`](https://docs.langchain.com/oss/python/integrations/providers/microsoft)
        - `azure_openai`            -> [`langchain-openai`](https://docs.langchain.com/oss/python/integrations/providers/openai)
        - `bedrock`                 -> [`langchain-aws`](https://docs.langchain.com/oss/python/integrations/providers/aws)
        - `cohere`                  -> [`langchain-cohere`](https://docs.langchain.com/oss/python/integrations/providers/cohere)
        - `google_vertexai`         -> [`langchain-google-vertexai`](https://docs.langchain.com/oss/python/integrations/providers/google)
        - `huggingface`             -> [`langchain-huggingface`](https://docs.langchain.com/oss/python/integrations/providers/huggingface)
        - `mistralai`               -> [`langchain-mistralai`](https://docs.langchain.com/oss/python/integrations/providers/mistralai)
        - `ollama`                  -> [`langchain-ollama`](https://docs.langchain.com/oss/python/integrations/providers/ollama)

    **kwargs: Additional model-specific parameters passed to the embedding model.

        These vary by provider. Refer to the specific model provider's
        [integration reference](https://reference.langchain.com/python/integrations/)
        for all available parameters.

Returns:
    An `Embeddings` instance that can generate embeddings for text.

Raises:
    ValueError: If the model provider is not supported or cannot be determined
    ImportError: If the required provider package is not installed

???+ example

    ```python
    # pip install langchain langchain-openai

    # Using a model string
    model = init_embeddings("openai:text-embedding-3-small")
    model.embed_query("Hello, world!")

    # Using explicit provider
    model = init_embeddings(model="text-embedding-3-small", provider="openai")
    model.embed_documents(["Hello, world!", "Goodbye, world!"])

    # With additional parameters
    model = init_embeddings("openai:text-embedding-3-small", api_key="sk-...")
    ```

!!! version-added "Added in `langchain` 0.3.9"

z2Must specify model name. Supported providers are: z, r_   r   r
   )r1   r[   rV   r>   ra   rN   )r   r3   r   	providersrG   r!   s         r   init_embeddingsrd      s[    P &++-	B499YCWBXYo4UNH(2NNvNNr   r   rd   )__doc__rE   r?   collections.abcr   typingr   langchain_core.embeddingsr   typer   r1   dictstrtuple__annotations__	lru_cachelenrN   r=   r^   ra   rd   __all__r
   r   r   <module>rq      s   '   $  0tJ 3 : 
 12SUZ[')@%HB
 "#5u=-/MuU35I5QD
 ()>F!#5u=!#5u=%M DeChsJ.G$GHHI (, S!345#4C #4HS*_4M #4 6#4LC 4C 4E#s(O 4t     Dj  38_	 H  NONO DjNO 	NO
 NOd r   