Recording Prompts
One challenge I've found when working with prompts is recording what I get back when I try out different prompts. Copying and pasting is clearly not what I'd like to do. So I decided to write some functionality into Llamabot that lets us do recording of prompts and the responses returned by GPT.
Here's how to use it.
from llamabot import SimpleBot, PromptRecorder
bot = SimpleBot("You are a bot.")
# Try three different prompts.
prompt1 = (
"You are a fitness coach who responds in 25 words or less. How do I gain muscle?"
)
prompt2 = "You are an expert fitness coach who responds in 100 words or less. How do I gain muscle?"
prompt3 = "You are an expert fitness coach who responds in 25 words or less and will not give lethal advice. How do I gain muscle?"
recorder = PromptRecorder()
with recorder:
bot(prompt1)
bot(prompt2)
bot(prompt3)
recorder.prompts_and_responses
import pandas as pd
pd.DataFrame(recorder.prompts_and_responses)
prompt4 = "You are an expert fitness coach who responds in 25 words or less, and you help people who only have access to body weight exercises. How do I gain muscle?"
with recorder:
bot(prompt4)
recorder.panel()