Skip to content

Commit

Permalink
Merge pull request #859 from facebookresearch/parlai-agent-state-fix
Browse files Browse the repository at this point in the history
Fixing bug in ParlAI agent state from 1.0.2
  • Loading branch information
JackUrb authored Jul 22, 2022
2 parents c085203 + 28e9839 commit 210e407
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mephisto/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.2
1.0.3
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
# LICENSE file in the root directory of this source tree.

from typing import List, Optional, Dict, Any, Tuple, TYPE_CHECKING
from mephisto.abstractions.blueprint import AgentState
from mephisto.abstractions._subcomponents.agent_state import (
AgentState,
_AgentStateMetadata,
)
import os.path
import time
import dataclasses

if TYPE_CHECKING:
from mephisto.data_model.agent import Agent
Expand Down Expand Up @@ -53,17 +57,18 @@ def _load_data(self) -> None:
self.messages = state["outputs"]["messages"]
self.init_data = state["inputs"]
self.final_submission = state["outputs"].get("final_submission")
self.metadata = state["metadata"]
self.metadata = _AgentStateMetadata(**state["metadata"])

def get_data(self) -> Dict[str, Any]:
"""Return dict with the messages of this agent"""
print(self.metadata)
return {
"outputs": {
"messages": self.messages,
"final_submission": self.final_submission,
},
"inputs": self.init_data,
"metadata": self.metadata,
"metadata": dataclasses.asdict(self.metadata),
}

def get_parsed_data(self) -> Dict[str, Any]:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mephisto"
version = "1.0.2"
version = "1.0.3"
description = "Crowdsourcing made simpler."
license = "MIT"
authors = [
Expand Down Expand Up @@ -91,7 +91,7 @@ pdoc = "^10.0.3"
pylint = "^2.4"
pytest = "^5.0"
pytest-cov = "^2.10.1"
mypy = "^0.931.0"
mypy = "^0.971.0"


[tool.poetry.scripts]
Expand Down

0 comments on commit 210e407

Please sign in to comment.