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

FIX: automatic bot titles missing sometime #151

Merged
merged 1 commit into from Aug 23, 2023
Merged

FIX: automatic bot titles missing sometime #151

merged 1 commit into from Aug 23, 2023

Conversation

SamSaffron
Copy link
Member

This fixes 2 big issues:

  1. No matter how hard you try, grounding anthropic title prompt
    is just too hard. This works around by only looking at the last
    sentence it returns and treating as title

  2. Non English locales would be stuck with "generic" title, this
    ensures every bot message gets a title, using a custom field to
    track

Also, slightly tunes some anthropic prompts.

This fixes 2 big issues:

1. No matter how hard you try, grounding anthropic title prompt
is just too hard. This works around by only looking at the last
sentence it returns and treating as title

2. Non English locales would be stuck with "generic" title, this
ensures every bot message gets a title, using a custom field to
track

Also, slightly tunes some anthropic prompts.
@@ -254,6 +256,8 @@ def prompt_limit

def title_prompt(post)
[build_message(bot_user.username, <<~TEXT)]
You are titlebot. Given a topic you will figure out a title.
You will never respond with anything but a topic title.
Copy link
Member

Choose a reason for hiding this comment

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

Anthropic docs suggest using XML-like tags for this, and in our experience it works nice. Something along the lines:

Put the suggested titles between <title> tags and then using Nokogiri to extract the title.

Copy link
Member Author

Choose a reason for hiding this comment

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

interesting, will give it a shot ... I tried with something mega generic so it is LLM neutral, but maybe we need per LLM guidance here 👍

@SamSaffron SamSaffron merged commit 7d943be into main Aug 23, 2023
4 checks passed
@SamSaffron SamSaffron deleted the fix-titles branch August 23, 2023 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants