Llanai's Tech Stack For the Engineers
Dive into the technical architecture of Llanai, exploring both the website and chatbot components. Learn about the AWS-based backend and LLM backbone I use to measure linguistic fluency.
Posted by
Ari NakosRelated reading
Introducing the TOEFL iBT Practice Test: Your Free Path to Success!
Take a free practice test for the TOEFL iBT and boost your confidence before the big day!
Llanai Global Career Catalyst Scholarship Fall 2024
Jumpstart your international career with Llanai's Global Career Catalyst Scholarship. Understand a new language, immerse in culture, and open doors to global opportunities.
Impulsa tu Carrera: Beca Catalizadora de Carrera Global Llanai Otoño 2024
Inicia tu carrera internacional con la exclusiva Beca Catalizadora de Carrera Global de Llanai. Domina un nuevo idioma, sumérgete en la cultura y abre las puertas a oportunidades globales.
This is a continuation from Prompt Engineering a Teacher for Language Learning.
As Llanai continues to evolve, many have asked about the technical underpinnings of this language learning platform. In this article, I'll peel back the curtain and discuss the architecture of Llanai, diving into both the website and the AI-powered backend that drives the language learning experience.
Llanai: A Two-Part System
Llanai consists of two main components: the website and the chatbot. Let's explore each in detail.
The Website: Our Digital Storefront
Llanai's website serves as the global storefront, attracting users to the core product: the AI chatbot. I built the site using Marc Lou's Shipfast template and deployed it on Vercel. This approach allowed me to focus primarily on content development.
The Shipfast template has been invaluable, providing essential services for a full-stack web app, including authentication, payment processing, email handling, and database options. It's a powerful tool that I highly recommend for rapid development.
Below is an architectural schematic of Llanai's site tech stack using Shipfast and Vercel.
The Chatbot: The Heart of Llanai
About 80% of our development time went into building the chatbot. Its primary purpose is to advance the learner's fluency, which we measure through several linguistic traits:
- Rhythm and flow
- Speech Rate
- Filler words, Repetitions, self-corrections
- Grammar
- Vocabulary
Technical Implementation
We use a combination of APIs and custom implementations to measure these metrics:
- Rhythm and flow: Measured via the SpeechSuper API
- Speech rate: Custom Python implementation
- Filler words, repetitions, and corrections: OpenAI Whisper API for transcription, analyzed by an LLM
Below is an example of my speech rate over the first 9 lessons with Llanai.
The LLM Sequence
To process user data and generate responses, we use a sequence of Large Language Models (LLMs):
- Onboarding LLM
- Teacher LLM
- Summary LLM
- Conversion LLM
- Inquiry LLM
Each LLM has a specific role in the chatbot's workflow, from onboarding new users to summarizing lessons and converting the user from free to paid.
I strayed away from an agentic workflow, because I wanted to avoid unpredictable behavior. All of this relies upon a internal timers, cache memory, and CRUD operations with the underlying AWS RDS PostgreSQL.
Backend Architecture
I chose AWS to host the chatbot due to its reliability and ability to handle complex tech stacks. Here's a breakdown of our backend architecture:
- Backend Framework: FastAPI
- Messaging: Twilio (for WhatsApp integration)
- LLM Providers: OpenAI and Groq
- Text-to-Speech: XI Labs
- Pronunciation Analysis: SpeechSuper API
- Containerization: Docker
- Databases: AWS RDS PostgreSQL (long-term) and AWS ElastiCache (short-term)
- Security: AWS Web App Firewall, Lambda, and DynamoDB
- Load Distribution: AWS Load Balancer
Feedback and Visualization
The metrics collected serve two purposes:
- Input for the chatbot logic to create future learning plans
- Feedback for learners to highlight areas for improvement
Llanai comes with a web dashboard that offers an accessible interface for visualizing this information, including detailed assessments of grammar and syntax usage.
Below you can find example of visual feedback provided by Llanai.
Looking Ahead
As Llanai continues to develop, focus is on growing the user base and meeting their needs. On the same time, I hope to make this a lean and efficient engineering process. I am eager to see how Llanai evolves and the impact it has on language learners worldwide.
Hope this has been enlightening for the tech-savvy readers. As always, I welcome feedback and suggestions as I continue to refine and improve Llanai.