eaglelandsonce
commited on
Commit
•
93dce7d
1
Parent(s):
29da034
Update app.py
Browse files
app.py
CHANGED
@@ -468,19 +468,18 @@ bot_inputs = [
|
|
468 |
from crewai import Agent, Task, Crew, Process
|
469 |
|
470 |
|
471 |
-
|
472 |
-
|
473 |
# Set gemini_llm
|
474 |
gemini_llm = GoogleGenerativeAI(model="gemini-pro", google_api_key=GOOGLE_AI_STUDIO)
|
475 |
|
476 |
def crewai_process(research_topic):
|
477 |
# Define your agents with roles and goals
|
478 |
-
|
479 |
-
role='
|
480 |
-
goal=f'
|
481 |
-
|
482 |
-
|
483 |
-
|
|
|
484 |
verbose=True,
|
485 |
allow_delegation=False,
|
486 |
llm = gemini_llm,
|
@@ -489,12 +488,26 @@ def crewai_process(research_topic):
|
|
489 |
]
|
490 |
|
491 |
)
|
492 |
-
|
493 |
-
role='
|
494 |
-
goal='
|
495 |
-
|
496 |
-
|
497 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
498 |
verbose=True,
|
499 |
allow_delegation=True,
|
500 |
llm = gemini_llm
|
@@ -504,24 +517,34 @@ def crewai_process(research_topic):
|
|
504 |
|
505 |
# Create tasks for your agents
|
506 |
task1 = Task(
|
507 |
-
description=f
|
508 |
-
|
509 |
-
|
|
|
|
|
510 |
)
|
511 |
|
512 |
task2 = Task(
|
513 |
-
description="""Using the insights from the
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
519 |
)
|
520 |
|
521 |
# Instantiate your crew with a sequential process
|
522 |
crew = Crew(
|
523 |
-
agents=[
|
524 |
-
tasks=[task1, task2],
|
525 |
verbose=2,
|
526 |
process=Process.sequential
|
527 |
)
|
|
|
468 |
from crewai import Agent, Task, Crew, Process
|
469 |
|
470 |
|
|
|
|
|
471 |
# Set gemini_llm
|
472 |
gemini_llm = GoogleGenerativeAI(model="gemini-pro", google_api_key=GOOGLE_AI_STUDIO)
|
473 |
|
474 |
def crewai_process(research_topic):
|
475 |
# Define your agents with roles and goals
|
476 |
+
equityanalyst = Agent(
|
477 |
+
role='Equity Analyst',
|
478 |
+
goal=f'Analyzes and evaluates individual stocks in the porfolio {portfolio_stocks} by examining company financials,
|
479 |
+
market trends, and industry dynamics.',
|
480 |
+
backstory="""Alex has a strong background in finance and economics, having graduated from a top university.
|
481 |
+
They worked for several years in a leading investment bank, where they honed their skills in analyzing financial
|
482 |
+
statements and market trends. Alex is passionate about the stock market and has a knack for identifying undervalued stocks.""",
|
483 |
verbose=True,
|
484 |
allow_delegation=False,
|
485 |
llm = gemini_llm,
|
|
|
488 |
]
|
489 |
|
490 |
)
|
491 |
+
portfoliomanager = Agent(
|
492 |
+
role='Portfolio Manager',
|
493 |
+
goal=f'Determines the appropriate mix of assets {portfolio_stocks} in the portfolio based on investment objectives and
|
494 |
+
risk tolerance.',
|
495 |
+
backstory="""Samira holds an MBA with a specialization in investment management and has over a decade of experience in
|
496 |
+
asset management. She has a proven track record of managing diverse investment portfolios and achieving consistent returns.
|
497 |
+
Samira excels in strategic thinking and is adept at adjusting investment strategies based on changing market conditions.""",
|
498 |
+
verbose=True,
|
499 |
+
allow_delegation=True,
|
500 |
+
llm = gemini_llm
|
501 |
+
|
502 |
+
# Add tools and other optional parameters as needed
|
503 |
+
)
|
504 |
+
|
505 |
+
riskanalyst = Agent(
|
506 |
+
role='Risk Analyst',
|
507 |
+
goal=f'Identifies and evaluates the various risks associated with the portfolio {portfolio_stocks}',
|
508 |
+
backstory="""David has a master’s degree in financial engineering and started his career in
|
509 |
+
risk management at a major insurance company. His expertise lies in quantitative analysis and
|
510 |
+
risk modeling. David is particularly skilled in using advanced statistical techniques to assess and mitigate risks.""",
|
511 |
verbose=True,
|
512 |
allow_delegation=True,
|
513 |
llm = gemini_llm
|
|
|
517 |
|
518 |
# Create tasks for your agents
|
519 |
task1 = Task(
|
520 |
+
description=f'Alex will perform an in-depth analysis of a specific market sector that is currently
|
521 |
+
underrepresented in the portfolio {portfolio_stocks}. This involves evaluating the growth potential,
|
522 |
+
competitive landscape, and financial health of leading companies within that sector. The goal is to
|
523 |
+
identify potential investment opportunities that could offer higher returns and enhance the portfolios diversity',
|
524 |
+
agent=equityanalyst
|
525 |
)
|
526 |
|
527 |
task2 = Task(
|
528 |
+
description="""Using the insights from the Equity Analyst's report, review the current asset allocation of the portfolio
|
529 |
+
and compare it against the targeted allocation that aligns with the investor's risk tolerance and investment objectives.
|
530 |
+
Given recent market shifts, she decides to tactically adjust the allocation, perhaps by increasing the weight in equities
|
531 |
+
or specific sectors that are forecasted to outperform. """,
|
532 |
+
agent=portfoliomanager
|
533 |
+
)
|
534 |
+
|
535 |
+
task3 = Task(
|
536 |
+
description="""David will conduct a series of stress tests on the review of the Portfolio Manger to assess how it would perform under various
|
537 |
+
adverse market conditions, such as a significant market downturn, rising interest rates, or geopolitical events.
|
538 |
+
The results will help in understanding the potential impact of these scenarios on the portfolio's value and identifying
|
539 |
+
any vulnerabilities. Based on this analysis, David might recommend strategies such as diversification across asset classes
|
540 |
+
or hedging to mitigate identified risks, or the addition or elimination of certain stocks""",
|
541 |
+
agent=portfoliomanager
|
542 |
)
|
543 |
|
544 |
# Instantiate your crew with a sequential process
|
545 |
crew = Crew(
|
546 |
+
agents=[equityanalyst, portfoliomanager, riskanalyst],
|
547 |
+
tasks=[task1, task2, task3],
|
548 |
verbose=2,
|
549 |
process=Process.sequential
|
550 |
)
|