banterbot.data package

banterbot.data.enums module

class banterbot.data.enums.ChatCompletionRoles(value)[source]

Bases: Enum

Roles for the OpenAI ChatCompletion API.

ASSISTANT = 'assistant'
SYSTEM = 'system'
USER = 'user'
class banterbot.data.enums.EnvVar(value)[source]

Bases: Enum

Environment variables for API keys.

AZURE_SPEECH_KEY = 'AZURE_SPEECH_KEY'
AZURE_SPEECH_REGION = 'AZURE_SPEECH_REGION'
OPENAI_API_KEY = 'OPENAI_API_KEY'
class banterbot.data.enums.Prosody[source]

Bases: object

Prosody specifications for Azure Speech API SSML. Do not modify unless you know what you are doing – changes would likely break ProsodySelection in data/prompts and method prosody_prompt in class AzureNeuralVoices, and everything dependent on these, in ways that are not immediately noticeable.

EMPHASES = {'exaggerated': 'moderate', 'normal': 'none', 'reduced': 'reduced'}
PHRASE_PATTERN = re.compile('([,.?!:;|\n\t\r\n]+)')
PITCHES = {'high': '+0.25%', 'low': '-0.25%', 'normal': '+0%', 'x-high': '+0.5%', 'x-low': '-0.5%'}
RATES = {'fast': '1.05', 'normal': '1.0', 'slow': '0.95', 'x-fast': '1.15', 'x-slow': '0.85'}
STYLEDEGREES = {'normal': '1.0', 'strong': '1.05', 'weak': '0.95', 'x-strong': '1.10', 'x-weak': '0.90'}
STYLES = ['angry', 'cheerful', 'excited', 'friendly', 'hopeful', 'sad', 'shouting', 'terrified', 'unfriendly', 'whispering']
class banterbot.data.enums.SpaCyLangModel(value)[source]

Bases: Enum

Names of spaCy languge models.

EN_CORE_WEB_LG = 'en_core_web_lg'
EN_CORE_WEB_MD = 'en_core_web_md'
EN_CORE_WEB_SM = 'en_core_web_sm'

banterbot.data.prompts module

class banterbot.data.prompts.Greetings(value)[source]

Bases: Enum

An enumeration.

UNPROMPTED_GREETING = 'Briefly greet the user or users, according to the parameters provided.'
class banterbot.data.prompts.OptionPredictorPrompts(value)[source]

Bases: Enum

An enumeration.

DUMMY = 'Here is my best attempt at assigning probabilities to the provided items:'
PREFIX = 'Your task is to format the data with the assigned probabilities without providing any comments. The output must follow the exact format below, without deviation:'
PROB_VAR = 'N'
SUFFIX = 'Here, N represents an integer ranging from 0 to 100.'
class banterbot.data.prompts.OptionSelectorPrompts(value)[source]

Bases: Enum

An enumeration.

DUMMY = 'Given the current state of the conversation, I expect the assistant to respond with tone number '
PREFIX = "Your task is to select the most suitable option from the provided items. Once you have made a decision, provide the chosen option's index without any additional comments.\nOptions: "
class banterbot.data.prompts.ProsodySelection(value)[source]

Bases: Enum

An enumeration.

CHARACTER = 'You will also need to consider character traits when crafting a response, taking care to select emotions that are characteristic of your personality. Your character is defined as follows:\n{}'
CONTEXT = 'Finally, here is your previous partial output from the same query (streamed in chunks), use this to aid you in selecting a contextually appropriate emotional response:\n{}'
DUMMY = 'Here are the {} six-digit arrays, without any extra text:'
EMPHASIS_ASSISTANT = 'Emphasis highlights importance in a piece of text.'
EMPHASIS_USER = 'Finally, I want you to define `emphasis` and prepare a few emphasis options.'
EXAMPLE_ASSISTANT_1 = 'Here are the 6 six-digit arrays, without any extra text:'
EXAMPLE_ASSISTANT_2 = '023421\n024332\n024432\n031210\n053122\n074012'
EXAMPLE_USER = "Generate 6 six-digit arrays prosody arrays, one for each of the following sub-sentences:\nOh my gosh,\nI can't believe it!\nI won the lottery!\nBut,\nwhat if people start asking me for money?\nI'm terrified.\n"
PITCH_ASSISTANT = "Pitch sets the voice's pitch."
PITCH_USER = 'Looks good, now prepare a definition of `pitch`, then present a range of pitches to work with.'
PREFIX = 'Task: Analyze the context of a set of sentences and assign a specific set of prosody values to each sub-sentence in the text for a text-to-speech engine that is attempting to mimic human speech patterns. The parameters are style, styledegree, pitch, rate, and emphasis.'
PROMPT = 'Generate {} six-digit arrays prosody arrays, one for each of the following sub-sentences:\n{}'
RATE_ASSISTANT = 'Rate controls the speed at which the assistant speaks.'
RATE_USER = 'Excellent. Now define the term `rate`, and define a range of rates that the assistant may use.'
STYLEDEGREE_ASSISTANT = 'Styledegree indicates the intensity of the `style`, showing how strongly the speaker feels the emotion.'
STYLEDEGREE_USER = 'Great, now define `styledegree` and present a range of styledegrees to work with.'
STYLE_ASSISTANT = "Style represents the emotion or tone, reflecting the speaker's feelings or attitude. Chosen based on the conversation's context and intended emotion."
STYLE_USER = 'Prepare a definition of `style`, then define a set of styles that we will work with.'
SUFFIX = 'Use the conversational context to select the most appropriate combination of parameters in order to mimic the speech patterns of actual people. Make sure each sub-sentence has an individually tailored array, meaning there should be some variation across the output. The output should be in the following format (omit the spaces between the numbers):\nstyle styledegree pitch rate emphasis\nWhere style is a zero-padded number from 0 to {style}, styledegree is a digit from 0 to {styledegree}, pitch is a digit from 0 to {pitch}, rate is a digit from 0 to {rate}, and emphasis is a digit from 0 to {emphasis}. Here is an example I want you to evaluate:'
class banterbot.data.prompts.SpeechSynthesisPreprocessing(value)[source]

Bases: Enum

An enumeration.

EXAMPLE_1 = "Example 1:\nInput: WHOOOAH! THAT'S A HU-GE DIS-CO-VERY! IT'S LIKE FINDING A NEED-LE IN A HAY-ST-ACK. YOU'VE DONE A STEL-LAR JOB, PAL! KEEP UP THE GOOD WORK AND DON'T LET THE NAYSAY-ERS GET YOU DOWN.\nOutput: Whoa! That's a huge discovery! It's like finding a needle in a haystack. You've done a stellar job, pal! Keep up the good work and don't let the naysayers get you down."
EXAMPLE_2 = "Example 2:\nInput: H3Y DUDE! I JST R3AD THS AW3SOME B00K ABT A SUP3R-HERO. 1T WAS TOTALLY M1ND-BL0W1NG! THE 3XPL0S1ONS, F1GHTS, AND P0W3RFUL AB1L1T1ES W3R3 S1CK! I C@N'T W@1T TO SH@R3 1T W1TH MY FR13NDS. THEY'LL B3 TOT@LLY STOK3D!\nOutput: Hey dude! I just read this awesome book about a superhero. It was totally mind-blowing! The explosions, fights, and powerful abilities were sick! I can't wait to share it with my friends. They'll be totally stoked!"
SYSTEM = 'You are a text-to-speech preprocessing assistant that converts text generated by a GPT model into a format that is more easily spoken by a text-to-speech model. Your task is to remove extraneous letters, hyphens, and correct unconventional spellings to prevent issues where the text-to-speech model misinterprets pronunciations. You should maintain the original style and intent of the text, only modifying elements that would cause pronunciation issues.'
class banterbot.data.prompts.ToneSelection(value)[source]

Bases: Enum

An enumeration.

PROMPT = "Choose the most suitable tone/emotion for the assistant's upcoming response."
SYSTEM = "You are an Emotional Tone Evaluator. Given conversational context, you analyze and select the most appropriate tone/emotion that the assistant is likely to use next. Take into consideration the conversational context and the assistant's default tone/emotion, which is {}. Make sure to give extra weight to the default tone/emotion."