Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tmp #109

Closed
wants to merge 34 commits into from
Closed

Tmp #109

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
65811c1
move to quarkus
jamesfalkner May 31, 2024
9c111de
update readme
jamesfalkner May 31, 2024
6c36bc8
update port/host defaults
jamesfalkner May 31, 2024
634a9a6
Update README.md
jameslabocki Jun 3, 2024
61fe2a8
Update README.md
jameslabocki Jun 3, 2024
1717502
Merge pull request #1 from jameslabocki/patch-1
jamesfalkner Jun 3, 2024
2be8983
Dont give JSON back in responses
jamesfalkner Jun 3, 2024
d0fcd89
Update webpack.dev.js - allowedHosts
jamesfalkner Jun 3, 2024
3c80d34
Use quinoa
edeandrea Jun 5, 2024
e4fe4af
Merge pull request #2 from edeandrea/use-quinoa
jamesfalkner Jun 5, 2024
1636ac8
Enable SPA routing in Quarkus Quinoa
edeandrea Jun 6, 2024
5817691
Merge pull request #3 from edeandrea/fix-spa-quinoa-routing
jamesfalkner Jun 6, 2024
932166c
Update README.md
jameslabocki Jun 6, 2024
1f20dc5
Update application.properties
jameslabocki Jun 6, 2024
1cc58a7
Merge pull request #4 from jameslabocki/patch-2
jamesfalkner Jun 6, 2024
83bd303
Merge pull request #5 from jameslabocki/patch-3
jamesfalkner Jun 6, 2024
c515177
Update config.tsx to not require hard-code hostname
jamesfalkner Jun 6, 2024
d14387f
gotta get back in time
jamesfalkner Jun 6, 2024
2284b8e
dont need roads
jamesfalkner Jun 6, 2024
d8e1304
Some cleanup and adding some tests
edeandrea Jun 6, 2024
ce4c1f3
Some cleanup and adding some tests
edeandrea Jun 6, 2024
0daf19f
Wait for something on the websocket to come back to the chat
edeandrea Jun 6, 2024
ed11b51
Wait for something on the websocket to come back to the chat
edeandrea Jun 6, 2024
10fd0ef
Wait for something on the websocket to come back to the chat
edeandrea Jun 6, 2024
3b6bdb8
auto-install npm
edeandrea Jun 7, 2024
713f4c3
Merge pull request #6 from edeandrea/add-tests
jamesfalkner Jun 7, 2024
79eb8da
Fix quinoa ci
edeandrea Jun 7, 2024
1c7f192
Increase playwright timeout
edeandrea Jun 7, 2024
52a4ac1
Increase playwright timeout
edeandrea Jun 7, 2024
3e8709a
Merge pull request #7 from edeandrea/fix-quinoa-ci
jamesfalkner Jun 13, 2024
3cafcc8
Update README with new info
edeandrea Jun 13, 2024
d81e37a
Merge pull request #8 from edeandrea/patch-1
jamesfalkner Jun 13, 2024
388ff4e
add spellings
jamesfalkner Jun 13, 2024
cd45bbd
minor update
jamesfalkner Jun 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 16 additions & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
adoc
adoptium
Adoptium
Apache
apache
aiservices
amazonaws
Anbalagan
Expand Down Expand Up @@ -26,6 +30,7 @@ CarImage
cd
centric
cephfs
cgi
Chase
ChatGPT
ChatOps
Expand Down Expand Up @@ -72,6 +77,8 @@ Erwan
eslint
Eventing
EXAMPLEs
executables
executable
FastAPI
ffdrf
fi
Expand All @@ -91,6 +98,7 @@ gitops
GitOps
Globex
GPUs
GraalVM
Grafana
Granafa
Granger
Expand All @@ -114,6 +122,8 @@ Immage
InfluxDB
Inlining
insecureEdgeTerminationPolicy
InstructLab
instructlab
io
ipynb
jpg
Expand Down Expand Up @@ -160,6 +170,8 @@ ods
ojsonpath
ok
onnx
openai
OpenAI
opencv
OpenCV
openshift
Expand Down Expand Up @@ -194,6 +206,8 @@ py
pytorch
Pytorch
quantized
Quarkus
quarkus
rbac
README
readonly
Expand All @@ -214,6 +228,7 @@ roboflow
Roboflow
RoboFlow
rollout
runnable
runtime
RWX
selfHeal
Expand Down Expand Up @@ -243,6 +258,7 @@ TODO
txt
TypeScript
UAT
über
UI
un
unopinionated
Expand Down
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: maven
directory: app
schedule:
interval: daily
target-branch: dev

- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
target-branch: dev
55 changes: 55 additions & 0 deletions .github/workflows/simple-build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Simple build and test

on:
push:
branches:
- dev
paths-ignore:
- '**/*.md'
- '.github/dependabot.yml'
- '.github/workflows/dependabot-automerge.yml'
pull_request:
branches:
- dev
paths-ignore:
- '**/*.md'
- '.github/dependabot.yml'
- '.github/workflows/dependabot-automerge.yml'
workflow_dispatch:

concurrency:
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}"
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
jvm-build-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java:
- '17'
- '21'
services:
ollama:
image: ollama/ollama
ports:
- 11434:11434
name: "jvm-build-test-${{ matrix.java }}"
steps:
- uses: actions/checkout@v4

- name: Setup Java ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: temurin
cache: maven

- name: "build-test-jvm-java${{ matrix.java }}"
working-directory: app
run: |
./mvnw -B clean verify \
-Dquarkus.langchain4j.chat-model.provider=ollama \
-Dquarkus.http.host=0.0.0.0 \
-Dmaven.compiler.release=${{ matrix.java }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.quinoa
# editor
.idea/
.vscode/
Expand Down Expand Up @@ -50,3 +51,4 @@ package-lock.json
lab-materials/04/datasets/*
lab-materials/04/runs/*

**/target/**
125 changes: 20 additions & 105 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,122 +1,37 @@
# OpenShift AI Unleashed: Transforming Claims Processing for Maximum Efficiency!
# Parasol Insurance

## Introduction
A [Quarkus](https://quarkus.io) + [React](https://react.dev/) AI app for managing fictitious insurance claims. Uses [Quarkus Quinoa](https://docs.quarkiverse.io/quarkus-quinoa/dev/index.html) under the covers.

This repository contains the code, instructions, resources and materials associated with the Lab called **OpenShift AI Unleashed: Transforming Claims Processing for Maximum Efficiency!**.
![App](app/frontend/src/app/assets/images/sample.png)

To consult the static version of the instructions, please use [this URL](https://rh-aiservices-bu.github.io/parasol-insurance/)
## Pre-requisites

If you want to participate in the creation and update of this content, please consult the sections below.
- Java 17 or later -- Get it https://adoptium.net/ or install using your favorite package manager.
- Maven 3.9.6 or later -- Get it https://maven.apache.org/download.cgi or install using your favorite package manager.
- Or just use the embedded [Maven Wrapper](https://maven.apache.org/wrapper)
- An OpenAI-capable LLM inference server. Get one here with [InstructLab](https://github.com/instructlab/instructlab)!

<details>
<summary>Display Development-centric information</summary>
## To Configure on InstructLab instance of Red Hat Demo Platform

## General Development Information

### Working with this repo
You can execute [this](https://gist.githubusercontent.com/jameslabocki/748e191006d0e311dec21c72e95570d1/raw/3c40273c962c3ee598a13dd853b831ac9df884ff/gistfile1.txt) to install the parasol app on the InstructLab instance for Red Hat Demo Platform.

- `main` branch is the one used for production. That's where the Prod and Test catalog items from [demo.redhat.com](https://demo.redhat.com) point to (instructions, materials used,...).
- `dev` branch is for development. That's where the Dev catalog item points to.
- Branches are made from `dev` (hot fixes could be made from `main` if really needed).
- When ready, PRs should be made to `dev`. Once all features, bug fixes,... are checked in and tested for a new release, another PR will be made from `dev` to `main`.
- Branches must be prefixed with `/feature` (example `feature/new-pipeline-instructions`), `bugfix`, or other meaningful info.
- Add your name/handle in the branch name if needed to avoid confusion.
- If your development relates to an Issue or a Feature Request, add its reference in the branch name.
- Try to stash your changes before submitting a PR.

## How to update the **Instructions**

Useful link: [https://redhat-scholars.github.io/build-course/rhs-build-course/develop.html](https://redhat-scholars.github.io/build-course/rhs-build-course/develop.html)
## Configuration

### Requirements
You can change the coordinates (host/port and other stuff) for the LLM and backend in `app/backend/src/main/resources/application.properties`.

- Podman or Docker
## Running

### Development

- Add/Modify/Delete content in [content/modules/ROOT](content/modules/ROOT).
- Navigation is handled in `nav.adoc`.
- Content pages are in the `pages` folder.
- To build the site, from the root of the repo, run `./content/utilities/lab-build`.
- To serve the site for previewing, from the root of the repo, run `./content/utilities/lab-serve`.
- The site will be visible at [http://localhost:8443/](http://localhost:8443/)
- When finished, you can stop serving the site by running from the root of the repo `./content/utilities/lab-stop`.

## How to update the **Application**

### Requirements

- Python 3.11
- Nodejs > 18
- An existing instance of Hugging Face TGI with a loaded model available at `INFERENCE_SERVER_URL`. This application is based on Mistral-TB Prompt format. You will need to modify this format if you are using a different model.

### Installation

Run `npm install` from the main folder.

If you want to install packages manually:

- In the `frontend` folder, install the node modules with `npm install`.
- In the `backend` folder, create a venv and install packages with the provided Pipfile/Pipfile.lock files.
- In the `backend` folder, create the file `.env` base on the example `.env.example` and enter the configuration for the Inference server.

### Development

From the main folder, launch `npm run dev` or `./start-dev.sh`. This will launch both backend and frontend.

- Frontend is accessible at `http://localhost:9000`
- Backend is accessible at `http://localhost:5000`, with Swagger API doc at `http://localhost:5000/docs`

```bash
#!/bin/bash

# Script to restart all showroom pods - You must be logged in as a cluster admin to run this script

# Get all namespaces
namespaces=$(oc get namespaces -o jsonpath='{.items[*].metadata.name}' \
| tr ' ' '\n' \
| grep '^showroom')

# Stop all the pods
for namespace in $namespaces; do
# Check if the deployment "showroom" exists in the namespace
if oc -n $namespace get deployment showroom &> /dev/null; then
# If it exists, restart the rollout
# oc -n $namespace rollout restart deployment/showroom
oc -n $namespace scale deploy showroom --replicas=0
fi
done


# wait for them all to fully stop
# start all the pods
for namespace in $namespaces; do
# Check if the deployment "showroom" exists in the namespace
if oc -n $namespace get deployment showroom &> /dev/null; then
# If it exists, restart the rollout
# oc -n $namespace rollout restart deployment/showroom
oc -n $namespace scale deploy showroom --replicas=1
fi
done
First, get your inference server up and running. For example, with [InstructLab](https://github.com/instructlab/instructlab), the default after running `ilab serve` is that the server is listening on `localhost:8000`. This is the default for this app as well.

Then:

```
cd app;
./mvnw clean quarkus:dev
```
App will open on `http://0.0.0.0:8005`.

## How to graduate code from dev to main

- From `dev`, create a new branch, like `feature/prepare-for-main-merge`.
- Modify the following files to make their relevant content point to `main`:
- `bootstrap/applicationset/applicationset-bootstrap.yaml`
- `content/antora.yml`
- `content/modules/ROOT/pages/05-03-web-app-deploy-application.adoc`
- Make a pull request from this branch to `main`, review and merge

</details>

<details>
<summary>Links for Summit event environment assignment</summary>

- URL for all labs: [https://one.demo.redhat.com/](https://one.demo.redhat.com/)
- Search for `parasol`

</details>
Open the app, click on a claim, click on the chat app, and start asking questions. The context of the claim is sent to the LLM along with your Query, and the response is shown in the chat (it may take time depending on your machine's performance).
4 changes: 4 additions & 0 deletions app/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
!target/*-runner
!target/*-runner.jar
!target/lib/*
!target/quarkus-app/*
44 changes: 44 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties
.flattened-pom.xml

# Eclipse
.project
.classpath
.settings/
bin/

# IntelliJ
.idea
*.ipr
*.iml
*.iws

# NetBeans
nb-configuration.xml

# Visual Studio Code
.vscode
.factorypath

# OSX
.DS_Store

# Vim
*.swp
*.swo

# patch
*.orig
*.rej

# Local environment
.env

# Plugin directory
/.quarkus/cli/plugins/
node_modules/
19 changes: 19 additions & 0 deletions app/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
21 changes: 0 additions & 21 deletions app/Containerfile

This file was deleted.

Loading
Loading