
    Ng                         d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z	m
Z
 ddlmZ ddlmZmZ  edd	d
           G d dee                      ZdS )z!Wrapper around Solar chat models.    )Dict)
deprecated)get_from_dict_or_envpre_init)
ConfigDictField)
ChatOpenAI)SOLAR_SERVICE_URL_BASESolarCommonz0.0.34z1.0zlangchain_upstage.ChatUpstage)sinceremovalalternative_importc                   r    e Zd ZU dZ ed          Zeed<    eddd          Z	e
ded	efd
            ZdS )	SolarChata  Wrapper around Solar large language models.
    To use, you should have the ``openai`` python package installed, and the
    environment variable ``SOLAR_API_KEY`` set with your API key.
    (Solar's chat API is compatible with OpenAI's SDK.)
    Referenced from https://console.upstage.ai/services/solar
    Example:
        .. code-block:: python

            from langchain_community.chat_models.solar import SolarChat

            solar = SolarChat(model="solar-1-mini-chat")
    i   )default
max_tokensTignore)populate_by_namearbitrary_types_allowedextravaluesreturnc                 h   t          |dd          |d<   	 ddl}n# t          $ r t          d          w xY w|d         d|v r|d         nt          d}|                    d          s |j        d
i |j        j        |d<   |                    d	          s |j        d
i |j        j        |d	<   |S )z2Validate that the environment is set up correctly.solar_api_keySOLAR_API_KEYr   NzTCould not import openai python package. Please install it with `pip install openai`.base_url)api_keyr   clientasync_client )	r   openaiImportErrorr
   getOpenAIchatcompletionsAsyncOpenAI)clsr   r!   client_paramss       a/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain_community/chat_models/solar.pyvalidate_environmentzSolarChat.validate_environment'   s    #7O_#
 #
	MMMM 	 	 	?  	 o.&0F&:&:z""@V
 
 zz(## 	O,v}==}==BNF8zz.)) 	%7V%7 & && &; >" s    5N)__name__
__module____qualname____doc__r   r   int__annotations__r   model_configr   r   r+   r        r*   r   r      s           eD)))J))) : $  L $ 4    X  r3   r   N)r/   typingr   langchain_core._apir   langchain_core.utilsr   r   pydanticr   r   langchain_community.chat_modelsr	   langchain_community.llms.solarr
   r   r   r    r3   r*   <module>r:      s    ' '       * * * * * * ? ? ? ? ? ? ? ? & & & & & & & & 6 6 6 6 6 6 N N N N N N N N 
E6U  5 5 5 5 5Z 5 5 5 5 5r3   