-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: sallyom <[email protected]>
- Loading branch information
Showing
6 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
## Simple chatbot | ||
|
||
This folder holds the resource definitions to launch a chatbot given a `MODEL_ENDPOINT` and `MODEL_ENDPOINT_BEARER`. | ||
|
||
Update the deployment as necessary and | ||
run this from the root of the repository | ||
|
||
|
||
```bash | ||
oc apply --kustomize ./chatbot | ||
``` | ||
|
||
TODO: | ||
- get `MODEL_ENDPOINT` from configmap or secret. Currently you need to update it in deployment.yaml | ||
|
||
### Chatbot | ||
|
||
The chatbot image is built from | ||
[ai-lab-recipes repository chatbot](https://github.com/containers/ai-lab-recipes/blob/main/recipes/natural_language_processing/chatbot/app/Containerfile) | ||
with the below system prompt line from | ||
[chatbot_ui.py](https://github.com/containers/ai-lab-recipes/blob/main/recipes/natural_language_processing/chatbot/app/chatbot_ui.py) | ||
commented out, since it's not compatible with vLLM: | ||
|
||
```bash | ||
prompt = ChatPromptTemplate.from_messages([ | ||
#("system", "You are world class technical advisor."), | ||
MessagesPlaceholder(variable_name="history"), | ||
("user", "{input}") | ||
]) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: chatbot | ||
labels: | ||
app: chatbot | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: chatbot | ||
template: | ||
metadata: | ||
labels: | ||
app: chatbot | ||
spec: | ||
serviceAccountName: chatbot-sa | ||
containers: | ||
- name: chatbot-inference | ||
image: quay.io/sallyom/chatbot:latest | ||
env: | ||
- name: MODEL_ENDPOINT | ||
# Update this value to the endpoint of a running model server | ||
value: https://candidatemodel-server-example/v1 | ||
- name: MODEL_ENDPOINT_BEARER | ||
valueFrom: | ||
secretKeyRef: | ||
name: judge-server | ||
key: api_key | ||
ports: | ||
- containerPort: 8501 | ||
securityContext: | ||
runAsNonRoot: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
resources: | ||
- deployment.yaml | ||
- service.yaml | ||
- route.yaml | ||
- sa.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: route.openshift.io/v1 | ||
kind: Route | ||
metadata: | ||
name: chatbot | ||
labels: | ||
app: chatbot | ||
spec: | ||
to: | ||
kind: Service | ||
name: chatbot-service | ||
port: | ||
targetPort: 8501 | ||
tls: | ||
termination: edge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: chatbot-sa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: chatbot-service | ||
labels: | ||
app: chatbot | ||
spec: | ||
selector: | ||
app: chatbot | ||
ports: | ||
- protocol: TCP | ||
port: 8501 | ||
targetPort: 8501 |