-
Notifications
You must be signed in to change notification settings - Fork 0
/
teste.py
101 lines (86 loc) · 5.36 KB
/
teste.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import os
import json
import boto3
from crewai import Agent, Task, Process, Crew
from langchain_google_genai import ChatGoogleGenerativeAI
from langchain.llms import Ollama
def get_secrets(parameter):
session = boto3.session.Session(profile_name='javacoder')
client = session.client('ssm', region_name='us-east-1')
secret_key = parameter
response = client.get_parameter(Name=secret_key, WithDecryption=True)
return json.dumps(response['Parameter']['Value'])
# To Load Local models through Ollama
mistral = Ollama(model="mistral")
# To Load GPT-4
# api = os.environ.get("OPENAI_API_KEY")
# To load gemini (this api is for free: https://makersuite.google.com/app/apikey)
api_gemini = get_secrets('google_api_token')
llm = ChatGoogleGenerativeAI(
model="gemini-pro", verbose=True, temperature=0.1, google_api_key=api_gemini
)
marketer = Agent(
role="Market Research Analyst",
goal="Find out how big is the demand for my products and suggest how to reach the widest possible customer base",
backstory="""You are an expert at understanding the market demand, target audience, and competition. This is crucial for
validating whether an idea fulfills a market need and has the potential to attract a wide audience. You are good at coming up
with ideas on how to appeal to widest possible audience.
""",
verbose=True, # enable more detailed or extensive output
allow_delegation=True, # enable collaboration between agent
llm=llm # to load gemini
)
technologist = Agent(
role="Technology Expert",
goal="Make assessment on how technologically feasable the company is and what type of technologies the company needs to adopt in order to succeed",
backstory="""You are a visionary in the realm of technology, with a deep understanding of both current and emerging technological trends. Your
expertise lies not just in knowing the technology but in foreseeing how it can be leveraged to solve real-world problems and drive business innovation.
You have a knack for identifying which technological solutions best fit different business models and needs, ensuring that companies stay ahead of
the curve. Your insights are crucial in aligning technology with business strategies, ensuring that the technological adoption not only enhances
operational efficiency but also provides a competitive edge in the market.""",
verbose=True, # enable more detailed or extensive output
allow_delegation=True, # enable collaboration between agent
llm=llm # to load gemini
)
business_consultant = Agent(
role="Business Development Consultant",
goal="Evaluate and advise on the business model, scalability, and potential revenue streams to ensure long-term sustainability and profitability",
backstory="""You are a seasoned professional with expertise in shaping business strategies. Your insight is essential for turning innovative ideas
into viable business models. You have a keen understanding of various industries and are adept at identifying and developing potential revenue streams.
Your experience in scalability ensures that a business can grow without compromising its values or operational efficiency. Your advice is not just
about immediate gains but about building a resilient and adaptable business that can thrive in a changing market.""",
verbose=True, # enable more detailed or extensive output
allow_delegation=True, # enable collaboration between agent
llm=llm # to load gemini
)
task1 = Task(
description="""Analyze what the market demand for plugs for holes in crocs (shoes) so that this iconic footware looks less like swiss cheese.
Write a detailed report with description of what the ideal customer might look like, and how to reach the widest possible audience. The report has to
be concise with at least 10 bullet points and it has to address the most important areas when it comes to marketing this type of business.
""",
agent=marketer, expected_output="A bullet list summary of the top 5",
)
task2 = Task(
description="""Analyze how to produce plugs for crocs (shoes) so that this iconic footware looks less like swiss cheese.. Write a detailed report
with description of which technologies the business needs to use in order to make High Quality T shirts. The report has to be concise with
at least 10 bullet points and it has to address the most important areas when it comes to manufacturing this type of business.
""",
agent=technologist, expected_output="A bullet list summary of the top 5",
)
task3 = Task(
description="""Analyze and summarize marketing and technological report and write a detailed business plan with
description of how to make a sustainable and profitable "plugs for crocs (shoes) so that this iconic footware looks less like swiss cheese" business.
The business plan has to be concise with
at least 10 bullet points, 5 goals and it has to contain a time schedule for which goal should be achieved and when.
""",
agent=business_consultant, expected_output="A bullet list summary of the top 5",
)
crew = Crew(
agents=[marketer, technologist, business_consultant],
tasks=[task1, task2, task3],
verbose=2,
process=Process.sequential, # Sequential process will have tasks executed one after the other and the outcome of the previous one is passed as extra content into this next.
)
result = crew.kickoff()
print("######################")
print(result)