Update agents.py
Browse files2 unmodified lines3456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051522 unmodified linesfrom langchain_openai import ChatOpenAIimport streamlit as stdef create_research_crew(topic: str, questions: list):tools = [SerperDevTool(), ScrapeWebsiteTool()]llm = ChatOpenAI(temperature=0.7, model="gpt-4")researcher = Agent(role='Market Researcher',goal=f'Research {topic} market',backstory="Market research expert",tools=tools,llm=llm,max_iterations=3)analyst = Agent(role='Data Analyst',goal='Process market data',backstory="Data analytics expert",tools=tools,llm=llm,max_iterations=3)writer = Agent(role='Report Writer',goal='Write market report',backstory="Report writer",llm=llm,max_iterations=3)tasks = [Task(description=f"Research {topic} addressing: {', '.join(questions)}",expected_output="Research data",agent=researcher),Task(description="Analyze market data",expected_output="Analysis summary",agent=analyst),Task(description="Write report",expected_output="Final report",agent=writer)]2 unmodified lines3456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990912 unmodified linesfrom langchain_openai import ChatOpenAIimport streamlit as st# In agents.pydef create_research_crew(topic: str, questions: list):tools = [SerperDevTool(), ScrapeWebsiteTool()]llm = ChatOpenAI(temperature=0.7, model="gpt-4")researcher = Agent(role='Market Researcher',goal=f"""Research the {topic} market comprehensively.Address these specific questions: {', '.join(questions)}""",backstory="""Expert market researcher with extensive experience in industry analysis.Skilled at finding and validating market data from multiple sources.""",tools=tools,llm=llm,verbose=True)analyst = Agent(role='Data Analyst',goal=f"""Analyze market data for {topic} focusing on:1. Market size and growth calculations2. Competitive analysis3. Regional distribution4. Trend analysis5. Future projectionsAddress these questions in your analysis: {', '.join(questions)}""",backstory="Senior data analyst specializing in market trends and competitive analysis",tools=tools,llm=llm,verbose=True)writer = Agent(role='Report Writer',goal=f"""Create a comprehensive report on {topic} that:1. Addresses all user questions: {', '.join(questions)}2. Incorporates research findings and analysis3. Provides actionable insights4. Includes visual data representations5. Maintains professional tone and structure""",backstory="Professional report writer with expertise in market research",llm=llm,verbose=True)tasks = [Task(description=f"""Research {topic} addressing:- User Questions: {', '.join(questions)}- Current market size and growth- Competitive landscape- Regional analysis- Technology trends- Future outlookUse web search to find recent data and developments.Include specific numbers and statistics.""",agent=researcher),Task(description=f"""Analyze the research data for {topic}:1. Calculate market metrics2. Identify trends3. Compare competitors4. Analyze regional distribution5. Project future growthAddress user questions: {', '.join(questions)}Create visualizations for key metrics.""",agent=analyst),Task(description=f"""Write comprehensive report for {topic}:1. Executive Summary2. Market Overview3. Competitive Analysis4. Regional Analysis5. Technology Trends6. Future Outlook7. Strategic RecommendationsEnsure all user questions are answered: {', '.join(questions)}Include data visualizations and key metrics.""",agent=writer)]
agents.py+54-15