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 support for multi2vec-cohere module #274

Merged
merged 1 commit into from
Nov 8, 2024
Merged
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
3 changes: 3 additions & 0 deletions .cicd/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,11 @@ function check_creates_template() {
check_modules "--set modules.qna-openai.enabled=true --set modules.qna-openai.apiKey=apiKey --set modules.generative-openai.enabled=true --set modules.generative-openai.apiKey=apiKey" "value: qna-openai,generative-openai"
check_modules "--set modules.generative-cohere.enabled=true" "value: generative-cohere"
check_modules "--set modules.reranker-cohere.enabled=true" "value: reranker-cohere"
check_modules "--set modules.multi2vec-cohere.enabled=true" "value: multi2vec-cohere"
check_modules "--set modules.text2vec-cohere.enabled=true --set modules.text2vec-cohere.apiKey=apiKey --set modules.generative-cohere.enabled=true --set modules.generative-cohere.apiKey=apiKey" "value: generative-cohere,text2vec-cohere"
check_modules "--set modules.text2vec-cohere.enabled=true --set modules.text2vec-cohere.apiKey=apiKey --set modules.generative-cohere.enabled=true --set modules.generative-cohere.apiKey=apiKey --set modules.reranker-cohere.enabled=true --set modules.reranker-cohere.apiKey=apiKey" "value: generative-cohere,text2vec-cohere,reranker-cohere"
check_modules "--set modules.text2vec-cohere.enabled=true --set modules.text2vec-cohere.apiKey=apiKey --set modules.reranker-cohere.enabled=true --set modules.reranker-cohere.apiKey=apiKey" "value: text2vec-cohere,reranker-cohere"
check_modules "--set modules.text2vec-cohere.enabled=true --set modules.text2vec-cohere.apiKey=apiKey --set modules.multi2vec-cohere.enabled=true --set modules.multi2vec-cohere.apiKey=apiKey" "value: multi2vec-cohere,text2vec-cohere"
check_modules "--set modules.generative-cohere.enabled=true --set modules.generative-cohere.apiKey=apiKey" "value: generative-cohere"
check_modules "--set modules.text2vec-palm.enabled=true" "value: text2vec-palm"
check_modules "--set modules.generative-palm.enabled=true" "value: generative-palm"
Expand Down Expand Up @@ -223,6 +225,7 @@ function check_creates_template() {
check_string_existence "--set modules.generative-databricks.enabled=true --set modules.generative-databricks.token=databricksToken --set modules.text2vec-databricks.enabled=true --set modules.text2vec-databricks.token=databricksToken" "name: DATABRICKS_TOKEN"
check_string_existence "--set modules.text2vec-mistral.enabled=true --set modules.text2vec-mistral.apiKey=mistralApiKey" "name: MISTRAL_APIKEY"
check_string_existence "--set modules.generative-mistral.enabled=true --set modules.generative-mistral.apiKey=mistralApiKey --set modules.text2vec-mistral.enabled=true --set modules.text2vec-mistral.apiKey=mistralApiKey" "name: MISTRAL_APIKEY"
check_string_existence "--set modules.multi2vec-cohere.enabled=true --set modules.multi2vec-cohere.apiKey=apiKey" "name: COHERE_APIKEY"

check_setting_has_value "--set replicas=3 --set env.RAFT_BOOTSTRAP_EXPECT=3" "name: RAFT_JOIN" "value: \"weaviate-0,weaviate-1,weaviate-2\""
check_setting_has_value "--set replicas=3 --set env.RAFT_BOOTSTRAP_EXPECT=3" "name: RAFT_BOOTSTRAP_EXPECT" "value: \"3\""
Expand Down
4 changes: 2 additions & 2 deletions weaviate/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ 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: 17.3.0
version: 17.3.1

# 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
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.27.0
appVersion: 1.27.2
icon: https://raw.githubusercontent.com/weaviate/weaviate/19de0956c69b66c5552447e84d016f4fe29d12c9/docs/assets/weaviate-logo.png
3 changes: 3 additions & 0 deletions weaviate/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
{{- if (index .Values "modules" "multi2vec-google" "enabled") -}}
{{ $modules = append $modules "multi2vec-google" }}
{{- end -}}
{{- if (index .Values "modules" "multi2vec-cohere" "enabled") -}}
{{ $modules = append $modules "multi2vec-cohere" }}
{{- end -}}
{{- if (index .Values "modules" "text2vec-openai" "enabled") -}}
{{ $modules = append $modules "text2vec-openai" }}
{{- end -}}
Expand Down
8 changes: 7 additions & 1 deletion weaviate/templates/apiKeyCohereSecret.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{- $t2vCohere := and (index .Values "modules" "text2vec-cohere" "enabled") (index .Values "modules" "text2vec-cohere" "apiKey") -}}
{{- $generativeCohere := and (index .Values "modules" "generative-cohere" "enabled") (index .Values "modules" "generative-cohere" "apiKey") }}
{{- $rerankerCohere := and (index .Values "modules" "reranker-cohere" "enabled") (index .Values "modules" "reranker-cohere" "apiKey") }}
{{- $cohere := or ($t2vCohere) ($generativeCohere) ($rerankerCohere) }}
{{- $multi2vecCohere := and (index .Values "modules" "multi2vec-cohere" "enabled") (index .Values "modules" "multi2vec-cohere" "apiKey") }}
{{- $cohere := or ($t2vCohere) ($generativeCohere) ($rerankerCohere) ($multi2vecCohere) }}
{{- if $cohere }}

{{- $apiKeys := list }}
Expand All @@ -14,6 +15,9 @@
{{- if $rerankerCohere }}
{{- $apiKeys = append $apiKeys (index .Values "modules" "reranker-cohere" "apiKey") -}}
{{- end }}
{{- if $multi2vecCohere }}
{{- $apiKeys = append $apiKeys (index .Values "modules" "multi2vec-cohere" "apiKey") -}}
{{- end }}

{{- if gt (len ($apiKeys | uniq)) 1 -}}
{{- fail "Cohere modules activated, but their keys differ. Use the same key on all activated Cohere modules." }}
Expand All @@ -32,6 +36,8 @@ data:
apiKey: {{ index .Values "modules" "generative-cohere" "apiKey" | b64enc }}
{{- else if (index .Values "modules" "reranker-cohere" "apiKey") }}
apiKey: {{ index .Values "modules" "reranker-cohere" "apiKey" | b64enc }}
{{- else if (index .Values "modules" "multi2vec-cohere" "apiKey") }}
apiKey: {{ index .Values "modules" "multi2vec-cohere" "apiKey" | b64enc }}
{{- else }}
apiKey: {{ index .Values "modules" "text2vec-cohere" "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 @@ -218,7 +218,7 @@ spec:
name: weaviate-huggingface
key: apiKey
{{- end }}
{{- if or (and (index .Values "modules" "text2vec-cohere" "enabled") (index .Values "modules" "text2vec-cohere" "apiKey")) (and (index .Values "modules" "generative-cohere" "enabled") (index .Values "modules" "generative-cohere" "apiKey")) (and (index .Values "modules" "reranker-cohere" "enabled") (index .Values "modules" "reranker-cohere" "apiKey")) }}
{{- if or (and (index .Values "modules" "text2vec-cohere" "enabled") (index .Values "modules" "text2vec-cohere" "apiKey")) (and (index .Values "modules" "generative-cohere" "enabled") (index .Values "modules" "generative-cohere" "apiKey")) (and (index .Values "modules" "reranker-cohere" "enabled") (index .Values "modules" "reranker-cohere" "apiKey")) (and (index .Values "modules" "multi2vec-cohere" "enabled") (index .Values "modules" "multi2vec-cohere" "apiKey")) }}
- name: COHERE_APIKEY
valueFrom:
secretKeyRef:
Expand Down
14 changes: 13 additions & 1 deletion weaviate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ image:
# of weaviate. In accordance with Infra-as-code, you should pin this value
# down and only change it if you explicitly want to upgrade the Weaviate
# version.
tag: 1.27.0
tag: 1.27.2
repo: semitechnologies/weaviate
# Image pull policy: https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy
pullPolicy: IfNotPresent
Expand Down Expand Up @@ -1225,6 +1225,18 @@ modules:
# an environment variable
apiKey: ''

# The multi2vec-cohere module uses Cohere API
# to dynamically compute vector embeddings.
# More information about Cohere API can be found here: https://docs.cohere.ai/
multi2vec-cohere:

# enable if you want to use Cohere module
enabled: false

# Set your Cohere 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
Loading