This project is an AI-powered language learning application that provides an interactive tutoring experience. It combines a Python-based backend with a JavaScript frontend to create a responsive and engaging platform for language learners.
- Real-time audio processing and transcription
- AI-powered language partner for conversation practice
- Intelligent tutoring system with adjustable intervention levels
- Dynamic conversation summarization
- Text-to-speech functionality for AI responses
- Customizable user interface for learning preferences
- Adjustable silence threshold for audio detection
- FastAPI for the web framework
- LangChain for AI model integration (using Groq and OpenAI models)
- Pydantic for data validation
- dotenv for environment variable management
- Vanilla JavaScript for core functionality
- Web Audio API for audio processing
- MediaRecorder API for audio recording
- Fetch API for server communication
- Clone the repository
- Install backend dependencies:
pip install fastapi pydantic python-dotenv langchain-groq langchain-openai
- Set up environment variables in a
.env
file:GROQ_API_KEY=your_groq_api_key OPENAI_API_KEY=your_openai_api_key
- Run the backend server:
uvicorn main:app --host 0.0.0.0 --port 8000
- Open
index.html
in a web browser to access the frontend
- Select your native language, tutoring language, and preferred settings
- Adjust the silence threshold using the provided slider
- Click "Start Tutor" to begin a session
- Speak into your microphone to converse with the AI partner
- The AI tutor will provide feedback based on your chosen intervention level
- Review the conversation summary and tutor comments for learning insights
main.py
: FastAPI application setup and main audio processing endpointagents.py
: AI agent implementations for partner chat, tutor feedback, and summarizationutils.py
: Utility functions for audio transcription and text-to-speech
tutor-ui.js
: User interface management and event handlingtutor-core.js
: Core functionality for audio recording, processing, and communication with the backendapi-service.js
: API communication serviceaudio-utils.js
: Audio processing utilities
The frontend is configured to make API calls to the backend server. By default, it assumes the backend is running on the same machine. If you need to change this:
- Open the
api-service.js
file - Locate the
sendAudioToServer
function - Find the line:
const response = await fetch('/process_audio', {
- Replace
/process_audio
with the full URL of your backend server if it's hosted elsewhere, e.g.,https://your-backend-server.com/process_audio
Ensure that your backend server is accessible from the frontend's location and that CORS is properly configured if they're on different domains.
- Use the silence threshold slider in the UI to adjust audio detection sensitivity
- Modify the system prompts in
agents.py
to alter the behavior of the AI partner and tutor - Customize the user interface in
index.html
andtutor-ui.js
to match your desired look and feel
- Implement user authentication and session management
- Add support for more languages and language pairs
- Integrate progress tracking and performance analytics
- Develop mobile applications for iOS and Android
Contributions are welcome! Please fork the repository and submit pull requests with any enhancements, bug fixes, or documentation improvements.
[Insert your chosen license here]