Настройки LLM для on-prem Helm-чарта #1

Merged
gnome627 merged 1 commits from codex/onprem-llm-values into main 2026-11-25 10:52:44 +00:00
9 changed files with 73 additions and 0 deletions
Showing only changes of commit 80877b01ec - Show all commits

No files matched your search

+7
View File
@@ -1,4 +1,5 @@
{{- if not .Values.secrets.existingSecret }} {{- if not .Values.secrets.existingSecret }}
{{- $llm := .Values.app.ai.llm | default dict }}
--- ---
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
@@ -20,6 +21,12 @@ stringData:
livekit-api-secret: {{ .Values.app.livekit.apiSecret | quote }} livekit-api-secret: {{ .Values.app.livekit.apiSecret | quote }}
yandex-client-password: {{ .Values.app.yandex.clientPassword | quote }} yandex-client-password: {{ .Values.app.yandex.clientPassword | quote }}
yandex-ai-api-key: {{ .Values.app.ai.yandex.apiKey | quote }} yandex-ai-api-key: {{ .Values.app.ai.yandex.apiKey | quote }}
{{- with $llm.apiKey }}
llm-api-key: {{ . | quote }}
{{- end }}
{{- with $llm.embeddingApiKey }}
llm-embedding-api-key: {{ . | quote }}
{{- end }}
google-client-secret: {{ .Values.app.integrations.google.clientSecret | quote }} google-client-secret: {{ .Values.app.integrations.google.clientSecret | quote }}
slack-client-secret: {{ .Values.app.slack.clientSecret | quote }} slack-client-secret: {{ .Values.app.slack.clientSecret | quote }}
slack-verification-token: {{ .Values.app.slack.verificationToken | quote }} slack-verification-token: {{ .Values.app.slack.verificationToken | quote }}
+1
View File
@@ -40,6 +40,7 @@ spec:
containerPort: 9000 containerPort: 9000
env: env:
{{- include "envs_all" . | indent 12 }} {{- include "envs_all" . | indent 12 }}
{{- include "envs_llm" . | indent 12 }}
{{- include "envs_nanabush_player_signing" . | indent 12 }} {{- include "envs_nanabush_player_signing" . | indent 12 }}
- name: VIDEO_CONVERTER_ENABLED - name: VIDEO_CONVERTER_ENABLED
value: {{ .Values.app.videoConverter.enabled | quote }} value: {{ .Values.app.videoConverter.enabled | quote }}
+1
View File
@@ -32,6 +32,7 @@ spec:
command: ["hrbox-worker"] command: ["hrbox-worker"]
env: env:
{{- include "envs_all" . | indent 12 }} {{- include "envs_all" . | indent 12 }}
{{- include "envs_llm" . | indent 12 }}
- name: VIDEO_CONVERTER_ENABLED - name: VIDEO_CONVERTER_ENABLED
value: {{ .Values.app.videoConverter.enabled | quote }} value: {{ .Values.app.videoConverter.enabled | quote }}
{{- include "hrbox.resources" (dict "ctx" . "component" "worker") | indent 10 }} {{- include "hrbox.resources" (dict "ctx" . "component" "worker") | indent 10 }}
+1
View File
@@ -40,6 +40,7 @@ spec:
command: ["php", "yii", "migrate", "--interactive=0"] command: ["php", "yii", "migrate", "--interactive=0"]
env: env:
{{- include "envs_all" . | indent 12 }} {{- include "envs_all" . | indent 12 }}
{{- include "envs_llm" . | indent 12 }}
{{- include "hrbox.resources" (dict "ctx" . "component" "jobs") | indent 10 }} {{- include "hrbox.resources" (dict "ctx" . "component" "jobs") | indent 10 }}
volumes: volumes:
- name: configs - name: configs
@@ -27,4 +27,5 @@ spec:
command: ["php", "yii", "util/update-cluster"] command: ["php", "yii", "util/update-cluster"]
env: env:
{{- include "envs_all" . | indent 12 }} {{- include "envs_all" . | indent 12 }}
{{- include "envs_llm" . | indent 12 }}
{{- include "hrbox.resources" (dict "ctx" . "component" "jobs") | indent 10 }} {{- include "hrbox.resources" (dict "ctx" . "component" "jobs") | indent 10 }}
+27
View File
@@ -314,3 +314,30 @@
- name: OTEL_LOG_LEVEL - name: OTEL_LOG_LEVEL
value: "info" value: "info"
{{- end }} {{- end }}
{{- define "envs_llm" }}
{{- $llm := .Values.app.ai.llm | default dict }}
{{- $externalSecret := not (empty .Values.secrets.existingSecret) }}
{{- with $llm.baseUri }}
- name: LLM_BASE_URI
value: {{ . | quote }}
{{- end }}
{{- with $llm.chatModel }}
- name: LLM_CHAT_MODEL
value: {{ . | quote }}
{{- end }}
{{- with $llm.embeddingBaseUri }}
- name: LLM_EMBEDDING_BASE_URI
value: {{ . | quote }}
{{- end }}
{{- with $llm.embeddingModel }}
- name: LLM_EMBEDDING_MODEL
value: {{ . | quote }}
{{- end }}
{{- if or $llm.apiKey (and $externalSecret $llm.baseUri) }}
{{- include "hrbox.secretEnv" (dict "ctx" . "env" "LLM_API_KEY" "key" "llm-api-key" "optional" $externalSecret) | nindent 0 }}
{{- end }}
{{- if or $llm.embeddingApiKey (and $externalSecret $llm.embeddingBaseUri) }}
{{- include "hrbox.secretEnv" (dict "ctx" . "env" "LLM_EMBEDDING_API_KEY" "key" "llm-embedding-api-key" "optional" $externalSecret) | nindent 0 }}
{{- end }}
{{- end }}
+3
View File
@@ -74,6 +74,9 @@ imagePullSecrets:
secretKeyRef: secretKeyRef:
name: {{ include "hrbox.secretName" .ctx | quote }} name: {{ include "hrbox.secretName" .ctx | quote }}
key: {{ .key | quote }} key: {{ .key | quote }}
{{- if .optional }}
optional: true
{{- end }}
{{- end -}} {{- end -}}
{{- define "nanabushPlayer.host" -}} {{- define "nanabushPlayer.host" -}}
+9
View File
@@ -446,6 +446,15 @@ app:
docsIndexEnabled: "true" docsIndexEnabled: "true"
semanticIndexEnabled: "true" semanticIndexEnabled: "true"
semanticIndexUseBatch: "true" semanticIndexUseBatch: "true"
llm:
# URL и ключ OpenAI-совместимого API для чата.
baseUri: ""
apiKey: ""
chatModel: ""
# URL и ключ OpenAI-совместимого API для эмбеддингов.
embeddingBaseUri: ""
embeddingApiKey: ""
embeddingModel: ""
yandex: yandex:
folderId: "" folderId: ""
apiKey: "" apiKey: ""
+23
View File
@@ -171,6 +171,8 @@ kubectl -n hrbox exec -it deploy/hrbox-worker -- \
| `livekit-api-secret` | `app.livekit.apiSecret` | | `livekit-api-secret` | `app.livekit.apiSecret` |
| `yandex-client-password` | `app.yandex.clientPassword` | | `yandex-client-password` | `app.yandex.clientPassword` |
| `yandex-ai-api-key` | `app.ai.yandex.apiKey` | | `yandex-ai-api-key` | `app.ai.yandex.apiKey` |
| `llm-api-key` | `app.ai.llm.apiKey` (если API требует ключ для чата) |
| `llm-embedding-api-key` | `app.ai.llm.embeddingApiKey` (если API требует ключ для эмбеддингов) |
| `google-client-secret` | `app.integrations.google.clientSecret` | | `google-client-secret` | `app.integrations.google.clientSecret` |
| `slack-client-secret` | `app.slack.clientSecret` | | `slack-client-secret` | `app.slack.clientSecret` |
| `slack-verification-token` | `app.slack.verificationToken` | | `slack-verification-token` | `app.slack.verificationToken` |
@@ -283,6 +285,27 @@ app:
effect: NoSchedule effect: NoSchedule
``` ```
### OpenAI-совместимый API
Для чата и эмбеддингов можно указать свой API в `app.ai.llm`:
```yaml
app:
ai:
llm:
baseUri: "https://example-endpoint.cc/v1/"
apiKey: ""
chatModel: "model/large"
embeddingBaseUri: "https://example-endpoint.cc/v1/"
embeddingApiKey: ""
embeddingModel: "model/embedding"
```
Если URL пуст, HRBox обращается к HRBox Hub. Если имя модели пустое, HRBox
использует модель по умолчанию. Для API с авторизацией укажите ключ в
`apiKey` / `embeddingApiKey` или добавьте его в Secret, указанный в
`secrets.existingSecret`.
### Трассировка ### Трассировка
```yaml ```yaml