From 6ca8caa61339c0e14126177300795770f05af08b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaan=20=C3=87ayl=C4=B1?= <38523756+kaancayli@users.noreply.github.com> Date: Tue, 3 Sep 2024 18:59:06 +0200 Subject: [PATCH 1/4] Enhance README.MD --- README.MD | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/README.MD b/README.MD index a3bba0c4..29b90544 100644 --- a/README.MD +++ b/README.MD @@ -1,16 +1,64 @@ # Pyris V2 -## With local environment +Pyris is an intermediary system that links the [Artemis](https://github.com/ls1intum/Artemis) platform with various Large Language Models (LLMs). It provides a REST API that allows Artemis to interact with different pipelines based on specific tasks. -### Setup +## Features +- **Modular Design**: Pyris is built to be modular, allowing for integration of new models and pipelines. This design helps the system adapt to different requirements. +- **RAG Support**: Pyris implements Retrieval-Augmented Generation (RAG) using [Weaviate](https://weaviate.io/), a vector database. This feature enables the generation of responses based on retrieved context, potentially improving the relevance of outputs. +- **Flexible Pipelines**: The system supports various pipelines that can be selected depending on the task at hand, providing versatility in handling different types of requests. + +Currently, Pyris empowers [Iris](https://artemis.cit.tum.de/about-iris), a virtual AI Tutor that helps students with their programming exercises on Artemis in a didactically meaningful way. + +## Setup +### With local environment +> **⚠️ Warning:** For local Weaviate vector database setup, please refer to [Weaviate Docs](https://weaviate.io/developers/weaviate/quickstart). - Check python version: `python --version` (should be 3.12) - Install packages: `pip install -r requirements.txt` + - Create an `application.local.yml` file in the root directory. This file includes configurations that can be used by the application. + - Example `application.local.yml`: + ```yaml + api_keys: + - token: "secret" + + weaviate: + host: "localhost" + port: "8001" + grpc_port: "50051" + + env_vars: + test: "test" + ``` + - Create an `llm-config.local.yml` file in the root directory. This file includes a list of models with their configurations that can be used by the application. + - Example `llm-config.local.yml`: + ```yaml + - id: "" + name: "" + description: "" + type: ", e.g. azure-chat, ollama" + endpoint: "" + api_version: "" + azure_deployment: "" + model: ", e.g. gpt-3.5-turbo" + api_key: "" + tools: [] + capabilities: + input_cost: 0.5 + output_cost: 1.5 + gpt_version_equivalent: 3.5 + context_length: 16385 + vendor: "" + privacy_compliance: True + self_hosted: False + image_recognition: False + json_mode: True + ``` + - Each model configuration in the `llm-config.local.yml` file also include capabilities that will be used by the application to select the best model for a specific task. -### Run server +#### Run server - Run server: ```[bash] APPLICATION_YML_PATH= LLM_CONFIG_PATH= uvicorn app.main:app --reload ``` - Access API docs: http://localhost:8000/docs -## With docker +### With docker TBD \ No newline at end of file From e236d15cac58b0e5239084a216647f31f14eed42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kaan=20=C3=87ayl=C4=B1?= <38523756+kaancayli@users.noreply.github.com> Date: Tue, 3 Sep 2024 19:21:57 +0200 Subject: [PATCH 2/4] Do not check linting in prompt files --- app/pipeline/prompts/iris_exercise_chat_prompts.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/pipeline/prompts/iris_exercise_chat_prompts.py b/app/pipeline/prompts/iris_exercise_chat_prompts.py index f9d48106..9115fead 100644 --- a/app/pipeline/prompts/iris_exercise_chat_prompts.py +++ b/app/pipeline/prompts/iris_exercise_chat_prompts.py @@ -1,3 +1,4 @@ +# flake8: noqa iris_initial_system_prompt = """You're Iris, the AI programming tutor integrated into Artemis, the online learning platform of the Technical University of Munich (TUM). From 9c722e0ac8d6f2d92f5ce0148c84c2100287abb4 Mon Sep 17 00:00:00 2001 From: Yassine Souissi Date: Tue, 3 Sep 2024 19:22:02 +0200 Subject: [PATCH 3/4] Add docker readme --- README.MD | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/README.MD b/README.MD index 29b90544..7ad4f290 100644 --- a/README.MD +++ b/README.MD @@ -61,4 +61,84 @@ Currently, Pyris empowers [Iris](https://artemis.cit.tum.de/about-iris), a virtu - Access API docs: http://localhost:8000/docs ### With docker -TBD \ No newline at end of file +Pyris can be deployed using Docker, which provides an easy way to set up the application in a consistent environment. +Below are the instructions for setting up Pyris using Docker. + +#### Prerequisites +- Ensure Docker and Docker Compose are installed on your machine. +- Clone the Pyris repository to your local machine. +- +#### Setup Instructions + +1. **Build and Run the Containers** + + You can run Pyris in different environments: development or production. Docker Compose is used to orchestrate the different services, including Pyris, Weaviate, and Nginx. + + - **For Development:** + + Use the following command to start the development environment: + + ```bash + docker-compose -f docker-compose/pyris-dev.yml up --build + ``` + + This command will: + - Build the Pyris application from the Dockerfile. + - Start the Pyris application along with Weaviate in development mode. + - Mount the local configuration files (`application.local.yml` and `llm-config.local.yml`) for easy modification. + + The application will be available at `http://localhost:8000`. + + - **For Production:** + + Use the following command to start the production environment: + + ```bash + docker-compose -f docker-compose/pyris-production.yml up -d + ``` + + This command will: + - Pull the latest Pyris image from the GitHub Container Registry. + - Start the Pyris application along with Weaviate and Nginx in production mode. + - Nginx will serve as a reverse proxy, handling SSL termination if certificates are provided. + + The application will be available at `https://`. + +2. **Configuration** + + - **Weaviate**: Weaviate is configured via the `weaviate.yml` file. By default, it runs on port 8001. + - **Pyris Application**: The Pyris application configuration is handled through environment variables and mounted YAML configuration files. + - **Nginx**: Nginx is used for handling requests in a production environment and is configured via `nginx.yml`. + +3. **Accessing the Application** + + - For development, access the API documentation at: `http://localhost:8000/docs` + - For production, access the application at your domain (e.g., `https://`). + +4. **Stopping the Containers** + + To stop the running containers, use: + + ```bash + docker-compose -f docker-compose/pyris-dev.yml down + ``` + + or + + ```bash + docker-compose -f docker-compose/pyris-production.yml down + ``` + +5. **Logs and Debugging** + + - View the logs for a specific service, e.g., Pyris: + + ```bash + docker-compose -f docker-compose/pyris-dev.yml logs pyris-app + ``` + + - For production, ensure that Nginx and Weaviate services are running smoothly and check their respective logs if needed. + +--- + +This setup should help you run the Pyris application in both development and production environments with Docker. Ensure you modify the configuration files as per your specific requirements before deploying. \ No newline at end of file From 5efb1986ca9c81ab9f8385e1281cf522d460e0eb Mon Sep 17 00:00:00 2001 From: Yassine Souissi Date: Tue, 3 Sep 2024 20:23:49 +0200 Subject: [PATCH 4/4] Make the docker part more understandable and beginner friendly --- README.MD | 103 ++++++++++++++++++++++-------------------------------- 1 file changed, 42 insertions(+), 61 deletions(-) diff --git a/README.MD b/README.MD index 7ad4f290..4d18e6b8 100644 --- a/README.MD +++ b/README.MD @@ -10,7 +10,7 @@ Currently, Pyris empowers [Iris](https://artemis.cit.tum.de/about-iris), a virtu ## Setup ### With local environment -> **⚠️ Warning:** For local Weaviate vector database setup, please refer to [Weaviate Docs](https://weaviate.io/developers/weaviate/quickstart). +> **⚠️ Warning:** To change the local Weaviate vector database setup, please refer to [Weaviate Docs](https://weaviate.io/developers/weaviate/quickstart). - Check python version: `python --version` (should be 3.12) - Install packages: `pip install -r requirements.txt` - Create an `application.local.yml` file in the root directory. This file includes configurations that can be used by the application. @@ -59,86 +59,67 @@ Currently, Pyris empowers [Iris](https://artemis.cit.tum.de/about-iris), a virtu APPLICATION_YML_PATH= LLM_CONFIG_PATH= uvicorn app.main:app --reload ``` - Access API docs: http://localhost:8000/docs + - +### Getting Started with Docker -### With docker -Pyris can be deployed using Docker, which provides an easy way to set up the application in a consistent environment. -Below are the instructions for setting up Pyris using Docker. +Deploying Pyris using Docker is a straightforward way to set up the application in a consistent environment. Here's how you can do it: -#### Prerequisites -- Ensure Docker and Docker Compose are installed on your machine. -- Clone the Pyris repository to your local machine. -- -#### Setup Instructions +**Build and Run the Containers** -1. **Build and Run the Containers** +The essential part of setting up Pyris with Docker is building and running the containers. Docker Compose is used to manage the different services, including Pyris, Weaviate, and Nginx, for both development and production environments. - You can run Pyris in different environments: development or production. Docker Compose is used to orchestrate the different services, including Pyris, Weaviate, and Nginx. +- **For Development:** - - **For Development:** + To start the development environment, run: - Use the following command to start the development environment: - - ```bash - docker-compose -f docker-compose/pyris-dev.yml up --build - ``` - - This command will: - - Build the Pyris application from the Dockerfile. - - Start the Pyris application along with Weaviate in development mode. - - Mount the local configuration files (`application.local.yml` and `llm-config.local.yml`) for easy modification. - - The application will be available at `http://localhost:8000`. - - - **For Production:** - - Use the following command to start the production environment: - - ```bash - docker-compose -f docker-compose/pyris-production.yml up -d - ``` + ```bash + docker-compose -f docker-compose/pyris-dev.yml up --build + ``` - This command will: - - Pull the latest Pyris image from the GitHub Container Registry. - - Start the Pyris application along with Weaviate and Nginx in production mode. - - Nginx will serve as a reverse proxy, handling SSL termination if certificates are provided. + This command will: + - Build the Pyris application. + - Start the Pyris application along with Weaviate in development mode. + - Mount local configuration files for easy modification. - The application will be available at `https://`. + The application will be available at `http://localhost:8000`. -2. **Configuration** +- **For Production:** - - **Weaviate**: Weaviate is configured via the `weaviate.yml` file. By default, it runs on port 8001. - - **Pyris Application**: The Pyris application configuration is handled through environment variables and mounted YAML configuration files. - - **Nginx**: Nginx is used for handling requests in a production environment and is configured via `nginx.yml`. + To start the production environment, run: -3. **Accessing the Application** + ```bash + docker-compose -f docker-compose/pyris-production.yml up -d + ``` - - For development, access the API documentation at: `http://localhost:8000/docs` - - For production, access the application at your domain (e.g., `https://`). + This command will: + - Pull the latest Pyris image from the GitHub Container Registry. + - Start Pyris along with Weaviate and Nginx in production mode. + - Nginx will handle SSL and serve as a reverse proxy. -4. **Stopping the Containers** + The application will be available at `https://`. - To stop the running containers, use: +#### Additional Steps (Optional) - ```bash - docker-compose -f docker-compose/pyris-dev.yml down - ``` +If you need to stop the containers, use: - or +```bash +docker-compose -f docker-compose/pyris-dev.yml down +``` - ```bash - docker-compose -f docker-compose/pyris-production.yml down - ``` +or -5. **Logs and Debugging** +```bash +docker-compose -f docker-compose/pyris-production.yml down +``` - - View the logs for a specific service, e.g., Pyris: +You can also customize the configuration for Weaviate, Pyris, and Nginx by editing their respective configuration files. However, the default setup should work fine for most users. - ```bash - docker-compose -f docker-compose/pyris-dev.yml logs pyris-app - ``` +For development, access the API documentation at `http://localhost:8000/docs`. For production, access the application at your domain (e.g., `https://`). - - For production, ensure that Nginx and Weaviate services are running smoothly and check their respective logs if needed. +If you need to view logs or debug, you can check the logs of specific services using: ---- +```bash +docker-compose -f docker-compose/pyris-dev.yml logs pyris-app +``` -This setup should help you run the Pyris application in both development and production environments with Docker. Ensure you modify the configuration files as per your specific requirements before deploying. \ No newline at end of file +This guide should help you quickly get Pyris running with Docker. The first step—building and running the containers—is all you need to get started! \ No newline at end of file