Support single OpenAI API endpoint, multiple endpoints, with or without Pipelines

This commit is contained in:
0xThresh.eth 2025-02-14 11:43:06 -07:00
parent 0e28ac5b4e
commit c6d111535c
3 changed files with 16 additions and 10 deletions

View File

@ -70,7 +70,8 @@ helm upgrade --install open-webui open-webui/open-webui
| ollama.fullnameOverride | string | `"open-webui-ollama"` | If enabling embedded Ollama, update fullnameOverride to your desired Ollama name value, or else it will use the default ollama.name value from the Ollama chart |
| ollamaUrls | list | `[]` | A list of Ollama API endpoints. These can be added in lieu of automatically installing the Ollama Helm chart, or in addition to it. |
| ollamaUrlsFromExtraEnv | bool | `false` | Disables taking Ollama Urls from `ollamaUrls` list |
| openaiBaseApiUrl | string | `""` | OpenAI base API URL to use. Defaults to the Pipelines service endpoint when Pipelines are enabled, and "https://api.openai.com/v1" if Pipelines are not enabled and this value is blank |
| openaiBaseApiUrl | string | `"https://api.openai.com/v1"` | OpenAI base API URL to use. Defaults to the Pipelines service endpoint when Pipelines are enabled, and "https://api.openai.com/v1" if Pipelines are not enabled and this value is blank |
| openaiBaseApiUrls | list | `[]` | OpenAI base API URLs to use. Overwrites the value in openaiBaseApiUrl if set |
| persistence.accessModes | list | `["ReadWriteOnce"]` | If using multiple replicas, you must update accessModes to ReadWriteMany |
| persistence.annotations | object | `{}` | |
| persistence.enabled | bool | `true` | |

View File

@ -121,22 +121,22 @@ spec:
- name: "ENABLE_OLLAMA_API"
value: "False"
{{- end }}
{{- if .Values.openaiBaseApiUrl }}
{{- if and .Values.openaiBaseApiUrl (not .Values.openaiBaseApiUrls) (not .Values.pipelines.enabled) }}
# If only an OpenAI API value is set, set it to OPENAI_API_BASE_URL
- name: "OPENAI_API_BASE_URL"
value: {{ .Values.openaiBaseApiUrl | quote }}
{{- else if and (not .Values.openaiBaseApiUrls) .Values.pipelines.enabled }}
# If Pipelines is enabled and no OpenAI API value is set, set OPENAI_API_BASE_URL to the Pipelines server endpoint
{{- else if and .Values.openaiBaseApiUrl .Values.pipelines.enabled (not .Values.openaiBaseApiUrls) }}
# If Pipelines is enabled and OpenAI API value is set, use OPENAI_API_BASE_URLS with combined values
- name: "OPENAI_API_BASE_URLS"
value: "{{ include "pipelines.serviceEndpoint" . }};{{ .Values.openaiBaseApiUrl }}"
{{- else if and .Values.pipelines.enabled (not .Values.openaiBaseApiUrl) (not .Values.openaiBaseApiUrls) }}
# If Pipelines is enabled and no OpenAI API values are set, set OPENAI_API_BASE_URL to the Pipelines server endpoint
- name: "OPENAI_API_BASE_URL"
value: {{ include "pipelines.serviceEndpoint" . | quote }}
{{- else if and .Values.openaiBaseApiUrls .Values.pipelines.enabled }}
# If OpenAI API value(s) set and Pipelines is enabled, use OPENAI_API_BASE_URLS to support all the endpoints in the chart
- name: "OPENAI_API_BASE_URLS"
value: {{ toJson .Values.openaiBaseApiUrls | quote }}
{{- else if and (not .Values.pipelines.enabled) (kindIs "slice" .Values.openaiBaseApiUrls) (gt (len .Values.openaiBaseApiUrls) 1) }}
# If Pipelines is disabled and multiple OpenAI API URLs are set, use OPENAI_API_BASE_URLS
- name: "OPENAI_API_BASE_URLS"
value: {{ toJson .Values.openaiBaseApiUrls | quote }}
value: "{{ include "pipelines.serviceEndpoint" . }};{{ join ";" .Values.openaiBaseApiUrls }}"
{{- end }}
{{- if .Values.extraEnvVars }}
{{- toYaml .Values.extraEnvVars | nindent 8 }}

View File

@ -225,7 +225,12 @@ service:
loadBalancerClass: ""
# -- OpenAI base API URL to use. Defaults to the Pipelines service endpoint when Pipelines are enabled, and "https://api.openai.com/v1" if Pipelines are not enabled and this value is blank
openaiBaseApiUrl: ""
openaiBaseApiUrl: "https://api.openai.com/v1"
# -- OpenAI base API URLs to use. Overwrites the value in openaiBaseApiUrl if set
openaiBaseApiUrls: []
# - "https://api.openai.com/v1"
# - "https://api.company.openai.com/v1"
# -- Env vars added to the Open WebUI deployment. Most up-to-date environment variables can be found here: https://docs.openwebui.com/getting-started/env-configuration/
extraEnvVars: