U
    ™ÀÂh÷  ã                   @  sZ   d dl mZ d dlmZmZ d dlmZ d dlmZ ddddœd	d
„Z	G dd„ deƒZ
dS )é    )Úannotations)ÚIteratorÚList)Úurlparse)ÚMlflowEmbeddingsz	List[str]ÚintzIterator[List[str]])ÚtextsÚsizeÚreturnc                 c  s,   t dt| ƒ|ƒD ]}| ||| … V  qd S )Nr   )ÚrangeÚlen)r   r	   Úi© r   úM/tmp/pip-unpacked-wheel-9gdii04g/langchain_community/embeddings/databricks.pyÚ_chunk	   s    r   c                   @  s>   e Zd ZU dZdZded< eddœdd„ƒZddœd	d
„ZdS )ÚDatabricksEmbeddingsa¸  Databricks embeddings.

    To use, you should have the ``mlflow`` python package installed.
    For more information, see https://mlflow.org/docs/latest/llms/deployments.

    Example:
        .. code-block:: python

            from langchain_community.embeddings import DatabricksEmbeddings

            embeddings = DatabricksEmbeddings(
                target_uri="databricks",
                endpoint="embeddings",
            )
    Ú
databricksÚstrÚ
target_uri)r
   c                 C  s   dS )NÚ r   ©Úselfr   r   r   Ú_mlflow_extras"   s    z#DatabricksEmbeddings._mlflow_extrasÚNonec                 C  s*   | j dkrd S t| j ƒjdkr&tdƒ‚d S )Nr   zBInvalid target URI. The target URI must be a valid databricks URI.)r   r   ÚschemeÚ
ValueErrorr   r   r   r   Ú_validate_uri&   s    
ÿz"DatabricksEmbeddings._validate_uriN)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__Úpropertyr   r   r   r   r   r   r      s
   
r   N)Ú
__future__r   Útypingr   r   Úurllib.parser   Z%langchain_community.embeddings.mlflowr   r   r   r   r   r   r   Ú<module>   s
   