U
    ™ÀÂh  ã                   @   s>   d dl Z d dlmZ d dlmZ e  e¡ZG dd„ deƒZdS )é    N)Úurlparse)Ú
ChatMlflowc                   @   sP   e Zd ZU dZdZeed< eedœdd„ƒZeedœdd„ƒZ	d	dœd
d„Z
d	S )ÚChatDatabricksaù  `Databricks` chat models API.

    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.chat_models import ChatDatabricks

            chat_model = ChatDatabricks(
                target_uri="databricks",
                endpoint="databricks-llama-2-70b-chat",
                temperature=0.1,
            )

            # single input invocation
            print(chat_model.invoke("What is MLflow?").content)

            # single input invocation with streaming response
            for chunk in chat_model.stream("What is MLflow?"):
                print(chunk.content, end="|")
    Ú
databricksÚ
target_uri)Úreturnc                 C   s   dS )zReturn type of chat model.zdatabricks-chat© ©Úselfr   r   úN/tmp/pip-unpacked-wheel-9gdii04g/langchain_community/chat_models/databricks.pyÚ	_llm_type%   s    zChatDatabricks._llm_typec                 C   s   dS )NÚ r   r	   r   r   r   Ú_mlflow_extras*   s    zChatDatabricks._mlflow_extrasNc                 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ChatDatabricks._validate_uri)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚstrÚ__annotations__Úpropertyr   r   r   r   r   r   r   r   	   s   
r   )	ÚloggingÚurllib.parser   Z&langchain_community.chat_models.mlflowr   Ú	getLoggerr   Úloggerr   r   r   r   r   Ú<module>   s   
