Skip to content

Commit

Permalink
Merge pull request #8 from GabrielSCabrera/dev
Browse files Browse the repository at this point in the history
Add new teacher characters
  • Loading branch information
GabrielSCabrera authored Dec 29, 2023
2 parents bdbfef2 + 50af2c2 commit 4f2841c
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ BanterBot is a user-friendly chatbot application that leverages OpenAI models fo

* Utilizes OpenAI models to generate context-aware responses
* Leverages Azure Neural Voices for premium text-to-speech synthesis
* Offers a wide range of output formats, voices, and speaking styles
* Offers a wide range of output formats, multilingual voices, and speaking styles
* Allows real-time monitoring of the chatbot's responses
* Supports asynchronous speech-to-text microphone input
* Includes an abstract base class for creating custom frontends for the BanterBot application
Expand Down
4 changes: 3 additions & 1 deletion banterbot/characters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from banterbot.characters.chef import run as chef
from banterbot.characters.historian import run as historian
from banterbot.characters.quiz import run as quiz
from banterbot.characters.teacher_french import run as teacher_french
from banterbot.characters.teacher_mandarin import run as teacher_mandarin
from banterbot.characters.therapist import run as therapist

__all__ = ["android", "bartender", "chef", "historian", "quiz", "therapist"]
__all__ = ["android", "bartender", "chef", "historian", "quiz", "teacher_french", "teacher_mandarin", "therapist"]
2 changes: 1 addition & 1 deletion banterbot/characters/historian.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def run() -> None:
" knowledge is vast like a labyrinth, but your focus is as fleeting as a butterfly, often leading you down"
" tangents of trivial tidbits. Your command of the historical language is impeccable, yet your interpretations"
" are as fanciful as gnome folklore itself. Despite your tendency to embellish, you endeavor to enlighten any"
" inquirer with your boundless enthusiasm for historical tales, both grandiose and mundane.Be sure everything"
" inquirer with your boundless enthusiasm for historical tales, both grandiose and mundane. Be sure everything"
" you say is in a format that can be spoken out loud, rather than listed and formatted for text."
)

Expand Down
30 changes: 30 additions & 0 deletions banterbot/characters/teacher_french.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from banterbot import AzureNeuralVoiceManager, OpenAIModelManager, TKInterface


def run() -> None:
"""
Runs the TKInterface for a custom-made character.
"""
model = OpenAIModelManager.load("gpt-4-turbo")
tone_model = OpenAIModelManager.load("gpt-4-turbo")
voice = AzureNeuralVoiceManager.load("Henri")

# Optional system prompt to set up a custom character prior to initializing BanterBot.
system = (
"You are Henri, a dedicated and passionate French teacher for English speakers known for your engaging and"
" effective teaching methods. You are receiving voice transcriptions that may not always perfectly capture the"
" student's intended words due to accents or pronunciation differences. When it seems like a word may have been"
" misinterpreted by the voice transcription, you use contextual understanding to deduce the most likely"
" meaning. Be sure everything you say is in a format suitable for dictation, rather than reading, and remain"
" flexible and patient with the nuances of spoken language."
)

interface = TKInterface(
model=model,
voice=voice,
system=system,
tone_model=tone_model,
languages=["en-US", "fr-FR"],
assistant_name="Henri",
)
interface.run(greet=True)
32 changes: 32 additions & 0 deletions banterbot/characters/teacher_mandarin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from banterbot import AzureNeuralVoiceManager, OpenAIModelManager, TKInterface


def run() -> None:
"""
Runs the TKInterface for a custom-made character.
"""
model = OpenAIModelManager.load("gpt-4-turbo")
tone_model = OpenAIModelManager.load("gpt-4-turbo")
voice = AzureNeuralVoiceManager.load("Xiaoxiao")

# Optional system prompt to set up a custom character prior to initializing BanterBot.
system = (
"You are Chen Lao Shi, a kind but firm Chinese teacher for English speakers known for your patience and"
" effective teaching methods. You speak with a clear and articulate Mandarin accent and sometimes mix in"
" Chinese words with English for emphasis. You are receiving voice transcriptions that may not always perfectly"
" capture the student's intended words due to accents or pronunciation differences. When it seems like a word"
" may have been misinterpreted by the voice transcription, you use contextual understanding to deduce the most"
" likely meaning. Be sure everything you say is in a format suitable for dictation, rather than reading, and"
" remain flexible and patient with the nuances of spoken language."
)

interface = TKInterface(
model=model,
voice=voice,
system=system,
tone_model=tone_model,
languages=["en-US", "zh-CN"],
phrase_list=["Chen Lao Shi"],
assistant_name="Chen Lao Shi",
)
interface.run(greet=True)
4 changes: 2 additions & 2 deletions banterbot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
generate_uuid = uuid6.uuid8

# Define the punctuation marks that can be used to split sentences into phrases for prosody selection.
PHRASE_DELIM = [",", ".", "?", "!", ":", ";", '"', "`", "|", "\n", "\t", "\r\n"]
PHRASE_DELIM = [",", ".", "?", "!", ":", ";", "|", "\n", "\t", "\r\n"]

# The amount of time that should be added to a "soft interruption" as defined in class `SpeechRecognitionService`.
INTERRUPTION_DELAY: datetime.timedelta = datetime.timedelta(seconds=0.5)
INTERRUPTION_DELAY: datetime.timedelta = datetime.timedelta(seconds=1.0)
2 changes: 2 additions & 0 deletions banterbot/gui/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"chef": (characters.chef, "Boyardine the Angry Chef"),
"historian": (characters.historian, "Blabberlore the Gnome Historian"),
"quiz": (characters.quiz, "Grondle the Quiz Troll"),
"teacher-french": (characters.teacher_french, "Henri the French Teacher"),
"teacher-mandarin": (characters.teacher_mandarin, "Chen Lao Shi the Mandarin Chinese Teacher"),
"therapist": (characters.therapist, "Grendel the Therapy Troll"),
}

Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Features
- Utilizes OpenAI models to generate context-aware responses
- Leverages Azure Neural Voices for premium text-to-speech
synthesis
- Offers a wide range of output formats, voices, and speaking
styles
- Offers a wide range of output formats, multilingual voices,
and speaking styles
- Allows real-time monitoring of the chatbot's responses
- Supports asynchronous speech-to-text microphone input
- Includes an abstract base class for creating custom frontends
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def run_tests():
return test_suite


version = "0.0.14"
version = "0.0.15"
setup(
author="Gabriel S. Cabrera",
author_email="[email protected]",
Expand Down

0 comments on commit 4f2841c

Please sign in to comment.