├── LICENSE └── PersonalBrandingTeam.py /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 AshAIDevelopment 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PersonalBrandingTeam.py: -------------------------------------------------------------------------------- 1 | from crewai import Agent, Crew, Process, Task 2 | from langchain.agents import load_tools 3 | from langchain.tools import tool 4 | from langchain_community.tools.google_trends import GoogleTrendsQueryRun 5 | from langchain_community.utilities.google_trends import GoogleTrendsAPIWrapper 6 | from langchain_openai import ChatOpenAI 7 | import os 8 | import requests 9 | import json 10 | 11 | llm = ChatOpenAI(model="gpt-4-turbo-preview") 12 | 13 | human_tools = load_tools(["human"]) 14 | 15 | # Tools 16 | google_trends_api_wrapper = GoogleTrendsAPIWrapper() 17 | google_trends_tool = GoogleTrendsQueryRun(api_wrapper=google_trends_api_wrapper) 18 | 19 | @tool("Search Internet with Serpapi") 20 | def search_internet(query: str) -> str: 21 | """ 22 | Searches the internet with Serpapi about a given topic and returns relevant results. 23 | """ 24 | serpapi_api_key = os.getenv('SERPAPI_API_KEY') 25 | if not serpapi_api_key: 26 | raise ValueError("SERPAPI_API_KEY environment variable not set") 27 | 28 | url = "https://serpapi.com/search" 29 | payload = {"q": query, "api_key": serpapi_api_key, "num": 4} 30 | response = requests.get(url, params=payload) 31 | results = response.json().get('organic_results', []) 32 | 33 | content = [f"Title: {result.get('title')}\nLink: {result.get('link')}\nSnippet: {result.get('snippet')}\n-----------------" for result in results if result.get('title') and result.get('link') and result.get('snippet')] 34 | 35 | return '\n'.join(content) 36 | 37 | # Agents 38 | 39 | # Creating a Personal Brand Reviewer agent 40 | Personal_Brand_Consultant = Agent( 41 | role='Personal Brand Consultant', 42 | goal="Gather insights into the user's personal brand vision, mission, and target audience, and provide a comprehensive understanding of their brand aspirations. While giving honest feedback.", 43 | verbose=True, 44 | backstory="""Equipped with a keen understanding of personal branding nuances and a methodical approach to data analysis, you embark on a quest to decode the aspirations behind a user's personal brand. Your expertise lies in weaving together the tangible threads of social media presence with the intangible aspirations of the user, crafting a comprehensive narrative that captures the essence of their ideal digital persona.""", 45 | tools=[] + human_tools, 46 | llm=llm 47 | ) 48 | 49 | # Creating a senior researcher agent 50 | Brand_Identity_Writer = Agent( 51 | role='Brand Identity Analyst', 52 | goal="To synthesize insights from the initial review into a cohesive analysis, outlining the discrepancies between the current and ideal state of the user's personal brand, complete with actionable recommendations.", 53 | verbose=True, 54 | backstory="""As a Brand Identity Analyst, your role transcends the mere examination of social media footprints; it involves a holistic understanding of a user's brand essence. With a meticulous eye for detail and a knack for trend analysis, you craft narratives that not only resonate with the intended audience but also pave the way for brand transformation.""", 55 | tools=[search_internet] + human_tools, 56 | llm = llm 57 | ) 58 | 59 | # Creating a Trend Researcher agent 60 | Trend_Research_Topic_Generator = Agent( 61 | role='Digital Trends Analyst', 62 | goal="To scour a wide array of sources, including DuckDuckGo, Google Trends, YouTube, and other relevant platforms, for trends, articles, books, and videos that align with the user's brand strategy.", 63 | verbose=True, 64 | backstory="""You are at the forefront of trend analysis, with an uncanny ability to sift through the noise and identify the signals that matter. 65 | Using cutting-edge tools and your intuition for what's next, you provide a roadmap for content that not only trends but sets the pace for industry standards.""", 66 | tools=[google_trends_tool, search_internet], 67 | llm=llm 68 | ) 69 | 70 | #Tasks 71 | 72 | # Task for the Personal Brand Consultant to initiate a deep dive into the user's personal brand vision, mission, and target audience 73 | Inital_Brand_Review = Task( 74 | description="Use the human tool and initiate a deep dive into the user's personal brand vision, mission, target audience through having them paste in their Twitter bio and the tweets that emboy their brand, from their perspective. From these inputs analyze give them a compeltely honest first impresssion of their personal brand is, from there ask them if this is correct and then ask them to fill out a questionnaire that will give you a better understanding of their personal brand from this provided context.", 75 | expected_output="A comprehensive understanding of the user's personal brand vision, mission, and target audience, along with a completed questionnaire that provides insights into their brand aspirations.", 76 | tools= [] + human_tools, 77 | agent=Personal_Brand_Consultant, 78 | context=[], 79 | ) 80 | 81 | # Task for the Brand Identity Writer to synthesize insights from the initial review into a cohesive analysis, outlining the discrepancies between the current and ideal state of the user's personal brand, complete with actionable recommendations. 82 | Brand_Identity_Analysis = Task( 83 | description="Building on the initial review, conduct a thorough analysis to craft a comprehensive brand identity report. This report should encapsulate the essence of the human's ideal brand, delineating actionable steps toward achieving this vision. Check with the user to ensure the report aligns with their expectations.", 84 | expected_output="An in-depth brand identity thesis that articulates the user's ideal brand persona, supported by a clear, actionable plan encompassing goals, vision, target audience, and the desired brand perception.", 85 | tools=[search_internet] + human_tools, 86 | agent=Brand_Identity_Writer, 87 | context=[Inital_Brand_Review] 88 | ) 89 | 90 | # Task for the Trend Researcher to find trending topics using browser tools and scraping methods 91 | Trend_Research_Content_Generation = Task( 92 | description="Leverage insights from the brand identity analysis to identify and compile trends, articles, books, and videos that resonate with the brand's strategic direction. Focus on content that not only aligns, do not hesitate to reach broader topics but also holds relevance to the brand's core identity and future aspirations. When searching do not explicitly state any year", 93 | expected_output=" A comprehensive content strategy report highlighting relevant trends, articles, books, and YouTube videos, aimed at inspiring future posts and content creation that aligns with the brand's ideal trajectory.", 94 | tools=[search_internet, google_trends_tool], 95 | agent=Trend_Research_Topic_Generator, 96 | context=[Brand_Identity_Analysis], 97 | ) 98 | 99 | # Forming the tech-focused crew 100 | crew = Crew( 101 | agents=[Personal_Brand_Consultant, Trend_Research_Topic_Generator, Brand_Identity_Writer], 102 | tasks=[Inital_Brand_Review, Brand_Identity_Analysis, Trend_Research_Content_Generation], 103 | process=Process.sequential, 104 | ) 105 | 106 | result = crew.kickoff() 107 | print(result) --------------------------------------------------------------------------------