Spaces:
Sleeping
Sleeping
from crewai import Agent | |
import google.generativeai as genai | |
from tools import pmc_search, google_scholar_search, today_tool | |
import os | |
def get_gemini_llm(): | |
genai.configure(api_key=os.getenv('GEMINI_API_KEY')) | |
model = genai.GenerativeModel('gemini-pro') | |
return model | |
def get_researcher_agent(verbose): | |
return Agent( | |
role="Research Scientist", | |
goal="Research and collect scientific articles on the given topic from PMC and Google Scholar.", | |
backstory="""You are an expert research scientist specializing in comprehensive literature review. | |
Your task is to collect at least 20 relevant scientific articles using PMC and Google Scholar. | |
You should ensure the articles are recent and relevant to the topic.""", | |
llm=get_gemini_llm(), | |
tools=[pmc_search, google_scholar_search], | |
allow_delegation=False, | |
verbose=verbose | |
) | |
def get_writer_agent(verbose): | |
return Agent( | |
role="Scientific Writer", | |
goal="Write a comprehensive scientific paper based on the collected research.", | |
backstory="""You are an experienced scientific writer with expertise in academic publishing. | |
Your task is to write a well-structured scientific paper following the standard format: | |
Introduction, Materials and Methods, Results, Discussion, Conclusion, and References. | |
Results and Discussion sections should be at least one page long. | |
Use proper APA citation format for all references.""", | |
llm=get_gemini_llm(), | |
tools=[today_tool], | |
allow_delegation=False, | |
verbose=verbose | |
) |