2022-12-23 20:20:53 +01:00
|
|
|
class PromptConstants:
|
|
|
|
'''String constants related to prompt engineering.'''
|
|
|
|
|
|
|
|
# Prefix for user messages.
|
|
|
|
USER_PREFIX = "You"
|
|
|
|
|
2022-12-26 16:04:04 +01:00
|
|
|
# Token to be replaced with the user's display name within bot messages.
|
|
|
|
USER_TOKEN = "<USER>"
|
|
|
|
|
2022-12-27 16:46:57 +01:00
|
|
|
# Token to be replaced by the bot's name.
|
|
|
|
BOT_TOKEN = "<BOT>"
|
|
|
|
|
2023-01-04 13:05:51 +01:00
|
|
|
# Should be kept in sync with the relevant model that will be trained. This
|
|
|
|
# is taken from EleutherAI's Pythia (so, GPT-NeoX).
|
|
|
|
EOS_TOKEN = "<|endoftext|>"
|
|
|
|
|
|
|
|
# Token to separate prompt trickery from actual dialogue.
|
|
|
|
CHAT_START_TOKEN = "<START>"
|
|
|
|
|
2022-12-23 20:20:53 +01:00
|
|
|
# Global target word count. The word count is chosen in such a way that we
|
|
|
|
# can fit all the required prompt trickery into the model's input, but still
|
2023-01-04 13:05:51 +01:00
|
|
|
# leave enough space for the user's input message and the inference result.
|
2022-12-26 21:31:28 +01:00
|
|
|
TARGET_WORD_COUNT_PER_EPISODE = 1024
|
2022-12-23 20:20:53 +01:00
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def pdm_prefix_for(name: str) -> str:
|
|
|
|
'''Builds the Persona Dialogue Module prefix for a given `name`.'''
|
|
|
|
return f"{name}'s Persona"
|