scratch_chat / README2.md
WebashalarForML's picture
Rename README.md to README2.md
8739ba0 verified

Multi-Language Chat Agent

A Flask-based chat agent that supports multiple programming languages with Python as the default. The agent maintains proper chat history, integrates with Groq LangChain API for LLM capabilities, and provides language-specific assistance to students learning to code.

Project Structure

chat_agent/
├── chat_agent/                 # Main application package
│   ├── __init__.py
│   ├── api/                    # REST API endpoints
│   ├── models/                 # Data models
│   ├── services/               # Business logic services
│   ├── utils/                  # Utility functions
│   └── websocket/              # WebSocket handlers
├── static/                     # Static assets (CSS, JS)
│   ├── css/
│   └── js/
├── templates/                  # HTML templates
├── tests/                      # Test suite
│   ├── unit/                   # Unit tests
│   └── integration/            # Integration tests
├── app.py                      # Application entry point
├── config.py                   # Configuration management
├── requirements.txt            # Python dependencies
└── .env.example               # Environment variables template

Setup Instructions

  1. Clone and navigate to the project directory

  2. Create a virtual environment

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
  3. Install dependencies

    pip install -r requirements.txt
    
  4. Set up environment variables

    cp .env.example .env
    # Edit .env with your actual configuration values
    
  5. Set up databases

    • Install and start PostgreSQL
    • Install and start Redis
    • Update database connection strings in .env
  6. Run the application

    python app.py
    

Environment Variables

Copy .env.example to .env and configure the following:

  • GROQ_API_KEY: Your Groq API key for LLM integration
  • DATABASE_URL: PostgreSQL connection string
  • REDIS_URL: Redis connection string
  • SECRET_KEY: Flask secret key for sessions

Features

  • Multi-language programming support (Python, JavaScript, Java, C++, etc.)
  • Real-time chat with WebSocket communication
  • Persistent chat history with Redis caching
  • Groq LangChain API integration
  • Session management for concurrent users
  • Language context switching mid-conversation

Development

This project follows the spec-driven development methodology. See the implementation tasks in .kiro/specs/multi-language-chat-agent/tasks.md for detailed development steps.

Testing

Run tests with:

pytest tests/

License

MIT License