Skip to content

Commit

Permalink
update decision making and paper rebuttal (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
chengzr01 committed May 19, 2024
1 parent 63f1fdc commit fa26a63
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 15 deletions.
10 changes: 7 additions & 3 deletions research_town/agents/agent_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
communicate_with_multiple_researchers_prompting,
find_collaborators_prompting,
generate_ideas_prompting,
make_review_decision_prompting,
rebut_review_prompting,
review_paper_prompting,
summarize_research_direction_prompting,
summarize_research_field_prompting,
Expand Down Expand Up @@ -210,9 +212,11 @@ def review_paper(self, external_data: Dict[str, str]) -> str:
return paper_review[0]

def make_review_decision(
self, input: Dict[str, str], external_data: Dict[str, str]
self, submission: Dict[str, str], review: Dict[str, str]
) -> str:
return "accept"
review_decision = make_review_decision_prompting(submission, review)
return "accept" if "accept" in review_decision[0] else "reject"

def rebut_review(self, submission: Dict[str, str], review: Dict[str, str], decision: Dict[str, str]) -> str:
return "It should be accepted."
rebut_review = rebut_review_prompting(submission, review, decision)
return rebut_review[0]
6 changes: 2 additions & 4 deletions research_town/envs/env_paper_rebuttal.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,14 @@ def step(self) -> None:
review_dict[name] = self.agents[name].review_paper(
external_data=self.submission)
self.submit_review(review_dict)
# print("Paper Reviewing", self.review)

# Decision Making
decision_dict: Dict[str, str] = {}
for name, role in self.roles.items():
if role == "reviewer":
decision_dict[name] = self.agents[name].make_review_decision(
input=self.submission, external_data=review_dict)
submission=self.submission, review=review_dict)
self.submit_decision(decision_dict)
# print("Decision Making", self.decision)

# Rebuttal Submitting
rebuttal_dict: Dict[str, str] = {}
Expand All @@ -68,7 +66,7 @@ def step(self) -> None:
submission=self.submission,
review=review_dict,
decision=decision_dict)
# print("Paper Rebuttal", self.rebuttal)
self.submit_rebuttal(rebuttal_dict)

self.turn_number += 1
if self.decision == "accept":
Expand Down
60 changes: 60 additions & 0 deletions research_town/utils/agent_prompting.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,66 @@ def review_paper_prompting(external_data: Dict[str, str], llm_model: Optional[s
return openai_prompting(llm_model, prompt)


def make_review_decision_prompting(submission: Dict[str, str], review: Dict[str, str], llm_model: Optional[str] = "mistralai/Mixtral-8x7B-Instruct-v0.1") -> List[str]:
submission_serialize = []
for _, title in enumerate(submission.keys()):
abstract = submission[title]
submission_entry = f"Title: {title}\nAbstract:{abstract}\n"
submission_serialize.append(submission_entry)
submission_serialize_all = "\n\n".join(submission_serialize)

review_serialize = []
for _, name in enumerate(review.keys()):
content = review[name]
review_entry = f"Name: {name}\nContent: {content}\n"
review_serialize.append(review_entry)
review_serialize_all = "\n\n".join(review_serialize)

prompt_template = (
"Please make an review decision to decide whether the following submission should be accepted or rejected by an academic conference. Here are several reviews from reviewers for this submission. Please indicate your review decision as accept or reject."
"Here is the submission: {submission_serialize_all}"
"Here are the reviews: {review_serialize_all}"
)
template_input = {"submission_serialize_all": submission_serialize_all,
"review_serialize_all": review_serialize_all}
prompt = prompt_template.format_map(template_input)
return openai_prompting(llm_model, prompt)


def rebut_review_prompting(submission: Dict[str, str], review: Dict[str, str], decision: Dict[str, str], llm_model: Optional[str] = "mistralai/Mixtral-8x7B-Instruct-v0.1") -> List[str]:
submission_serialize = []
for _, title in enumerate(submission.keys()):
abstract = submission[title]
submission_entry = f"Title: {title}\nAbstract:{abstract}\n"
submission_serialize.append(submission_entry)
submission_serialize_all = "\n\n".join(submission_serialize)

review_serialize = []
for _, name in enumerate(review.keys()):
content = review[name]
review_entry = f"Name: {name}\nContent: {content}\n"
review_serialize.append(review_entry)
review_serialize_all = "\n\n".join(review_serialize)

decision_serialize = []
for _, name in enumerate(decision.keys()):
content = decision[name]
decision_entry = f"Name: {name}\nDecision: {content}\n"
decision_serialize.append(decision_entry)
decision_serialize_all = "\n\n".join(decision_serialize)

prompt_template = (
"Please write a rebuttal for the following submission you have made to an academic conference. Here are the reviews and decisions from the reviewers. Your rebuttal should rebut the reviews to convince the reviewers to accept your submission."
"Here is the submission: {submission_serialize_all}"
"Here are the reviews: {review_serialize_all}"
"Here are the decisions: {decision_serialize_all}"
)
template_input = {"submission_serialize_all": submission_serialize_all,
"review_serialize_all": review_serialize_all, "decision_serialize_all": decision_serialize_all}
prompt = prompt_template.format_map(template_input)
return openai_prompting(llm_model, prompt)


def communicate_with_multiple_researchers_prompting(
input: Dict[str, str],
llm_model: Optional[str] = "mistralai/Mixtral-8x7B-Instruct-v0.1",
Expand Down
Loading

0 comments on commit fa26a63

Please sign in to comment.