Skip to content
This repository was archived by the owner on Jan 5, 2025. It is now read-only.

Files

Latest commit

 

History

History

llm-server

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Guide to Debugging "opencopilot" with VS Code

Welcome to the local development and debugging guide for the "opencopilot" Flask application. This guide will help you set up your environment and effectively utilize VS Code for debugging.

Table of Contents


Getting Started Guide: Debugging "opencopilot" with VS Code

This section guides you through setting up your environment and using VS Code for debugging the "opencopilot" Flask application.

Prerequisites

Conda Installation

Install Conda by following the official Conda installation guide, then check your Conda version with conda --version.

Mypy Installation (Optional)

For an enhanced development experience with Mypy (optional), activate your Conda environment and run pip install mypy.

Copilot LLM Flask Application Setup

Prerequisites

  1. Clone the "opencopilot" Flask App repository onto your local machine.

Environmental Configuration

Configure the "llm_server" project environment as follows:

  1. Create .env File: At the root of the "llm_server" directory, create a new .env file to hold environmental configuration settings for local development.

    Example .env File:

    OPENAI_API_KEY=<YOUR OPEN AI KEY>
  2. Set Additional Environment Variables (Optional) Set any desired optional environment variables for copilot customization within the .env file.

    Optional variable examples include:

       - `MONGODB_URI`: MongoDB connection string.
       - `QDRANT_SERVER_URI`: QDRANT server URL.
       - `QDRANT_API_KEY`: Your QDRANT API key.
       - `QDRANT_PASS`: Base64-encoded string for QDRANT pass.
       - `ACTIONS_SCORE_THRESHOLD`: Threshold for actions score (default: 0.5).
       - `FLOWS_SCORE_THRESHOLD`: Threshold for flows score (default: 0.5).
       - `KB_SCORE_THRESHOLD`: Threshold for KB score (default: 0.5).
       - `TARGET`: Environment target (default: production).

    Replace placeholders with appropriate configurations. For more information about these options, see the original documentation.

Project Dependencies

To install required packages, execute pip install -r requirements.txt from the project directory.

Debugging Locally with VS Code

  1. Select the 'Flask' debug configuration.
  2. Launch debug mode with F5.

Docker Debugging

With Docker and Docker Compose installed, perform the following tasks:

  1. In the Makefile, set TARGET=development.
  2. Execute either make install or make install-arm, depending on your system architecture.
  3. Within the "llm-server" directory, locate the Docker container for debugging purposes.
  4. Attach the VSCode debugger to the running container for debugging. Wait for the Flask process to begin before proceeding.

Benefit from convenient hot reloading while debugging inside Docker containers without needing to restart the container after every code modification.

Happy debugging! πŸš€


Use Open Source Model Environment Variables

To use the open-source model, set the following environment variables, thanks to Justin van Grootveld:

OPENAI_API_KEY=unused
CHAT_MODEL=openchat
EMBEDDING_PROVIDER=openchat
LOCAL_IP=http://host.docker.internal
VECTOR_SIZE=4096

File Storage Configuration

The following environment variables are used to configure the file storage for the application:

  • STORAGE_TYPE: Specifies the type of file storage to be used. Currently, the supported options are s3 and local. Set this variable to s3 if you want to use Amazon S3 for file storage, or set it to local if you want to use the local file system.

  • AWS_ACCESS_KEY_ID (required if STORAGE_TYPE is set to s3): Specifies the access key ID for the AWS account that has access to the S3 bucket. This key is used to authenticate requests made to the S3 service.

  • AWS_SECRET_ACCESS_KEY (required if STORAGE_TYPE is set to s3): Specifies the secret access key for the AWS account that has access to the S3 bucket. This key is used to authenticate requests made to the S3 service.

Make sure to provide the appropriate values for these environment variables based on your desired file storage configuration.