except ImportError:
            raise ImportError(
                "Could not import gigachat python package. "
                "Please install it with `pip install gigachat`."
            )
        return values
    @property
    def _identifying_params(self) -> Dict[str, Any]:
        """Get the identifying parameters."""
        return {
            "temperature": self.temperature,
            "model": self.model,
            "profanity": self.profanity,
            "streaming": self.streaming,
            "max_tokens": self.max_tokens,
        }
[docs]class GigaChat(_BaseGigaChat, BaseLLM):
    """`GigaChat` large language models API.
    To use, you should pass login and password to access GigaChat API or use token.
    Example:
        .. code-block:: python
            from langchain_community.llms import GigaChat
            giga = GigaChat(credentials=..., verify_ssl_certs=False)
    """
    def _build_payload(self, messages: List[str]) -> Dict[str, Any]:
        payload: Dict[str, Any] = {
            "messages": [{"role": "user", "content": m} for m in messages],
            "profanity_check": self.profanity,
        }
        if self.temperature is not None:
            payload["temperature"] = self.temperature
        if self.max_tokens is not None:
            payload["max_tokens"] = self.max_tokens
        if self.model:
            payload["model"] = self.model
        if self.verbose:
            logger.info("Giga request: %s", payload)
        return payload
    def _create_llm_result(self, response: Any) -> LLMResult:
        generations = []
        for res in response.choices: