├── app_gem.py ├── appp.py └── requirements.txt /app_gem.py: -------------------------------------------------------------------------------- 1 | import os 2 | from langchain_google_genai import ChatGoogleGenerativeAI 3 | from crewai import Agent, Task, Crew, Process 4 | from langchain.tools import DuckDuckGoSearchRun 5 | 6 | 7 | # Set gemini pro as llm 8 | llm = ChatGoogleGenerativeAI(model="gemini-pro", 9 | verbose = True, 10 | temperature = 0.5, 11 | google_api_key="") 12 | 13 | 14 | #create searches 15 | tool_search = DuckDuckGoSearchRun() 16 | 17 | # Define Agents 18 | email_author = Agent( 19 | role='Professional Email Author', 20 | goal='Craft concise and engaging emails', 21 | backstory='Experienced in writing impactful marketing emails.', 22 | verbose=True, 23 | allow_delegation=False, 24 | llm=llm, 25 | tools=[ 26 | tool_search 27 | ] 28 | ) 29 | marketing_strategist = Agent( 30 | role='Marketing Strategist', 31 | goal='Lead the team in creating effective cold emails', 32 | backstory='A seasoned Chief Marketing Officer with a keen eye for standout marketing content.', 33 | verbose=True, 34 | allow_delegation=True, 35 | llm=llm 36 | ) 37 | 38 | content_specialist = Agent( 39 | role='Content Specialist', 40 | goal='Critique and refine email content', 41 | backstory='A professional copywriter with a wealth of experience in persuasive writing.', 42 | verbose=True, 43 | allow_delegation=False, 44 | llm=llm 45 | ) 46 | 47 | # Define Task 48 | email_task = Task( 49 | description='''1. Generate two distinct variations of a cold email promoting a video editing solution. 50 | 2. Evaluate the written emails for their effectiveness and engagement. 51 | 3. Scrutinize the emails for grammatical correctness and clarity. 52 | 4. Adjust the emails to align with best practices for cold outreach. Consider the feedback 53 | provided to the marketing_strategist. 54 | 5. Revise the emails based on all feedback, creating two final versions.''', 55 | agent=marketing_strategist # The Marketing Strategist is in charge and can delegate 56 | ) 57 | 58 | 59 | # Create a Single Crew 60 | email_crew = Crew( 61 | agents=[email_author, marketing_strategist, content_specialist], 62 | tasks=[email_task], 63 | verbose=True, 64 | process=Process.sequential 65 | ) 66 | 67 | # Execution Flow 68 | print("Crew: Working on Email Task") 69 | emails_output = email_crew.kickoff() 70 | -------------------------------------------------------------------------------- /appp.py: -------------------------------------------------------------------------------- 1 | import os 2 | from crewai import Agent, Task, Crew, Process 3 | from langchain.tools import DuckDuckGoSearchRun 4 | 5 | 6 | os.environ["HUGGINGFACEHUB_API_TOKEN"] = "" 7 | 8 | from langchain_community.llms import HuggingFaceHub 9 | repo_id = "mistralai/Mistral-7B-Instruct-v0.2" # See https://huggingface.co/models?pipeline_tag=text-generation&sort=downloads for some other options 10 | llm = HuggingFaceHub( 11 | repo_id=repo_id, model_kwargs={"temperature": 0.5, "max_tokens":4096} 12 | ) 13 | 14 | search_tool = DuckDuckGoSearchRun() 15 | 16 | # Define Agents 17 | email_author = Agent( 18 | role='Professional Email Author', 19 | goal='Craft concise and engaging emails', 20 | backstory='Experienced in writing impactful marketing emails.', 21 | verbose=True, 22 | allow_delegation=False, 23 | llm=llm, 24 | tools=[ 25 | search_tool 26 | ] 27 | ) 28 | marketing_strategist = Agent( 29 | role='Marketing Strategist', 30 | goal='Lead the team in creating effective cold emails', 31 | backstory='A seasoned Chief Marketing Officer with a keen eye for standout marketing content.', 32 | verbose=True, 33 | allow_delegation=True, 34 | llm=llm 35 | ) 36 | 37 | content_specialist = Agent( 38 | role='Content Specialist', 39 | goal='Critique and refine email content', 40 | backstory='A professional copywriter with a wealth of experience in persuasive writing.', 41 | verbose=True, 42 | allow_delegation=False, 43 | llm=llm 44 | ) 45 | 46 | # Define Task 47 | email_task = Task( 48 | description='''1. Generate two distinct variations of a cold email promoting a video editing solution. 49 | 2. Evaluate the written emails for their effectiveness and engagement. 50 | 3. Scrutinize the emails for grammatical correctness and clarity. 51 | 4. Adjust the emails to align with best practices for cold outreach. Consider the feedback 52 | provided to the marketing_strategist. 53 | 5. Revise the emails based on all feedback, creating two final versions.''', 54 | agent=marketing_strategist # The Marketing Strategist is in charge and can delegate 55 | ) 56 | 57 | 58 | # Create a Single Crew 59 | email_crew = Crew( 60 | agents=[email_author, marketing_strategist, content_specialist], 61 | tasks=[email_task], 62 | verbose=True, 63 | process=Process.sequential 64 | ) 65 | 66 | # Execution Flow 67 | print("Crew: Working on Email Task") 68 | emails_output = email_crew.kickoff() -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | crewai 2 | duckduckgo-search 3 | huggingface_hub 4 | langchain_google_genai --------------------------------------------------------------------------------