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..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 @@ -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 @@ -35,13 +35,13 @@ 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 -- 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..b109724 100644 --- a/compose.yaml +++ b/compose.yaml @@ -2,9 +2,9 @@ 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: - ./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=