Skip to content

Commit

Permalink
support empty class structure (#3)
Browse files Browse the repository at this point in the history
* just create a structure

* pass all tests
  • Loading branch information
lwaekfjlk authored May 3, 2024
1 parent d5b852b commit 11c667c
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 0 deletions.
File renamed without changes.
Empty file added research_town/__init__.py
Empty file.
32 changes: 32 additions & 0 deletions research_town/agent_base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from typing import List, Tuple, Dict


class BaseResearchAgent(object):
def __init__(self, name: str) -> None:
self.profile = self.get_profile(name)
self.memory: Dict[str, str] = {}

def get_profile(self, name: str) -> Dict[str, str]:
return {'name': 'John Doe', 'age': '25', 'location': 'New York'}

def communicate(self, message: Dict[str, str]) -> str:
return 'hello'

def read_paper(self, input: Dict[str, str], external_data: Dict[str, str]) -> str:
return 'reading paper'

def find_collaborators(self, input: Dict[str, str]) -> List[str]:
return ['Alice', 'Bob', 'Charlie']

def generate_idea(self, input: Dict[str, str], external_data: Dict[str, str]) -> str:
return 'idea'

def write_paper(self, input: Dict[str, str], external_data: Dict[str, str]) -> str:
return 'writing paper'

def review_paper(self, input: Dict[str, str], external_data: Dict[str, str]) -> str:
return 'review comments'

def make_review_decision(self, input: Dict[str, str], external_data: Dict[str, str]) -> str:
return 'accept'

12 changes: 12 additions & 0 deletions research_town/env_base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from typing import List, Tuple, Dict
from .agent_base import BaseResearchAgent


class BaseMultiAgentEnv(object):
def __init__(self, agent_dict: Dict[str, str]) -> None:
self.agents: Dict[str, BaseResearchAgent] = {}
for agent_name, agent in agent_dict.items():
self.agents[agent_name] = BaseResearchAgent(agent)

def step(self) -> None:
raise NotImplementedError
18 changes: 18 additions & 0 deletions research_town/env_paper_rebuttal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from typing import List, Tuple, Dict
from .agent_base import BaseResearchAgent
from .env_base import BaseMultiAgentEnv

class PaperRebuttalMultiAgentEnv(BaseMultiAgentEnv):
def __init__(self, agent_dict: Dict[str, str]) -> None:
super().__init__(agent_dict)

def step(self) -> None:
for agent_name, agent in self.agents.items():
paper_summary = agent.read_paper({}, {})
paper_review = agent.review_paper({}, {})
review_decision = agent.make_review_decision({}, {})

self.submit_rebuttal()

def submit_rebuttal(self) -> None:
pass
19 changes: 19 additions & 0 deletions research_town/env_paper_submission.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from typing import List, Tuple, Dict
from .agent_base import BaseResearchAgent
from .env_base import BaseMultiAgentEnv

class PaperSubmissionMultiAgentEnvironment(BaseMultiAgentEnv):
def __init__(self, agent_dict: Dict[str, str]) -> None:
super(PaperSubmissionMultiAgentEnvironment, self).__init__(agent_dict)

def step(self) -> None:
for agent_name, agent in self.agents.items():
agent.read_paper({}, {})
agent.find_collaborators({})
agent.generate_idea({}, {})
agent.write_paper({}, {})

self.submit_paper()

def submit_paper(self) -> None:
pass
14 changes: 14 additions & 0 deletions research_town/kb_base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from typing import List, Tuple, Dict

class BaseKnowledgeBase(object):
def __init__(self) -> None:
self.data: Dict[str, str] = {}

def update_kb(self, data: Dict[str, str]) -> None:
self.data.update(data)

def add_data(self, data: Dict[str, str]) -> None:
self.data.update(data)

def get_data(self, key: str) -> str:
return self.data[key]

0 comments on commit 11c667c

Please sign in to comment.