class_docstr: Abstract class for end-to-end tests of one-turn ParlAIChatBlueprint tasks.
class_docstr_tok: ["Abstract","class","for","end-to-end","tests","of","one-turn","ParlAIChatBlueprint","tasks","."]
docstr: Remove agent state messages that do not contain text and are thus not useful for
  testing the crowdsourcing task.
code: def _filter_agent_state_data(self, agent_state: dict) -> dict:
      """
      Remove agent state messages that do not contain text and are thus not useful for
      testing the crowdsourcing task.
      """
      filtered_messages = [
          m for m in agent_state["outputs"]["messages"] if "text" in m
      ]
      filtered_agent_state = {
          "inputs": agent_state["inputs"],
          "outputs": {
              **agent_state["outputs"],
              "messages": filtered_messages,
          },
      }
      return filtered_agent_state
  
imports: import os
  import random
  import tempfile
  import time
  import unittest
  from typing import Any, Dict, List, Optional, Sequence, Union
  import numpy
  import torch
  from parlai.utils import logging
  from hydra.experimental import compose, initialize
  from mephisto.abstractions.blueprint import SharedTaskState
  from mephisto.abstractions.databases.local_database import LocalMephistoDB
  from mephisto.data_model.task_run import TaskRunArgs
  from mephisto.operations.operator import Operator
  from mephisto.tools.scripts import augment_config_from_db
  from mephisto.utils.metrics import InaccessiblePrometheusServer
  from pytest_regressions.data_regression import DataRegressionFixture
label_desc: Use image node_id 4 for calling the AbstractParlAIChatTest obj's underlying member method code with example usage: obj._filter_agent_state_data(agent_state) and returns: filtered_agent_state