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

Add BrainForge LLM Service Deployment option #85

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions neon_diana_utils/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,27 @@ def make_keys_config(write_config: bool,
config_confirmed = \
click.confirm("Is this configuration correct?")

brainforge_config = {"clients": {}}
if click.confirm("Configure BrainForge LLMs?"):
hosts_complete = False
while not hosts_complete:
name = click.prompt("vLLM Endpoint Name", type=str)
url = click.prompt("vLLM URL", type=str)
key = click.prompt("vLLM API key", type=str)
client_config = {name: {"api_url": url, "api_key": key}}
click.echo(pformat(client_config))
if click.confirm("Is this configuration correct?"):
brainforge_config["clients"][name] = client_config[name]
if not click.confirm("Add another client?"):
hosts_complete = True
confirmed = False
while not confirmed:
hf_token = click.prompt("HuggingFace Token", type=str)
brainforge_config['hf_token'] = hf_token
click.echo(brainforge_config)
if click.confirm("Is this configuration correct?"):
confirmed = True

chatgpt_config = dict()
if click.confirm("Configure ChatGPT LLM?"):
config_confirmed = False
Expand Down Expand Up @@ -371,7 +392,8 @@ def make_keys_config(write_config: bool,
"aggregators": {
"sentry": sentry_sdk_config,
}
}
},
"brainforge_llm_service": brainforge_config
}
if write_config:
click.echo(f"Writing configuration to {output_file}")
Expand Down Expand Up @@ -649,6 +671,7 @@ def _get_unconfigured_mq_backend_services(config: dict) -> Set[str]:
config_to_service = {'api_services': 'neon-api-proxy',
'keys.emails': 'neon-email-proxy',
'keys.track_my_brands': 'neon-brands-service',
'brainforge_llm_service': 'brainforge-llm-service',
'LLM_CHAT_GPT': 'neon-llm-chatgpt',
'LLM_VLLM': 'neon-llm-vllm',
'LLM_FASTCHAT': 'neon-llm-fastchat',
Expand Down Expand Up @@ -747,7 +770,8 @@ def configure_backend(username: str = None,
else:
# Define a default value so secret can be generated
encoded_token = get_github_encoded_auth("", "")
to_disable = ['neon-brands-service', 'neon-script-parser']
to_disable = ['neon-brands-service', 'neon-script-parser',
'brainforge-llm-service']
disabled_mq_services += to_disable
confirmed = False
email = ''
Expand Down Expand Up @@ -805,6 +829,8 @@ def configure_backend(username: str = None,
diana_config = join(output_path, "xdg", "config", "neon", "diana.yaml")
else:
raise RuntimeError(f"{orchestrator} is not yet supported")

# Generate configuration for required core services
try:
# Generate RabbitMQ config
username = username or click.prompt("RabbitMQ Admin Username", type=str)
Expand Down
4 changes: 2 additions & 2 deletions neon_diana_utils/helm_charts/backend/diana-backend/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.30
version: 0.1.31

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand All @@ -35,5 +35,5 @@ dependencies:
version: 0.0.15
repository: file://../http-services
- name: diana-mq
version: 0.0.19
version: 0.0.20
repository: file://../mq-services
6 changes: 5 additions & 1 deletion neon_diana_utils/helm_charts/backend/mq-services/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: diana-mq
description: Deploy DIANA MQ Services

type: application
version: 0.0.19
version: 0.0.20
appVersion: "1.0.1a31"
dependencies:
- name: neon-api-proxy
Expand All @@ -30,6 +30,10 @@ dependencies:
alias: neon-users-service
version: 0.0.1
repository: file://../../mq/neon-users-service
- name: brainforge-llm-service
alias: brainforge-llm-service
version: 0.0.1
repository: file://../../mq/brainforge-llm-service
- name: neon-llm-chatgpt
alias: neon-llm-chatgpt
version: 0.0.7
Expand Down
3 changes: 3 additions & 0 deletions neon_diana_utils/helm_charts/backend/mq-services/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ neon-script-parser:
neon-users-service:
image:
tag: *tag
brainforge-llm-service:
image:
tag: *tag
neon-llm-chatgpt:
image:
tag: *tag
Expand Down
23 changes: 23 additions & 0 deletions neon_diana_utils/helm_charts/mq/brainforge-llm-service/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
12 changes: 12 additions & 0 deletions neon_diana_utils/helm_charts/mq/brainforge-llm-service/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v2
name: brainforge-llm-service
description: Deploy a Brainforge LLM Backend Service

type: application
version: 0.0.1
appVersion: "1.0.1a29"

dependencies:
- name: base-mq
version: 0.0.10
repository: file://../../base/base-mq
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "brainforge-llm-service.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "brainforge-llm-service.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "brainforge-llm-service.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "brainforge-llm-service.labels" -}}
helm.sh/chart: {{ include "brainforge-llm-service.chart" . }}
{{ include "brainforge-llm-service.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "brainforge-llm-service.selectorLabels" -}}
app.kubernetes.io/name: {{ include "brainforge-llm-service.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "brainforge-llm-service.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "brainforge-llm-service.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{- include "base-mq.deployment" .}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{- include "base-mq.service" .}}
12 changes: 12 additions & 0 deletions neon_diana_utils/helm_charts/mq/brainforge-llm-service/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
serviceName: backend-mq-brainforge-llm
replicaCount: 1
configSecret: diana-config
image:
pullSecret: github-auth
repository: ghcr.io/neongeckocom/brainforge-llm-service
pullPolicy: Always
tag: dev
resources:
requests:
memory: "500Mi"
cpu: "1.0"
2 changes: 1 addition & 1 deletion neon_diana_utils/templates/backend/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ appVersion: "1.0.1a5"

dependencies:
- name: backend
version: 0.1.30
version: 0.1.31
repository: https://neongeckocom.github.io/neon-diana-utils
2 changes: 2 additions & 0 deletions neon_diana_utils/templates/backend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ backend:
image: {}
neon-users-service:
image: {}
brainforge-llm-service:
image: {}
letsencrypt:
server: https://acme-v02.api.letsencrypt.org/directory
2 changes: 2 additions & 0 deletions neon_diana_utils/templates/mq_user_mapping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ neon_core:
- chat_api_proxy
chat_observer:
- chat_observer
brainforge_llm_service:
- brainforge_llm_service
neon_llm_submind:
- neon_llm_submind
neon_bot_submind:
Expand Down
16 changes: 16 additions & 0 deletions neon_diana_utils/templates/rmq_backend_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ users:
password:
tags:
- chatbots
- name: "brainforge_llm_service"
password:
tags:
- backend
- llm
vhosts:
- name: "/neon_emails"
- name: "/neon_api"
Expand All @@ -105,6 +110,7 @@ vhosts:
- name: "/neon_chat_api"
- name: "/chatbots"
- name: "/neon_users"
- name: "/brainforge"
permissions:
- user: "neon_core"
vhost: "/neon_chat_api"
Expand Down Expand Up @@ -258,3 +264,13 @@ permissions:
configure: ".*"
write: ".*"
read: ".*"
- user: "neon_api_utils"
vhost: "/brainforge"
configure: "./*"
write: "./*"
read: "./*"
- user: "brainforge_llm_service"
vhost: "/brainforge"
configure: "./*"
write: "./*"
read: "./*"
Loading