Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft/Idea: Tokenless agents #37

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions agents/example.json
Original file line number Diff line number Diff line change
@@ -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.",
Expand Down
22 changes: 16 additions & 6 deletions src/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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}'")
Expand Down Expand Up @@ -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)
Expand Down