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","."]
docstr: The chat history.
docstr_tok: ["The","chat","history","."]
code: def history(self) -> list[glm.Content]:
      """The chat history."""
      last = self._last_received
      if last is None:
          return self._history
  
      if last.candidates[0].finish_reason not in (
          glm.Candidate.FinishReason.FINISH_REASON_UNSPECIFIED,
          glm.Candidate.FinishReason.STOP,
          glm.Candidate.FinishReason.MAX_TOKENS,
      ):
          error = generation_types.StopCandidateException(
              last.candidates[0]
          )
          last._error = error
  
      if last._error is not None:
          raise generation_types.BrokenResponseError(
              "Can not build a coherent char history after a broken "
              "streaming response "
              "(See the previous Exception fro details). "
              "To inspect the last response object, use `chat.last`."
              "To remove the last request/response `Content` objects from the chat "
              "call `last_send, last_received = chat.rewind()` and continue "
              "without it."
          ) from last._error
  
      sent = self._last_sent
      received = self._last_received.candidates[0].content
      if not received.role:
          received.role = self._MODEL_ROLE
      self._history.extend([sent, received])
  
      self._last_sent = None
      self._last_received = None
  
      return self._history
  
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 6 for calling the ChatSession obj's underlying member method code with example usage: obj.history() and returns: self, self