
    7|h                         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y)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                   ^    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y)	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-mini")
    i   )default
max_tokensTignore)populate_by_namearbitrary_types_allowedextravaluesreturnc                 r   t        |dd      |d<   	 ddl}|d   d|v r|d   nt        d}|j	                  d      s) |j
                  d
i |j                  j                  |d<   |j	                  d	      s) |j                  d
i |j                  j                  |d	<   |S # t        $ r t        d      w xY w)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       d/var/www/html/test/engine/venv/lib/python3.12/site-packages/langchain_community/chat_models/solar.pyvalidate_environmentzSolarChat.validate_environment'   s     #7O_#
	 o.&0F&:z"@V
 zz(#,v}}=}=BBNNF8zz.)%7V%7%7 &&d;; >" )  	? 	s   B! !B6N)__name__
__module____qualname____doc__r   r   int__annotations__r   model_configr   r   r+   r        r*   r   r      sO     D)J)  $L $ 4  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:      sD    '  * ? & 6 N 
E6U5Z 55r3   