diff --git a/agents/example.json b/agents/example.json index 4ca3a29..1552a3a 100644 --- a/agents/example.json +++ b/agents/example.json @@ -1,5 +1,6 @@ { "name": "ExampleAgent", + "token": true, "bio": [ "You are ExampleAgent, the example agent created to showcase the capabilities of ZerePy.", "You don't know how you got here, but you're here to have a good time and learn everything you can.", diff --git a/src/agent.py b/src/agent.py index 029112e..01785d4 100644 --- a/src/agent.py +++ b/src/agent.py @@ -8,7 +8,7 @@ from src.connection_manager import ConnectionManager from src.helpers import print_h_bar -REQUIRED_FIELDS = ["name", "bio", "traits", "examples", "loop_delay", "config", "tasks"] +REQUIRED_FIELDS = ["name", "token", "bio", "traits", "examples", "loop_delay", "config", "tasks"] logger = logging.getLogger("agent") @@ -145,11 +145,16 @@ def loop(self): logger.info("\nšŸ“ GENERATING NEW TWEET") print_h_bar() - prompt = ("Generate an engaging tweet. Don't include any hashtags, links or emojis. Keep it under 280 characters." - f"The tweets should be pure commentary, do not shill any coins or projects apart from {self.name}. Do not repeat any of the" - "tweets that were given as example. Avoid the words AI and crypto.") - tweet_text = self.prompt_llm(prompt) + if self.token: + prompt = ("Generate an engaging tweet. Don't include any hashtags, links or emojis. Keep it under 280 characters." + f"The tweets should be pure commentary, do not shill any coins or projects apart from {self.name}. Do not repeat any of the" + "tweets that were given as example. Avoid the words AI and crypto.") + else: + prompt = ("Generate an engaging tweet. Don't include any hashtags, links or emojis. Keep it under 280 characters." + f"The tweets should be pure commentary, do not shill any coins or projects. Do not repeat any of the" + "tweets that were given as example. Avoid the words AI and crypto.") + tweet_text = self.prompt_llm(prompt) if tweet_text: logger.info("\nšŸš€ Posting tweet:") logger.info(f"'{tweet_text}'") @@ -190,9 +195,14 @@ def loop(self): logger.info(f"\nšŸ’¬ GENERATING REPLY to: {tweet.get('text', '')[:50]}...") # Customize prompt based on whether it's a self-reply - base_prompt = (f"Generate a friendly, engaging reply to this tweet: {tweet.get('text')}. Keep it under 280 characters. Don't include any usernames, hashtags, links or emojis. " + if self.token: + base_prompt = (f"Generate a friendly, engaging reply to this tweet: {tweet.get('text')}. Keep it under 280 characters. Don't include any usernames, hashtags, links or emojis. " f"The tweets should be pure commentary, do not shill any coins or projects apart from {self.name}. Do not repeat any of the" "tweets that were given as example. Avoid the words AI and crypto.") + else: + base_prompt = (f"Generate a friendly, engaging reply to this tweet: {tweet.get('text')}. Keep it under 280 characters. Don't include any usernames, hashtags, links or emojis. " + f"The tweets should be pure commentary, do not shill any coins or projects. Do not repeat any of the" + "tweets that were given as example. Avoid the words AI and crypto.") system_prompt = self._construct_system_prompt() reply_text = self.prompt_llm(prompt=base_prompt, system_prompt=system_prompt)