From 25ce30e7fbc38af56b4be9de80198c1b378601f3 Mon Sep 17 00:00:00 2001 From: Haofei Yu <1125027232@qq.com> Date: Thu, 23 May 2024 01:49:10 -0400 Subject: [PATCH 1/2] fix the paper template bug --- research_town/agents/agent_base.py | 2 -- research_town/utils/agent_prompter.py | 19 ++++++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/research_town/agents/agent_base.py b/research_town/agents/agent_base.py index 06b1ee8b..dbb5afa4 100644 --- a/research_town/agents/agent_base.py +++ b/research_town/agents/agent_base.py @@ -15,8 +15,6 @@ from ..utils.author_collector import bfs from ..utils.paper_collector import get_paper_list -ATOM_NAMESPACE = "{http://www.w3.org/2005/Atom}" - class BaseResearchAgent(object): def __init__(self, name: str) -> None: self.profile = self.get_profile(name) diff --git a/research_town/utils/agent_prompter.py b/research_town/utils/agent_prompter.py index f6a9b328..0b53245f 100644 --- a/research_town/utils/agent_prompter.py +++ b/research_town/utils/agent_prompter.py @@ -41,7 +41,10 @@ def summarize_research_field_prompting( "Here is my profile: {profile}" "Here are the keywords: {keywords}" ) - template_input = {"profile": profile, "keywords": keywords} + template_input = { + "profile": profile, + "keywords": "; ".join(keywords) + } query = query_template.format_map(template_input) corpus = [abstract for papers in papers.values() @@ -49,8 +52,18 @@ def summarize_research_field_prompting( related_papers = get_related_papers(corpus, query, num=10) - template_input["papers"] = "; ".join(related_papers) - prompt = query_template.format_map(template_input) + template_input = { + "profile": profile, + "keywords": keywords, + "papers": "; ".join(related_papers) + } + prompt_template = ( + "Given the profile of me, keywords, some recent paper titles and abstracts. Could you summarize the keywords of high level research backgrounds and trends in this field (related to my profile if possible)." + "Here is my profile: {profile}" + "Here are the keywords: {keywords}" + "Here are some recent paper titles and abstracts: {papers}" + ) + prompt = prompt_template.format_map(template_input) return openai_prompting(llm_model, prompt) From 3a4b84a10fdabb112ce446354872d6379886169b Mon Sep 17 00:00:00 2001 From: Haofei Yu <1125027232@qq.com> Date: Thu, 23 May 2024 01:49:35 -0400 Subject: [PATCH 2/2] fix the paper template bug --- research_town/agents/agent_base.py | 1 + research_town/utils/agent_prompter.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/research_town/agents/agent_base.py b/research_town/agents/agent_base.py index dbb5afa4..230cc765 100644 --- a/research_town/agents/agent_base.py +++ b/research_town/agents/agent_base.py @@ -15,6 +15,7 @@ from ..utils.author_collector import bfs from ..utils.paper_collector import get_paper_list + class BaseResearchAgent(object): def __init__(self, name: str) -> None: self.profile = self.get_profile(name) diff --git a/research_town/utils/agent_prompter.py b/research_town/utils/agent_prompter.py index 0b53245f..ea6e4915 100644 --- a/research_town/utils/agent_prompter.py +++ b/research_town/utils/agent_prompter.py @@ -53,7 +53,7 @@ def summarize_research_field_prompting( related_papers = get_related_papers(corpus, query, num=10) template_input = { - "profile": profile, + "profile": profile, "keywords": keywords, "papers": "; ".join(related_papers) }