-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gen3-openai): rough initial testing, no automation for rolling
- Loading branch information
Showing
4 changed files
with
94 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
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,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 |
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 @@ | ||
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
17
kube/services/revproxy/gen3.nginx.conf/gen3-openai-service.conf
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,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; | ||
} |