Skip to content

Commit

Permalink
feat(bench): add single agent function (#749)
Browse files Browse the repository at this point in the history
* add single agent function

* fix ruffs bug

* fix

* change function name

---------

Co-authored-by: Haofei Yu <[email protected]>
  • Loading branch information
Kunlun-Zhu and lwaekfjlk authored Oct 8, 2024
1 parent 950ca38 commit a35d553
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions research_bench/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import arxiv
import requests

from research_town.utils.model_prompting import model_prompting

SEMANTIC_SCHOLAR_API_URL = 'https://api.semanticscholar.org/graph/v1/paper/'


Expand Down Expand Up @@ -83,3 +85,64 @@ def process_paper(paper: arxiv.Result) -> Dict[str, Any]:
'updated': paper.updated.isoformat(),
'references': references,
}


def single_agent_proposal_writing(intros: List[str]) -> Optional[str]:
combined_intro = '\n\n'.join(intros)
prompt = [{
'role': 'user',
'content': f"""You are a skilled research assistant with extensive experience in academic writing and research proposal development. Please write a research proposal abstract based on the following ideas and external data.
The proposal should be structured to answer five core questions. The proposal should be structured to answer five core questions, with each answer clearly labeled in the format: [Question X], where X is the question number (1 to 5). Each answer should be full of details and reasoning and directly address the question.
Here are the five core questions:
[Question 1] - What is the problem?
Formulate the specific research question you aim to address. Only output one question and do not include any more information.
[Question 2] - Why is it interesting and important?
Explain the broader implications of solving this problem for the research community.
Discuss how such paper will affect the future research.
Discuss how addressing this question could advance knowledge or lead to practical applications.
[Question 3] - Why is it hard?
Discuss the challenges and complexities involved in solving this problem.
Explain why naive or straightforward approaches may fail.
Identify any technical, theoretical, or practical obstacles that need to be overcome. MAKE IT CLEAR.
[Question 4] - Why hasn't it been solved before?
Identify gaps or limitations in previous research or existing solutions.
Discuss any barriers that have prevented this problem from being solved until now.
Explain how your approach differs from or improves upon prior work. MAKE IT CLEAR.
[Question 5] - What are the key components of my approach and results?
Outline your proposed methodology in detail, including the method, dataset, metric that you plan to use.
Describe the expected outcomes. MAKE IT CLEAR.
Your goal is to ensure the proposal is clear, concise, and logically structured.
Now you will be given a set of introduction texts from various sources. Please use this information to generate a comprehensive research proposal based on the introductions, you need to look into what future research directions, topics or methods could be use for the proposal writing.
Here are the introduction texts: {combined_intro}
The proposal should be structured to answer five core questions, with each answer clearly labeled in the format: [Question X], where X is the question number (1 to 5).
For example:
[Question 1]: ....
[Question 2]: ....
[Question 3]: ....
[Question 4]: ....
[Question 5]: ....
Now, let's begin:"""
}]

try:
response = model_prompting('gpt-4o-mini', prompt)
return response[0] if response and response[0] else None
except Exception as e:
print(f'Error generating proposal: {e}')
return None

0 comments on commit a35d553

Please sign in to comment.