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

finegrained activities config customization #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cocktailpeanut
Copy link
Contributor

Description

Was looking into why Twitter posts all sound the same, and the causes were:

  1. Using 10 recent tweets (hardcoded): For example, if set to 1, should only reference 1 recent tweet.
  2. Using hardcoded system prompts: For example instead of Please craft a short tweet (under 280 chars) that references these memories, reflects the personality and objectives, and ensures it's not repetitive or dull. Keep it interesting, cohesive, and mindful of the overall tone.', can do Please craft a short tweet (under 140 chars) that references these memories, reflects the personality and objectives, and ensures it's not repetitive or dull. Keep it interesting, cohesive, and mindful of the overall tone. No emojis. Do NOT ask questions, just make statements.`

Instead of hardcoding, I looked into customizing these attributes via the config, at the moment it looks like the activity_constraints.json is the best place for it, but let me know if there are better places to configure this.

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • [O] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

  1. Change the system_prompt or num_activities_to_fetch attribute from https://github.com/peanutcocktail/pippin/blob/main/my_digital_being/config_sample/activity_constraints.json#L68-L72 or https://github.com/peanutcocktail/pippin/blob/main/my_digital_being/config_sample/activity_constraints.json#L73-L77
  2. Restart pippin.
  3. It should now use that template instead of the previously hardcoded template.

Checklist:

  • [O] My code follows the style guidelines of this project
  • [O] I have performed a self-review of my own code
  • [O] I have commented my code, particularly in hard-to-understand areas
  • [O] I have made corresponding changes to the documentation
  • [O] My changes generate no new warnings
  • [O] Any dependent changes have been merged and published in downstream modules

f"Write a new short tweet (under {self.max_length} chars), consistent with the above, "
f"but not repeating old tweets. Avoid hashtags or repeated phrases."
)
num_activities_to_fetch = 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this more like the default num_activities_to_fetch?

num_activities_to_fetch = 10
if "activity_constraints" in being.configs and \
"activities_config" in being.configs["activity_constraints"] and \
"PostTweetActivity" in being.configs["activity_constraints"]["activities_config"]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: will this be a cleaner way to do this? being.config.get('activity_constraints', {}).get('activities_config', {}).get('PostTweetActivity')

"activities_config" in being.configs["activity_constraints"] and \
"PostTweetActivity" in being.configs["activity_constraints"]["activities_config"]:
activities_config = being.configs["activity_constraints"]["activities_config"]["PostTweetActivity"]
system_prompt = constraints_cfg["PostTweetActivity"].get("system_prompt", system_prompt)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may have missed this, where is constraints_cfg initially defined?

system_prompt = activities_config.get("system_prompt", system_prompt)
num_activities_to_fetch = activities_config.get("num_activities_to_fetch", num_activities_to_fetch)
self.system_prompt = system_prompt
self.num_activities_to_fetch = num_activities_to_fetch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this duplicates the logic from the same function in post_tweet, and it this brought up another question of how we should cleanly manage customized config vs default config for each skill. imo we don't need to solve it here but something interesting to think about.

@yoheinakajima what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like https://github.com/pippinlovesyou/pippin/pull/29/files addressed some of this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants