class_docstr: OPT BB3 Agent.
class_docstr_tok: ["OPT","BB3","Agent","."]
docstr: Add memories to the memory decision observation.
  
  :param ag_obs:
      incoming mdm observation
  
  :return mdm_obs:
      return mdm observation with memories in the context.
docstr_tok: ["Add","memories","to","the","memory","decision","observation",".",":","param","ag_obs",":","incoming","mdm","observation",":","return","mdm_obs",":","return","mdm","observation","with","memories","in","the","context","."]
code: def get_mdm_observation(self, ag_obs: Message) -> Message:
      """
      Add memories to the memory decision observation.
  
      :param ag_obs:
          incoming mdm observation
  
      :return mdm_obs:
          return mdm observation with memories in the context.
      """
      self.agents[Module.MEMORY_DECISION].reset()
  
      original_text = ag_obs["text"]
      self_memory_text, partner_memory_text = "", ""
      self_memories = [
          m.replace(f"{self.self_memory_prefix}: ", "")
          for m in self.memories
          if m.startswith(self.self_memory_prefix)
      ]
      if self_memories:
          self_memory_text = f"{PROMPT.MEMORY_KNOWLEDGE_PREFIX}: {self.self_memory_prefix}: {' '.join(self_memories)}\n"
      partner_memories = [
          m.replace(f"{self.partner_memory_prefix}: ", "")
          for m in self.memories
          if m.startswith(self.partner_memory_prefix)
      ]
      if partner_memories:
          partner_memory_text = f"{PROMPT.MEMORY_KNOWLEDGE_PREFIX}: {self.partner_memory_prefix}: {' '.join(partner_memories)}\n"
  
      new_text = (
          f"{self_memory_text}{partner_memory_text}{original_text}"
      )
      ag_obs.force_set("text", new_text)
      return ag_obs
  
imports: import copy
  import random
  from typing import List, Optional, Dict, Any, Union, Tuple
  from parlai.agents.rag.retrievers import Document
  from parlai.core.agents import Agent, create_agent
  from parlai.core.message import Message
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  import parlai.utils.logging
  from projects.bb3.agents.module import Module
  from projects.bb3.agents.r2c2_bb3_agent import BlenderBot3Agent
  from projects.bb3.agents.opt_api_agent import BB3OPTAgent
  from projects.bb3.agents.search_agent import SearchAgent
  from projects.bb3.agents.utils import Decision, APIUtils, is_opener, DisplayUtils, set_failed_reply
  import projects.bb3.prompts
label_desc: Use image node_id 9 for calling the BlenderBot3Agent obj's underlying member method code with example usage: obj.get_mdm_observation(ag_obs) and returns: ag_obs