Skip to content

Commit

Permalink
Add support for generative-friendliai module
Browse files Browse the repository at this point in the history
  • Loading branch information
antas-marcin committed Sep 5, 2024
1 parent 858ae40 commit 497720b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .cicd/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ function check_creates_template() {
check_modules "--set offload.s3.enabled=true" "value: offload-s3"
check_modules "--set modules.generative-anthropic.enabled=true" "value: generative-anthropic"
check_modules "--set modules.generative-anthropic.enabled=true --set modules.generative-anthropic.apiKey=apiKey" "value: generative-anthropic"
check_modules "--set modules.generative-friendliai.enabled=true" "value: generative-friendliai"
check_modules "--set modules.generative-friendliai.enabled=true --set modules.generative-friendliai.token=token" "value: generative-friendliai"

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 Down Expand Up @@ -208,6 +210,7 @@ function check_creates_template() {
check_string_existence "--set modules.text2vec-openai.enabled=true --set modules.text2vec-jinaai.enabled=true --set modules.text2vec-jinaai.apiKey=JinaAIApiKey" "name: JINAAI_APIKEY"
check_string_existence "--set modules.text2vec-openai.enabled=true --set modules.reranker-jinaai.enabled=true --set modules.reranker-jinaai.apiKey=JinaAIApiKey" "name: JINAAI_APIKEY"
check_string_existence "--set modules.text2vec-openai.enabled=true --set modules.reranker-jinaai.enabled=true --set modules.reranker-jinaai.apiKey=JinaAIApiKey --set modules.text2vec-jinaai.enabled=true --set modules.text2vec-jinaai.apiKey=JinaAIApiKey" "name: JINAAI_APIKEY"
check_string_existence "--set modules.text2vec-openai.enabled=true --set modules.generative-friendliai.enabled=true --set modules.generative-friendliai.token=FriendliToken" "name: FRIENDLI_TOKEN"

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
3 changes: 3 additions & 0 deletions weaviate/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
{{- if (index .Values "modules" "generative-anthropic" "enabled") -}}
{{ $modules = append $modules "generative-anthropic" }}
{{- end -}}
{{- if (index .Values "modules" "generative-friendliai" "enabled") -}}
{{ $modules = append $modules "generative-friendliai" }}
{{- end -}}
{{- if or (index .Values "modules" "img2vec-neural" "enabled") (index .Values "modules" "img2vec-neural" "inferenceUrl") -}}
{{ $modules = append $modules "img2vec-neural" }}
{{- end -}}
Expand Down
12 changes: 12 additions & 0 deletions weaviate/templates/tokenFriendliAISecret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{ if and (index .Values "modules" "generative-friendliai" "enabled") (index .Values "modules" "generative-friendliai" "token") }}
apiVersion: v1
kind: Secret
metadata:
name: weaviate-friendliai
labels:
app.kubernetes.io/name: weaviate
app.kubernetes.io/managed-by: helm
type: Opaque
data:
token: {{ index .Values "modules" "generative-friendliai" "token" | b64enc }}
{{ end }}
7 changes: 7 additions & 0 deletions weaviate/templates/weaviateStatefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,13 @@ spec:
name: weaviate-octoai
key: apiKey
{{- end }}
{{- if and (index .Values "modules" "generative-friendliai" "enabled") (index .Values "modules" "generative-friendliai" "token") }}
- name: FRIENDLI_TOKEN
valueFrom:
secretKeyRef:
name: weaviate-friendliai
key: token
{{- end }}
{{- if and (index .Values "offload" "s3" "enabled") (index .Values "offload" "s3" "envconfig") }}
{{- range $key, $value := index .Values "offload" "s3" "envconfig" }}
- name: {{ $key }}
Expand Down
12 changes: 12 additions & 0 deletions weaviate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,18 @@ modules:
# an environment variable
apiKey: ''

# The generative-friendliai module uses FriendliAI API.
# More information about FriendliAI API can be found here:
# https://docs.friendli.ai/openapi/create-chat-completions
generative-friendliai:

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

# Set your FriendliAI Token to be passed to Weaviate pod as
# an environment variable
token: ''

# The img2vec-neural module uses neural networks, to generate
# a vector representation of the image
img2vec-neural:
Expand Down

0 comments on commit 497720b

Please sign in to comment.