class_docstr: Contains an ongoing conversation with the model.
  
  >>> model = genai.GenerativeModel(model="gemini-pro")
  >>> chat = model.start_chat()
  >>> response = chat.send_message("Hello")
  >>> print(response.text)
  >>> response = chat.send_message(...)
  
  This `ChatSession` object collects the messages sent and received, in its
  `ChatSession.history` attribute.
  
  Arguments:
      model: The model to use in the chat.
      history: A chat history to initialize the object with.
class_docstr_tok: ["Contains","an","ongoing","conversation","with","the","model",".",">",">",">","model","=","genai.GenerativeModel","(","model=","''","gemini-pro","''",")",">",">",">","chat","=","model.start_chat","(",")",">",">",">","response","=","chat.send_message","(","``","Hello","''",")",">",">",">","print","(","response.text",")",">",">",">","response","=","chat.send_message","(","...",")","This","`","ChatSession","`","object","collects","the","messages","sent","and","received",",","in","its","`","ChatSession.history","`","attribute",".","Arguments",":","model",":","The","model","to","use","in","the","chat",".","history",":","A","chat","history","to","initialize","the","object","with","."]
code: def send_message(
      self,
      content: content_types.ContentType,
      *,
      generation_config: generation_types.GenerationConfigType = None,
      safety_settings: safety_types.SafetySettingOptions = None,
      stream: bool = False,
      **kwargs,
  ) -> generation_types.GenerateContentResponse:
      content = content_types.to_content(content)
      if not content.role:
          content.role = self._USER_ROLE
      history = self.history[:]
      history.append(content)
  
      generation_config = generation_types.to_generation_config_dict(
          generation_config
      )
      if generation_config.get("candidate_count", 1) > 1:
          raise ValueError("Can't chat with `candidate_count > 1`")
      response = self.model.generate_content(
          contents=history,
          generation_config=generation_config,
          safety_settings=safety_settings,
          stream=stream,
          **kwargs,
      )
  
      if response.prompt_feedback.block_reason:
          raise generation_types.BlockedPromptException(
              response.prompt_feedback
          )
  
      if not stream:
          if response.candidates[0].finish_reason not in (
              glm.Candidate.FinishReason.FINISH_REASON_UNSPECIFIED,
              glm.Candidate.FinishReason.STOP,
              glm.Candidate.FinishReason.MAX_TOKENS,
          ):
              raise generation_types.StopCandidateException(
                  response.candidates[0]
              )
  
      self._last_sent = content
      self._last_received = response
  
      return response
  
imports: from __future__ import annotations
  from collections.abc import Iterable
  import dataclasses
  import textwrap
  from typing import Union
  from google.ai import generativelanguage
  from google.generativeai import client
  from google.generativeai import string_utils
  from google.generativeai.types import content_types
  from google.generativeai.types import generation_types
  from google.generativeai.types import safety_types
label_desc: Use image node_id 2 for calling the ChatSession obj's underlying member method code with example usage: obj.send_message(content) and returns: response