
    ih                         d dl Z d dlmZ d dlmZ d dlmZ  e j                  e      Z	 eddd       G d	 d
e             Z
y)    N)urlparse)
deprecated)
ChatMlflowz0.3.3z1.0z#databricks_langchain.ChatDatabricks)sinceremovalalternative_importc                   V    e Zd ZU dZdZeed<   	 edefd       Zedefd       Z	d	dZ
y)
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                      y)zReturn type of chat model.zdatabricks-chat selfs    h/var/www/html/dev/engine/venv/lib/python3.12/site-packages/langchain_community/chat_models/databricks.py	_llm_typezChatDatabricks._llm_type,   s     !    c                      y)N r   r   s    r   _mlflow_extraszChatDatabricks._mlflow_extras1   s    r   Nc                 ~    | j                   dk(  ry t        | j                         j                  dk7  rt        d      y )Nr   zBInvalid target URI. The target URI must be a valid databricks URI.)r   r   scheme
ValueErrorr   s    r   _validate_urizChatDatabricks._validate_uri5   s=    ??l*DOO$++|;T  <r   )r   N)__name__
__module____qualname____doc__r   str__annotations__propertyr   r   r   r   r   r   r
   r
      sO    0 #J"<!3 ! !   r   r
   )loggingurllib.parser   langchain_core._apir   &langchain_community.chat_models.mlflowr   	getLoggerr   loggerr
   r   r   r   <module>r)      sL     ! * =			8	$ 
<
,Z ,
,r   