LanguageAssistant Full Feature Demo#

To run this example, see examples/main.py

Before starting, be sure you are exporting the necessary environment variables for your API keys. See the User Guide for more information.

# Imports
from languageassistant.assistant import Assistant
from languageassistant.transcriber import Transcriber
from languageassistant.tts import TTS

Next, save your user information and settings. If you don’t want the agent provide an introductory lesson before starting the conversation, set include_topic_lesson to False.

target_language = "Spanish"
proficiency = "Beginner"
include_topic_lesson = True

Initialize models using the user information and settings.

# Initialize models
transcriber = Transcriber()
tts = TTS(language=target_language)
assistant = Assistant(
    language=target_language, proficiency=proficiency, transcriber=transcriber, tts=tts
)

Finally, run the assistant. If you would like the Assistant to come up with topics for you, run the following:

assistant.run(include_topic_background=include_topic_lesson)

If you prefer to use your own topic(s), you can do provide your own via the lesson flag:

topic = "Greetings and introductions"
assistant.run(include_topic_background=include_topic_lesson, lesson=[topic])