1.0.0 • Published 1 month ago

dxpllm-quote v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 month ago

Introduction

Welcome to DXP LLM enabled Quote API service. There are two node projects in this solution.

  1. Backend API for Quote AI Service (dxpllm-quote)
  2. A development UI for testing and demo purposes (ui)

Getting Started

Installing Backend Dependencies

Use node version 18.xx.xx or higher.

In the root, run npm install -g vsts-npm-auth. In your root directory, create a .npmrc file. Paste the below lines into it.

@dxpllm:registry=https://geico.pkgs.visualstudio.com/40a5e92a-a7a7-4355-a86e-8e606f618850/_packaging/DXPLLM/npm/registry/
@gdk:registry=https://geico.pkgs.visualstudio.com/5c20fde4-e106-42a6-8eaf-b911a05f9552/_packaging/DigitalExperience/npm/registry/
registry=https://registry.npmjs.org/

Then, run the command vsts-npm-auth -config .npmrc to authenticate to GEICO's feeds. After that command completes, you can run npm install in the root directory to install the dependencies for the API.

Installing Dependencies

Make sure npm version is latest and then in the root folder, run npm install, there should already be a .npmrc file in that folder which points to the correct registry. Note:For the first time users npm install will ask user input to proceed , enter y or use silent install npm install --yes. This is required step as we have npx npm-force-resolutions as a preinstall script to force certain versions of nested dependencies to be installed for scan vulnerabilities.

Build and Test

Test To facilitate testing, it's recommended to use the Jest extenstion in VSCode. To run tests, run the command jest in the project root.

Build and Run

To build the project, run the command npm run build-tsoa in the root directory, in the VSCode Git Bash terminal. To clean and rebuild, run npm run clean and then npm run build.

To start just the backend server, use the command npm start. To start both the backend and the Development Interface simulataneously, you can run npm run full. This will run the front end interface proxied to the backend for testing.

The backend and UI run on localhost:3002 and localhost:3000, respectively.

Steps to Run Docker To run docker first obtain a token for access and encode it in base64, go to the page (https://geico.visualstudio.com/Omnichannel%20Platform/_artifacts/feed/DXPLLM/connect) , Select npm feed instructions Click on link 'instructions for using a Personal Access Token to authenticate' and follow steps Then run the following command to build the docker image

docker build . -f Dockerfile --build-arg NPM_TOKEN=<token> --build-arg USER_ID=<ADOUserId> -t geiconp.azurecr.io/dxpllm/dllqte/quote-svc:latest

example:

docker build . -f Dockerfile --build-arg NPM_TOKEN=yOur....bAse64== --build-arg USER_ID=userId --build-arg NPM_AUTH_FILE=.npmrc-dxpllm-pat -t geiconp.azurecr.io/dxpllm/dllqte/dxpllmquotesvc

Update your GEICO_HTTPSCERT_PATH env variable for self signed cert file path to point to docker container path GEICO_HTTPSCERT_PATH=/usr/local/share/ca-certificates/dxpllmqtelocal.geico.net.pfx.txt

Then run the following command which will create a new Docker container named quote-svc, loads environment variables , adds a custom host entry, and uses the specified image from the Container Registry. The container will run the latest version of the quote-svc image.

To run docker container over https on port 8443:

docker run --name quote-svc --env-file .env -p 8443:8443 geiconp.azurecr.io/dxpllm/dllqte/dxpllmquotesvc

You can access the service with a self signed certificate over https using a host url. map dxpllmqtelocal.geico.net in your windows host file to 127.0.0.1. the host file path in Windows is C:\Windows\System32\drivers\etc then you can access core llm service via https using the host dxpllmqtelocal.geico.net name '(https://dxpllmqtelocal.geico.net:8443/apidoc/swagger/)

To run on local container and browse the app

docker run --name quote-svc --env-file .env -p 3002:3002 geiconp.azurecr.io/dxpllm/dllqte/dxpllmquotesvc

To run the local redis

docker pull redis
docker run --name my-redis -p 6379:6379 -d redis