Skip to content

An AI-powered English conversation learning application that provides personalized English practice through interactive conversations and scenario-based training.

Notifications You must be signed in to change notification settings

paulhuiseismic/Language_Mentor_Learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Language Mentor Learning ๐ŸŽ“

An AI-powered English conversation learning application that provides personalized English practice through interactive conversations and scenario-based training.

๐Ÿ“‹ Overview

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.

โœจ Features

  • 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

๐Ÿ—๏ธ Project Structure

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

๐Ÿš€ Getting Started

Prerequisites

  • Python 3.8+
  • Azure OpenAI API access
  • pip package manager

Installation

  1. Clone the repository (or navigate to the project directory):

    cd Language_Mentor_Learning
  2. Install dependencies:

    pip install -r requirements.txt
  3. Configure environment variables: Create a .env file 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

Running the Application

Option 1: Local Python Environment

  1. Start the application:

    cd src
    python main.py
  2. 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

Option 2: Docker Container (Recommended for Production)

  1. 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
  2. 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
  3. Access the application:

    • Open browser to http://localhost:7860

For detailed Docker deployment instructions, see DOCKER_DEPLOYMENT.md

๐ŸŽฏ How to Use

Conversation Practice Tab

  1. Navigate to the "ๅฏน่ฏ็ปƒไน " (Conversation Practice) tab
  2. Start typing in English to begin your conversation
  3. The AI tutor will respond and provide feedback
  4. Use the "ๆธ…้™คๅކๅฒ่ฎฐๅฝ•" (Clear History) button to start a new conversation

Scenario Training Tab

  1. Navigate to the "ๅœบๆ™ฏ่ฎญ็ปƒ" (Scenario Training) tab
  2. Select a scenario from the dropdown menu:
    • ๆฑ‚่Œ้ข่ฏ• (Job Interview)
    • ้…’ๅบ—ๅ…ฅไฝ (Hotel Check-in)
    • ่–ช่ต„่ฐˆๅˆค (Salary Negotiation)
    • ็งŸๆˆฟ (Apartment Rental)
  3. Follow the AI tutor's guidance through the scenario
  4. Practice realistic dialogues and receive feedback

๐Ÿง  Technology Stack

  • 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

๐Ÿ“ฆ Dependencies

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

๐ŸŽ“ Learning Scenarios

1. Technical Interview

Practice common technical interview questions including:

  • Personal introductions
  • Technical knowledge questions
  • Behavioral interview questions
  • Project experience discussions

2. Restaurant Ordering

Learn to:

  • Ask about the menu
  • Place orders
  • Make special requests
  • Handle payment

3. Meeting Hosting

Improve your professional skills:

  • Opening remarks
  • Guiding speakers
  • Time management
  • Meeting summaries

๐Ÿ”ง Configuration

System Prompt

The AI tutor's behavior is controlled by prompts/conversation_prompt.txt. You can customize:

  • Teaching style
  • Difficulty levels
  • Feedback language
  • Scenario types

Session Management

  • Conversations are stored in memory with session IDs
  • Each session maintains its own chat history
  • Default session ID: abc123

๐Ÿ“ Logging

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

๐Ÿค Contributing

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

๐Ÿ“„ License

This project is for educational purposes.

๐Ÿ‘ค Author

Built with โค๏ธ for English language learners

๐Ÿ™ Acknowledgments

  • Azure OpenAI for providing the language model
  • LangChain for the excellent LLM framework
  • Gradio for the intuitive UI framework

Happy Learning! ๐Ÿ“š

About

An AI-powered English conversation learning application that provides personalized English practice through interactive conversations and scenario-based training.

Resources

Stars

Watchers

Forks

Packages

No packages published