An AI-powered English conversation learning application that provides personalized English practice through interactive conversations and scenario-based training.
Language Mentor Learning is an intelligent English tutoring system built with LangChain and Gradio. It features an AI teacher named DjangoPeng who helps students practice English through natural conversations and realistic scenarios like technical interviews, restaurant ordering, and meeting hosting.
- Conversation Practice: Free-form English conversation practice with an AI tutor
- Scenario Training: Practice specific real-world scenarios:
- ๐ฏ Technical Interview
- ๐ฝ๏ธ Restaurant Ordering
- ๐ Salary Negotiation
- ๐ Hotel Check-in & Apartment Rental
- Intelligent Feedback: Get real-time corrections and suggestions
- Conversation History: Maintains context throughout the conversation
- Adaptive Learning: Adjusts difficulty based on student responses
- Bilingual Support: Feedback in Chinese with English reference sentences
Language_Mentor_Learning/
โโโ src/
โ โโโ main.py # Main application entry point
โ โโโ azure_openai.py # Azure OpenAI configuration
โ โโโ agents/
โ โ โโโ agent_base.py # Base agent class
โ โ โโโ conversation_agent.py # Conversation agent with history
โ โ โโโ scenario_agent.py # Scenario-based training agent
โ โ โโโ vocab_agent.py # Vocabulary learning agent
โ โ โโโ session_history.py # Session management
โ โโโ tabs/
โ โ โโโ conversation_tab.py # Conversation practice UI
โ โ โโโ scenario_tab.py # Scenario training UI
โ โ โโโ vocab_tab.py # Vocabulary study UI
โ โโโ utils/
โ โ โโโ logger.py # Logging utility
โ โโโ tests/
โ โโโ conftest.py # Pytest configuration
โ โโโ test_agent_base.py # Agent base tests
โ โโโ test_scenario_agent.py # Scenario agent tests
โ โโโ test_conversation_agent.py # Conversation agent tests
โ โโโ test_vocab_agent.py # Vocab agent tests
โ โโโ test_session_history.py # Session management tests
โ โโโ test_integration.py # Integration tests
โ โโโ README.md # Test documentation
โโโ prompts/
โ โโโ conversation_prompt.txt # Conversation agent prompt
โ โโโ vocab_study_prompt.txt # Vocabulary agent prompt
โ โโโ *_prompt.txt # Scenario-specific prompts
โโโ content/
โ โโโ intro/ # Scenario introduction messages
โ โโโ page/ # Scenario descriptions
โโโ logs/
โ โโโ app.log # Application logs
โโโ images/ # Image assets
โโโ requirements.txt # Python dependencies
โโโ pytest.ini # Pytest configuration
โโโ TEST_SUMMARY.md # Test suite summary
โโโ README.md # This file
- Python 3.8+
- Azure OpenAI API access
- pip package manager
-
Clone the repository (or navigate to the project directory):
cd Language_Mentor_Learning -
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables: Create a
.envfile in the root directory with the following variables:AZURE_OPENAI_API_KEY=your_api_key_here AZURE_OPENAI_ENDPOINT=your_endpoint_here AZURE_API_VERSION=2024-02-15-preview AZURE_MODEL=your_model_deployment_name
-
Start the application:
cd src python main.py -
Access the interface:
- The Gradio interface will launch automatically
- Open your browser to the provided URL (typically
http://localhost:7860) - The app will also create a public share link if
share=True
-
Quick start with Docker Compose:
# Copy environment file and configure cp .env.example .env # Edit .env with your Azure OpenAI credentials # Start the application docker-compose up -d # View logs docker-compose logs -f
-
Or build and run with Docker:
# Build the image docker build -t language-mentor:latest . # Run the container docker run -d -p 7860:7860 --env-file .env language-mentor:latest
-
Access the application:
- Open browser to
http://localhost:7860
- Open browser to
For detailed Docker deployment instructions, see DOCKER_DEPLOYMENT.md
- Navigate to the "ๅฏน่ฏ็ปไน " (Conversation Practice) tab
- Start typing in English to begin your conversation
- The AI tutor will respond and provide feedback
- Use the "ๆธ ้คๅๅฒ่ฎฐๅฝ" (Clear History) button to start a new conversation
- Navigate to the "ๅบๆฏ่ฎญ็ป" (Scenario Training) tab
- Select a scenario from the dropdown menu:
- ๆฑ่้ข่ฏ (Job Interview)
- ้ ๅบๅ ฅไฝ (Hotel Check-in)
- ่ช่ต่ฐๅค (Salary Negotiation)
- ็งๆฟ (Apartment Rental)
- Follow the AI tutor's guidance through the scenario
- Practice realistic dialogues and receive feedback
- LangChain: Framework for building AI applications with LLMs
- Gradio: Web interface for machine learning applications
- Azure OpenAI: GPT-4 powered language model
- Loguru: Advanced Python logging
- Python-dotenv: Environment variable management
python-dotenv
langchain==0.2.16
langchain_core==0.2.41
langchain_community==0.2.17
langchain_openai==0.1.25
langchain_ollama==0.1.3
gradio
huggingface-hub==0.22.2
loguru==0.7.2
Practice common technical interview questions including:
- Personal introductions
- Technical knowledge questions
- Behavioral interview questions
- Project experience discussions
Learn to:
- Ask about the menu
- Place orders
- Make special requests
- Handle payment
Improve your professional skills:
- Opening remarks
- Guiding speakers
- Time management
- Meeting summaries
The AI tutor's behavior is controlled by prompts/conversation_prompt.txt. You can customize:
- Teaching style
- Difficulty levels
- Feedback language
- Scenario types
- Conversations are stored in memory with session IDs
- Each session maintains its own chat history
- Default session ID:
abc123
Application logs are stored in logs/app.log and include:
- DEBUG: Chat history and detailed agent responses
- INFO: Bot messages and user interactions
- Timestamps and source information
Contributions are welcome! Areas for improvement:
- Add more practice scenarios
- Implement voice input/output
- Add progress tracking
- Create difficulty level assessments
- Support for more languages
This project is for educational purposes.
Built with โค๏ธ for English language learners
- Azure OpenAI for providing the language model
- LangChain for the excellent LLM framework
- Gradio for the intuitive UI framework
Happy Learning! ๐