
    OKi](                        % 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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     [/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/langchain/embeddings/base.py_callr      s    ==    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_openaibedrockcoheregoogle_genaigoogle_vertexaihuggingface	mistralaiollamaopenai._BUILTIN_PROVIDERS)maxsizeproviderc                 B   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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:
_-zCould not import z5 python package. Please install it with `pip install `N)r   )
r/   _get_provider_list
ValueError	importlibimport_moduleImportErrorreplacegetattr	functoolspartial)	r1   msgmodule_name
class_namecreator_funcmoduleepkgr   s	            r   _get_embeddings_class_creatorrH   8   s    & ))
 #A!#$& 	
 o,>x,H)K\&((5 &
%C\33  &!!#s+!#&[\_[``ab#A%&s   A( (
B2'B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   r5   r6   N)r=   ).0prG   s      r   	<genexpr>%_get_provider_list.<locals>.<genexpr>a   s3      =W61$qcCFNN3,-.=Ws   *,)joinr/   itemsr
   r   r   r8   r8   _   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:    r3   r4   Model name cannot be empty)r/   keysr9   splitlowerstripr8   )r    rA   r1   r   s       r   _parse_model_stringrZ   f   s    4 *$ZL 1$ %7$;$;$=#>@ 	 o &&sA.OH~~%%'HKKME))
 #A!#$& 	
 o*o?r   r1   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$ )NrU   rS   zMust specify either:
1. A model string in format 'provider:model-name'
   Example: 'openai:text-embedding-3-small'
2. Or explicitly set provider from: r3   r4   )rY   r9   rZ   r/   rV   r8   )r   r1   rA   r    s       r   _infer_model_and_providerr]      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$ )a  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_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
   )r/   rV   rP   r9   r]   rH   )r   r1   r   	providersrA   r    s         r   init_embeddingsr`      s[    N &++-	B499YCWBXYo4UNH(2NNvNNr   r   r`   )__doc__r?   r:   collections.abcr   typingr   langchain_core.embeddingsr   typer   r/   dictstrtuple__annotations__	lru_cachelenrH   r8   rZ   r]   r`   __all__r
   r   r   <module>rm      s   '   $  0tJ 3 : 
 ()@%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  MOMO DjMO 	MO
 MOb r   