From 2b5fb9fe79a02406e663a1f8c2e3913c27452450 Mon Sep 17 00:00:00 2001 From: Roman Glushko Date: Mon, 13 May 2024 13:31:13 +0300 Subject: [PATCH 1/3] Simplified the way of passing secrets in the example project --- .gitignore | 2 +- Makefile | 7 +++---- README.md | 13 +++++++------ compose.yaml | 2 +- config.yaml | 5 ++--- env.sample | 1 + 6 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 env.sample diff --git a/.gitignore b/.gitignore index d7048d5..8c15f27 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .idea .vs_code .DS_Store -secrets +.env diff --git a/Makefile b/Makefile index 40ae98a..ef6f4d5 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,9 @@ init: ## init demo env @echo "πŸš€Welcome to Glide Demo" - @echo "πŸ”§ Creating a $(PWD)/secrets/.OPENAI_API_KEY file" - @mkdir -p $(PWD)/secrets - @touch $(PWD)/secrets/.OPENAI_API_KEY + @echo "πŸ”§ Setting up .env file" + @cp env.sample .env @echo "πŸŽ‰ We are ALMOST there!" - @echo "1. Put your OpenAI API key into $(PWD)/secrets/.OPENAI_API_KEY file" + @echo "1. Put your OpenAI API key .env file" @echo "2. Run 'docker-compose up' or simply 'make up' to start your demo environment" @echo "3. Do 'curl -v localhost:9099/v1/health/' to make sure Glide is running πŸš€" diff --git a/README.md b/README.md index 35d6abd..7ab5b9b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The demo repository comes with a basic config. Additionally, you need to init yo make init # from the demo root ``` -This will create the `secrets` directory with one `.OPENAI_API_KEY` file that you need to put your key to. +This will create the `.env` file with one `OPENAI_API_KEY` environment variable where you need to specify your API key. #### 3. Start Glide @@ -40,8 +40,8 @@ git clone https://github.com/EinStack/glide-demo.git #### 2. Init Configs -- create a dir called `secrets` in the demo project root -- inside of the dir create a new file called `.OPENAI_API_KEY` with your OpenAI access token +- copy `env.sample` file as `.env` +- inside the `.env` file specify your OpenAI access token #### 3. Start Glide @@ -51,10 +51,11 @@ After that, just use docker compose via this command to start your demo environm docker-compose up -d ``` -## 4. Sample API Request to `/chat` endpoint +## 4. Sample API Request to the chat endpoint -See [API Reference](https://backlandlabs.mintlify.app/api-reference/introduction) for more details. +URL: POST `http://127.0.0.1:9099/v1/language/default/chat` +Payload: ```json { "message": @@ -62,7 +63,7 @@ See [API Reference](https://backlandlabs.mintlify.app/api-reference/introduction "role": "user", "content": "Where was it played?" }, - "messageHistory": [ + "message_history": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Who won the world series in 2020?"}, {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."} diff --git a/compose.yaml b/compose.yaml index 04faef7..1a48db9 100644 --- a/compose.yaml +++ b/compose.yaml @@ -7,4 +7,4 @@ services: - 9099:9099 volumes: - ./config.yaml:/bin/config.yaml - - ./secrets/:/bin/secrets/ + - ./.env:/bin/.env diff --git a/config.yaml b/config.yaml index f1b3ad1..f81602d 100644 --- a/config.yaml +++ b/config.yaml @@ -1,5 +1,4 @@ # Glide Sample Config - telemetry: logging: level: debug @@ -12,8 +11,8 @@ api: routers: language: - - id: myrouter + - id: default models: - id: openai openai: - api_key: ${file:./secrets/.OPENAI_API_KEY} # make sure ./secrets/.OPENAI_API_KEY is available (or simply run `make init` to create it) + api_key: ${env:OPENAI_API_KEY} # make sure .env is available (or simply run `make init` to create it) diff --git a/env.sample b/env.sample new file mode 100644 index 0000000..eafbef7 --- /dev/null +++ b/env.sample @@ -0,0 +1 @@ +OPENAI_API_KEY= From 516d619a6431a881817549003b7a2c3fb247183f Mon Sep 17 00:00:00 2001 From: Roman Glushko Date: Sun, 19 May 2024 12:58:41 +0300 Subject: [PATCH 2/3] Passed dotenv to the bin --- compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose.yaml b/compose.yaml index 1a48db9..b109724 100644 --- a/compose.yaml +++ b/compose.yaml @@ -2,7 +2,7 @@ version: '3.3' services: glide: image: ghcr.io/einstack/glide:latest-alpine - command: --config /bin/config.yaml + command: --env /bin/.env -c /bin/config.yaml ports: - 9099:9099 volumes: From a62b69f66c5b88c6b4f10ed70b34b8e49232d3df Mon Sep 17 00:00:00 2001 From: Roman Glushko Date: Sun, 19 May 2024 13:01:03 +0300 Subject: [PATCH 3/3] Updated the repo names --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7ab5b9b..e6dde8f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Get started with Glide Gateway in under a few minutes with docker-compose. #### 1. Clone this repository ```bash -git clone https://github.com/EinStack/glide-demo.git +git clone https://github.com/EinStack/glide-examples.git ``` #### 2. Init Configs @@ -35,7 +35,7 @@ make up #### 1. Clone this repository ```bash -git clone https://github.com/EinStack/glide-demo.git +git clone https://github.com/EinStack/glide-examples.git ``` #### 2. Init Configs