Skip to content

Commit

Permalink
Add support for multi2vec-palm module
Browse files Browse the repository at this point in the history
  • Loading branch information
antas-marcin committed Mar 14, 2024
1 parent 853a9c2 commit 401538d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .cicd/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ function check_creates_template() {
check_modules "--set modules.text2vec-voyageai.enabled=true" "value: text2vec-voyageai"
check_modules "--set modules.generative-mistral.enabled=true" "value: generative-mistral"
check_modules "--set modules.generative-mistral.enabled=true --set modules.generative-mistral.apiKey=apiKey" "value: generative-mistral"
check_modules "--set modules.multi2vec-palm.enabled=true" "value: multi2vec-palm"
check_modules "--set modules.multi2vec-palm.enabled=true --set modules.multi2vec-palm.apiKey=apiKey --set modules.generative-palm.enabled=true --set modules.generative-palm.apiKey=apiKey" "value: generative-palm,multi2vec-palm"

check_modules "--set modules.text2vec-openai.enabled=true --set modules.text2vec-openai.azureApiKey=azureApiKey" "value: text2vec-openai"
check_modules "--set modules.qna-openai.enabled=true --set modules.qna-openai.azureApiKey=azureApiKey" "value: qna-openai"
Expand All @@ -173,6 +175,7 @@ function check_creates_template() {
check_string_existence "--set modules.generative-anyscale.enabled=true --set modules.generative-anyscale.apiKey=apiKey" "name: ANYSCALE_APIKEY"
check_string_existence "--set modules.text2vec-voyageai.enabled=true --set modules.text2vec-voyageai.apiKey=voyageaiApiKey" "name: VOYAGEAI_APIKEY"
check_string_existence "--set modules.generative-mistral.enabled=true --set modules.generative-mistral.apiKey=apiKey" "name: MISTRAL_APIKEY"
check_string_existence "--set modules.multi2vec-palm.enabled=true --set modules.multi2vec-palm.apiKey=palmApiKey" "name: PALM_APIKEY"

_settingPassageQueryOn="--set modules.text2vec-contextionary.enabled=false --set modules.text2vec-transformers.passageQueryServices.passage.enabled=true --set modules.text2vec-transformers.passageQueryServices.query.enabled=true"
check_setting_has_value "$_settingPassageQueryOn" "name: TRANSFORMERS_PASSAGE_INFERENCE_API" "value: http://transformers-inference-passage.default.svc.cluster.local.:8080"
Expand Down
3 changes: 3 additions & 0 deletions weaviate/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
{{- if or (index .Values "modules" "multi2vec-bind" "enabled") (index .Values "modules" "multi2vec-bind" "inferenceUrl") -}}
{{ $modules = append $modules "multi2vec-bind" }}
{{- end -}}
{{- if (index .Values "modules" "multi2vec-palm" "enabled") -}}
{{ $modules = append $modules "multi2vec-palm" }}
{{- end -}}
{{- if (index .Values "modules" "text2vec-openai" "enabled") -}}
{{ $modules = append $modules "text2vec-openai" }}
{{- end -}}
Expand Down
8 changes: 7 additions & 1 deletion weaviate/templates/apiKeyPaLMSecret.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{- $t2vPaLM := and (index .Values "modules" "text2vec-palm" "enabled") (index .Values "modules" "text2vec-palm" "apiKey") -}}
{{- $generativePaLM := and (index .Values "modules" "generative-palm" "enabled") (index .Values "modules" "generative-palm" "apiKey") }}
{{- $palm := or ($t2vPaLM) ($generativePaLM) }}
{{- $m2vPaLM := and (index .Values "modules" "multi2vec-palm" "enabled") (index .Values "modules" "multi2vec-palm" "apiKey") -}}
{{- $palm := or ($t2vPaLM) ($generativePaLM) ($m2vPaLM) }}
{{- if $palm }}

{{- $apiKeys := list }}
Expand All @@ -10,6 +11,9 @@
{{- if $generativePaLM }}
{{- $apiKeys = append $apiKeys (index .Values "modules" "generative-palm" "apiKey") -}}
{{- end }}
{{- if $m2vPaLM }}
{{- $apiKeys = append $apiKeys (index .Values "modules" "multi2vec-palm" "apiKey") -}}
{{- end }}

{{- if gt (len ($apiKeys | uniq)) 1 -}}
{{- fail "Google PaLM modules activated, but their keys differ. Use the same key on all activated Google PaLM modules." }}
Expand All @@ -26,6 +30,8 @@ type: Opaque
data:
{{- if (index .Values "modules" "generative-palm" "apiKey") }}
apiKey: {{ index .Values "modules" "generative-palm" "apiKey" | b64enc }}
{{- else if (index .Values "modules" "multi2vec-palm" "apiKey") }}
apiKey: {{ index .Values "modules" "multi2vec-palm" "apiKey" | b64enc }}
{{- else }}
apiKey: {{ index .Values "modules" "text2vec-palm" "apiKey" | b64enc }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion weaviate/templates/weaviateStatefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ spec:
name: weaviate-cohere
key: apiKey
{{- end }}
{{- if or (and (index .Values "modules" "text2vec-palm" "enabled") (index .Values "modules" "text2vec-palm" "apiKey")) (and (index .Values "modules" "generative-palm" "enabled") (index .Values "modules" "generative-palm" "apiKey")) }}
{{- if or (and (index .Values "modules" "text2vec-palm" "enabled") (index .Values "modules" "text2vec-palm" "apiKey")) (and (index .Values "modules" "generative-palm" "enabled") (index .Values "modules" "generative-palm" "apiKey")) (and (index .Values "modules" "multi2vec-palm" "enabled") (index .Values "modules" "multi2vec-palm" "apiKey")) }}
- name: PALM_APIKEY
valueFrom:
secretKeyRef:
Expand Down
13 changes: 13 additions & 0 deletions weaviate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,19 @@ modules:
nodeSelector:
tolerations:

# The multi2vec-palm module uses Google PaLM Embeddings API
# to dynamically compute vector embeddings.
# More information about Google PaLM Embeddings API can be found here:
# https://cloud.google.com/vertex-ai/generative-ai/docs/embeddings/get-multimodal-embeddings
multi2vec-palm:

# enable if you want to use Google Multimodal PaLM module
enabled: false

# Set your Google PaLM API Key to be passed to Weaviate pod as
# an environment variable
apiKey: ''

# The qna-transformers module uses neural networks, such as BERT,
# DistilBERT, to find an answer in text to a given question
qna-transformers:
Expand Down

0 comments on commit 401538d

Please sign in to comment.