Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix summarize research field bug #71

Merged
merged 2 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion research_town/agents/agent_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +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:
Expand Down
19 changes: 16 additions & 3 deletions research_town/utils/agent_prompter.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,29 @@ 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()
for abstract in papers["abstract"]]

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)

Expand Down
Loading