class_docstr: uses mindsdb database to store messages
class_docstr_tok: ["uses","mindsdb","database","to","store","messages"]
code: def _get_chat_history(self, chat_id):
      chat_bot_id = self.chat_task.bot_id
      query = (
          db.ChatBotsHistory.query.filter(
              db.ChatBotsHistory.chat_bot_id == chat_bot_id,
              db.ChatBotsHistory.destination == chat_id,
          )
          .order_by(db.ChatBotsHistory.sent_at)
          .limit(self.MAX_DEPTH)
      )
  
      result = [
          ChatBotMessage(
              rec.type,
              rec.text,
              rec.user,
              sent_at=rec.sent_at,
          )
          for rec in query
      ]
      return result
  
imports: from mindsdb_sql.parser.ast import Identifier, Select, BinaryOperation, Constant, OrderBy
  from mindsdb.interfaces.storage import db
  from .types import ChatBotMessage
label_desc: Use image node_id 2 for calling the DBMemory obj's underlying member method code with example usage: obj._get_chat_history(chat_id) and returns: result