From 15ede87342c874837b0942d924c10ceb03e641f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Ruci=C5=84ski?= <44577190+szymonrucinski@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:09:05 +0200 Subject: [PATCH 1/3] add Dockerfile and docker-compose.yml --- Dockerfile | 6 ++++++ docker-compose.yml | 15 +++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a6c9bb9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM python:3.9-slim +WORKDIR /app +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt +COPY . . +CMD ["python", "-m", "routellm.openai_server", "--routers", "mf", "--strong-model", "gpt-4-1106-preview", "--weak-model", "anyscale/mistralai/Mixtral-8x7B-Instruct-v0.1"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7d232b5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3.8' + +services: + routellm: + build: + context: . + dockerfile: Dockerfile + ports: + - 6060:6060 + volumes: + - ./config.example.yaml:/app/config.example.yaml # Mount the config file + environment: + - OPENAI_API_KEY=your_openai_api_key # Replace with your actual OpenAI API key + - GROQ_API_KEY=your_groq_api_key # Replace with your actual GR0Q_API_KEY, ANYSCALE_API_KEY ETC. + command: python -m routellm.openai_server --routers mf --strong-model openai/gpt4o --weak-model groq/llama3-8b-8192 From 5410127b6c6475594c4c7202b7d0d3996f4dd5e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Ruci=C5=84ski?= <44577190+szymonrucinski@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:35:48 +0200 Subject: [PATCH 2/3] Update readme with docker guide --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 45cbe52..9f586cd 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,25 @@ cd RouteLLM pip install -e .[serve,eval] ``` +## Docker +To run Route-LLM inside Docker: +``` +git clone https://github.com/lm-sys/RouteLLM.git +cd RouteLLM + ``` + Add your keys and models in the **environment** section of docker-compose.yml: +``` + environment: + - OPENAI_API_KEY=your_weak_model_key + - ANYSCALE_MODEL_KEY=your_strong_model_key + command: python -m routellm.openai_server --routers mf --strong-model openai/gpt4o --weak-model anyscale/mistralai/Mixtral-8x7B-Instruct-v0.1 + +``` +Now simply use the docker-compose command. +``` +docker-compose up +``` + ## Quickstart Let's walkthrough replacing an existing OpenAI client to route queries between LLMs instead of using only a single model. From 62cad58a7867e4b100d8d736ada462b0dc3ca0b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Ruci=C5=84ski?= <44577190+szymonrucinski@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:37:09 +0200 Subject: [PATCH 3/3] update keys in readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9f586cd..a486192 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,8 @@ cd RouteLLM Add your keys and models in the **environment** section of docker-compose.yml: ``` environment: - - OPENAI_API_KEY=your_weak_model_key - - ANYSCALE_MODEL_KEY=your_strong_model_key + - OPENAI_API_KEY=your_strong_model_key + - ANYSCALE_MODEL_KEY=your_weak_model_key command: python -m routellm.openai_server --routers mf --strong-model openai/gpt4o --weak-model anyscale/mistralai/Mixtral-8x7B-Instruct-v0.1 ```