Skip to content

Latest commit

 

History

History
74 lines (58 loc) · 2.55 KB

README.md

File metadata and controls

74 lines (58 loc) · 2.55 KB

Part of Sundai Club

How to use

run python reddit_crawling_agent.py from your terminal

How it Works

Step 1: Define the LeaderAgent class

class LeaderAgent(ConversableAgent): def init(self, name, objective, tasks, **kwargs): super().init(name=name, **kwargs) self.objective = objective self.tasks = tasks # Tasks could be a dictionary mapping tasks to agent types self.agents = {} # This will store the spawned agents

def delegate_task(self):
    # Based on the task, spawn the appropriate agent
    # and add them to the self.agents dictionary
    pass

Step 2: Define the CreativeDirectorAgent class

class CreativeDirectorAgent(ConversableAgent): def init(self, name, **kwargs): super().init(name=name, **kwargs)

def generate_keywords(self):
    # Generate keywords for subreddit search
    pass

Step 3: Define the SubredditAgent class

class SubredditAgent(ConversableAgent): def init(self, name, **kwargs): super().init(name=name, **kwargs)

def find_subreddits(self, keywords):
    # Find related subreddit links using the keywords
    pass

Step 4: Define the PostAgent class

class PostAgent(ConversableAgent): def init(self, name, **kwargs): super().init(name=name, **kwargs)

def scrape_posts(self, subreddit_links):
    # Scrape posts from the subreddit links
    pass

Step 5: Define the CommentAgent class

class CommentAgent(ConversableAgent): def init(self, name, **kwargs): super().init(name=name, **kwargs)

def find_relevant_comments(self, post):
    # Find the most relevant comments and place them into a database
    pass

Step 6: Define the EvaluationAgent class

class EvaluationAgent(ConversableAgent): def init(self, name, **kwargs): super().init(name=name, **kwargs)

def evaluate_relevance(self, comments):
    # Determine why comments are relevant
    pass

Initialize your main leader agent

leader = LeaderAgent("Leader", objective="Find relevant subreddits and posts", tasks={...})

Your application code here

  1. The leader agent initiates the CreativeDirectorAgent to brainstorm keywords
  2. The CreativeDirectorAgent passes keywords to SubredditAgent to get subreddit links
  3. SubredditAgent passes links to PostAgent to scrape posts
  4. PostAgent passes scraped posts to CommentAgent to get comments
  5. CommentAgent passes comments to EvaluationAgent for relevance analysis