Skip to content

Commit

Permalink
feat(gen3-openai): rough initial testing, no automation for rolling
Browse files Browse the repository at this point in the history
  • Loading branch information
Avantol13 committed Jul 14, 2023
1 parent 2bed77c commit 9712414
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
1 change: 1 addition & 0 deletions files/squid_whitelist/web_whitelist
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ctds-planx.atlassian.net
data.cityofchicago.org
dataguids.org
api.login.yahoo.com
api.openai.com
api.snapcraft.io
apt.kubernetes.io
argoproj.github.io
Expand Down
46 changes: 46 additions & 0 deletions kube/services/gen3-openai/gen3-openai-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: gen3-openai-deployment
spec:
selector:
# Only select pods based on the 'app' label
matchLabels:
app: gen3-openai
release: production
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
app: gen3-openai
release: production
spec:
containers:
- name: gen3-openai
image: "quay.io/cdis/gen3-openai:latest"
imagePullPolicy: Always
ports:
- containerPort: 8080
env:
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: gen3-openai-g3auto
key: "openai_key"
- name: TOPICS
value: default,custom
- name: CUSTOM_SYSTEM_PROMPT
value: You answer questions about datasets that are available in BioData Catalyst. You'll be given relevant dataset descriptions for every dataset that's been ingested into BioData Catalyst. You are acting as a search assistant for a biomedical researcher (who will be asking you questions). The researcher is likely trying to find datasets of interest for a particular research question. You should recommend datasets that may be of interest to that researcher.
- name: CUSTOM_EMBEDDINGS_PATH
value: embeddings/embeddings.csv
imagePullPolicy: Always
resources:
requests:
cpu: 1
limits:
cpu: 2
memory: 512Mi
30 changes: 30 additions & 0 deletions kube/services/gen3-openai/gen3-openai-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
kind: Service
apiVersion: v1
metadata:
name: gen3-openai-service
annotations:
getambassador.io/config: |
---
apiVersion: ambassador/v1
ambassador_id: "gen3"
kind: Mapping
name: gen3-openai_mapping
prefix: /index/
service: http://gen3-openai-service:80
spec:
selector:
app: gen3-openai
release: production
ports:
- protocol: TCP
port: 80
targetPort: 80
name: http
nodePort: null
- protocol: TCP
port: 443
targetPort: 443
name: https
nodePort: null
type: ClusterIP

17 changes: 17 additions & 0 deletions kube/services/revproxy/gen3.nginx.conf/gen3-openai-service.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
location /openai/ {
if ($csrf_check !~ ^ok-\S.+$) {
return 403 "failed csrf check";
}
set $authz_resource "/mds_gateway";
set $authz_method "access";
set $authz_service "mds_gateway";
# be careful - sub-request runs in same context as this request
auth_request /gen3-authz;

set $proxy_service "gen3-openai-service";
set $upstream http://gen3-openai-service$des_domain;
rewrite ^/openai/(.*) /$1 break;
proxy_pass $upstream;
proxy_redirect http://$host/ https://$host/openai/;
client_max_body_size 0;
}

0 comments on commit 9712414

Please sign in to comment.