Skip to content

Setup and Installation

peter-olai edited this page May 7, 2025 · 4 revisions

Setup and Installation

This guide provides instructions for setting up and running Chat-Service.

Prerequisites

  • Python 3.x
  • Docker (recommended for ease of deployment)
  • Other dependencies as listed in requirements.txt

Using Docker (Recommended)

The service can be built and run using Docker and Docker Compose.

  1. Build the Docker image:
    docker-compose build
  2. Run the service:
    docker-compose up
    The service should now be accessible based on the port mappings in docker-compose.yml.

Manual Installation

  1. Clone the repository (if not already done).
  2. Create a virtual environment (recommended):
    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies:
    pip install -r requirements.txt
  4. Configure environment variables: Set up any necessary environment variables (e.g., API keys for LLMs, database connections). Refer to config.py or a sample .env file if available.
  5. Run the application: The command to run the application will depend on the web server/framework used (e.g., Uvicorn for FastAPI). This is typically defined in main.py or a run script.
    # Example for FastAPI with Uvicorn
    # uvicorn src.main:app --reload

Managing Dependencies and requirements.txt

To ensure a consistent development environment and accurately track project dependencies, it's crucial to manage the requirements.txt file correctly. For a detailed guide, refer to the Updating requirements.txt document in the main repository.

Here’s a summary of the process:

  1. Create and Activate a Virtual Environment:

    • Always work within a virtual environment to isolate project dependencies.
      python -m venv venv
      # On Windows
      venv\Scripts\activate
      # On macOS/Linux
      source venv/bin/activate
  2. Install Existing Dependencies (if any):

    • When starting on the project or a new environment, install dependencies from the existing requirements.txt:
      pip install -r requirements.txt
  3. Install New or Update Packages:

    • If you add new libraries or need to update existing ones, use pip install:
      pip install package_name
      pip install package_name==1.2.3  # To install a specific version
      pip install --upgrade package_name # To upgrade a package
  4. Update requirements.txt:

    • After installing or updating packages, regenerate the requirements.txt file to reflect these changes:
      pip freeze > requirements.txt
    • This command captures all packages currently installed in your virtual environment along with their exact versions.
  5. Commit requirements.txt:

    • Add the updated requirements.txt to your Git commit so that other developers and deployment processes use the correct set of dependencies.
  6. Deactivate Virtual Environment (when done):

    deactivate

Following these steps helps prevent dependency conflicts and ensures that the application behaves consistently across different setups.

Configuration

Key configuration options can be found in src/config.py. This may include:

  • LLM model selection
  • API keys
  • Database URIs
  • Service ports
  • Paths for RAG data

Ensure these are correctly set for your environment.

Clone this wiki locally