ADAPT-Chase commited on
Commit
fb5ff35
·
verified ·
1 Parent(s): 4424e75

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. platform/dbops/binaries/weaviate-src/test/modules/img2vec-neural/data/pixel.png +3 -0
  2. platform/dbops/binaries/weaviate-src/test/modules/reranker-nvidia/reranker_nvidia_test.go +73 -0
  3. platform/dbops/binaries/weaviate-src/test/modules/reranker-nvidia/setup_test.go +52 -0
  4. platform/dbops/binaries/weaviate-src/test/modules/reranker-transformers/reranker_transformers_test.go +309 -0
  5. platform/dbops/binaries/weaviate-src/test/modules/reranker-transformers/setup_test.go +40 -0
  6. platform/dbops/binaries/weaviate-src/test/modules/sum-transformers/setup_test.go +42 -0
  7. platform/dbops/binaries/weaviate-src/test/modules/sum-transformers/sum_test.go +93 -0
  8. platform/dbops/binaries/weaviate-src/test/modules/text2multivec-jinaai/setup_test.go +54 -0
  9. platform/dbops/binaries/weaviate-src/test/modules/text2multivec-jinaai/text2multivec_jinaai_test.go +87 -0
  10. platform/dbops/binaries/weaviate-src/test/modules/text2vec-aws/setup_test.go +71 -0
  11. platform/dbops/binaries/weaviate-src/test/modules/text2vec-aws/text2vec_aws_test.go +94 -0
  12. platform/dbops/binaries/weaviate-src/test/modules/text2vec-contextionary/cluster_nodes_api_test.go +105 -0
  13. platform/dbops/binaries/weaviate-src/test/modules/text2vec-contextionary/group_by_cluster_test.go +25 -0
  14. platform/dbops/binaries/weaviate-src/test/modules/text2vec-contextionary/near_text_test.go +94 -0
  15. platform/dbops/binaries/weaviate-src/test/modules/text2vec-contextionary/setup_test.go +48 -0
  16. platform/dbops/binaries/weaviate-src/test/modules/text2vec-google/setup_test.go +59 -0
  17. platform/dbops/binaries/weaviate-src/test/modules/text2vec-google/text2vec_google_test.go +120 -0
  18. platform/dbops/binaries/weaviate-src/test/modules/text2vec-huggingface/setup_test.go +51 -0
  19. platform/dbops/binaries/weaviate-src/test/modules/text2vec-huggingface/text2vec_huggingface_test.go +88 -0
  20. platform/dbops/binaries/weaviate-src/test/modules/text2vec-jinaai/setup_test.go +56 -0
  21. platform/dbops/binaries/weaviate-src/test/modules/text2vec-jinaai/text2vec_jinaai_test.go +100 -0
  22. platform/dbops/binaries/weaviate-src/test/modules/text2vec-mistral/setup_test.go +51 -0
  23. platform/dbops/binaries/weaviate-src/test/modules/text2vec-mistral/text2vec_mistral_test.go +83 -0
  24. platform/dbops/binaries/weaviate-src/test/modules/text2vec-model2vec/setup_test.go +41 -0
  25. platform/dbops/binaries/weaviate-src/test/modules/text2vec-model2vec/text2vec_model2vec_test.go +107 -0
  26. platform/dbops/binaries/weaviate-src/test/modules/text2vec-nvidia/setup_test.go +51 -0
  27. platform/dbops/binaries/weaviate-src/test/modules/text2vec-nvidia/text2vec_nvidia_test.go +90 -0
  28. platform/dbops/binaries/weaviate-src/test/modules/text2vec-ollama/ollama_vectorizer_test.go +135 -0
  29. platform/dbops/binaries/weaviate-src/test/modules/text2vec-ollama/setup_test.go +65 -0
  30. platform/dbops/binaries/weaviate-src/test/modules/text2vec-transformers/setup_test.go +42 -0
  31. platform/dbops/binaries/weaviate-src/test/modules/text2vec-transformers/transformers_test.go +58 -0
  32. platform/dbops/binaries/weaviate-src/test/modules/text2vec-voyageai/setup_test.go +53 -0
  33. platform/dbops/binaries/weaviate-src/test/modules/text2vec-voyageai/text2vec_voyageai_test.go +93 -0
  34. platform/dbops/binaries/weaviate-src/tools/ci/gcloud.sh +26 -0
  35. platform/dbops/binaries/weaviate-src/tools/ci/sa.json.gpg +0 -0
  36. platform/dbops/binaries/weaviate-src/tools/dev/README.md +13 -0
  37. platform/dbops/binaries/weaviate-src/tools/dev/config.docker.yaml +26 -0
  38. platform/dbops/binaries/weaviate-src/tools/dev/config.local-customdb.yaml +30 -0
  39. platform/dbops/binaries/weaviate-src/tools/dev/config.local-development.yaml +30 -0
  40. platform/dbops/binaries/weaviate-src/tools/dev/config.local-esvector-only.yaml +28 -0
  41. platform/dbops/binaries/weaviate-src/tools/dev/config.local-oidc.yaml +37 -0
  42. platform/dbops/binaries/weaviate-src/tools/dev/config.readonly.yaml +38 -0
  43. platform/dbops/binaries/weaviate-src/tools/dev/config.runtime-overrides.yaml +23 -0
  44. platform/dbops/binaries/weaviate-src/tools/dev/config.wcsauth-dev.yaml +36 -0
  45. platform/dbops/binaries/weaviate-src/tools/dev/delve_connect.sh +7 -0
  46. platform/dbops/binaries/weaviate-src/tools/dev/ensure-buildx-builder.sh +8 -0
  47. platform/dbops/binaries/weaviate-src/tools/dev/flakyness.sh +18 -0
  48. platform/dbops/binaries/weaviate-src/tools/dev/goreleaser_and_sign.sh +36 -0
  49. platform/dbops/binaries/weaviate-src/tools/dev/grpc_regenerate.sh +39 -0
  50. platform/dbops/binaries/weaviate-src/tools/dev/image-tag.sh +25 -0
platform/dbops/binaries/weaviate-src/test/modules/img2vec-neural/data/pixel.png ADDED

Git LFS Details

  • SHA256: c988b85c183003b466b60bdab01e8f67f1639c7b9f2ffe9f9f241907bc8063a1
  • Pointer size: 128 Bytes
  • Size of remote file: 546 Bytes
platform/dbops/binaries/weaviate-src/test/modules/reranker-nvidia/reranker_nvidia_test.go ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package test
13
+
14
+ import (
15
+ "testing"
16
+
17
+ "github.com/stretchr/testify/assert"
18
+ "github.com/stretchr/testify/require"
19
+ "github.com/weaviate/weaviate/test/helper"
20
+ graphqlhelper "github.com/weaviate/weaviate/test/helper/graphql"
21
+ "github.com/weaviate/weaviate/test/helper/sample-schema/books"
22
+ )
23
+
24
+ func testRerankerNvidia(host string) func(t *testing.T) {
25
+ return func(t *testing.T) {
26
+ helper.SetupClient(host)
27
+ booksClass := books.ClassContextionaryVectorizer()
28
+ booksClass.ModuleConfig.(map[string]interface{})["reranker-nvidia"] = map[string]interface{}{}
29
+ helper.CreateClass(t, booksClass)
30
+ defer helper.DeleteClass(t, booksClass.Class)
31
+
32
+ t.Run("import data", func(t *testing.T) {
33
+ for _, book := range books.Objects() {
34
+ helper.CreateObject(t, book)
35
+ helper.AssertGetObjectEventually(t, book.Class, book.ID)
36
+ }
37
+ })
38
+
39
+ t.Run("rerank", func(t *testing.T) {
40
+ query := `
41
+ {
42
+ Get {
43
+ Books{
44
+ title
45
+ _additional{
46
+ id
47
+ rerank(property:"description", query: "Who is the author of Dune?") {
48
+ score
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }`
54
+ result := graphqlhelper.AssertGraphQL(t, helper.RootAuth, query)
55
+ booksResponse := result.Get("Get", "Books").AsSlice()
56
+ require.True(t, len(booksResponse) > 0)
57
+ results, ok := booksResponse[0].(map[string]interface{})
58
+ require.True(t, ok)
59
+ assert.True(t, results["title"] != nil)
60
+ assert.NotNil(t, results["_additional"])
61
+ additional, ok := results["_additional"].(map[string]interface{})
62
+ require.True(t, ok)
63
+ assert.Equal(t, books.Dune.String(), additional["id"])
64
+ assert.NotNil(t, additional["rerank"])
65
+ rerank, ok := additional["rerank"].([]interface{})
66
+ require.True(t, ok)
67
+ score, ok := rerank[0].(map[string]interface{})
68
+ require.True(t, ok)
69
+ require.NotNil(t, score)
70
+ assert.NotNil(t, score["score"])
71
+ })
72
+ }
73
+ }
platform/dbops/binaries/weaviate-src/test/modules/reranker-nvidia/setup_test.go ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package test
13
+
14
+ import (
15
+ "context"
16
+ "os"
17
+ "testing"
18
+
19
+ "github.com/stretchr/testify/require"
20
+ "github.com/weaviate/weaviate/test/docker"
21
+ )
22
+
23
+ func TestRerankerNvidia(t *testing.T) {
24
+ apiApiKey := os.Getenv("NVIDIA_APIKEY")
25
+ if apiApiKey == "" {
26
+ t.Skip("skipping, NVIDIA_APIKEY environment variable not present")
27
+ }
28
+ ctx := context.Background()
29
+ compose, err := createSingleNodeEnvironment(ctx, apiApiKey)
30
+ require.NoError(t, err)
31
+ defer func() {
32
+ require.NoError(t, compose.Terminate(ctx))
33
+ }()
34
+ endpoint := compose.GetWeaviate().URI()
35
+
36
+ t.Run("reranker-nvidia", testRerankerNvidia(endpoint))
37
+ }
38
+
39
+ func createSingleNodeEnvironment(ctx context.Context, apiApiKey string,
40
+ ) (compose *docker.DockerCompose, err error) {
41
+ compose, err = composeModules(apiApiKey).
42
+ WithWeaviate().
43
+ Start(ctx)
44
+ return
45
+ }
46
+
47
+ func composeModules(apiApiKey string) (composeModules *docker.Compose) {
48
+ composeModules = docker.New().
49
+ WithText2VecContextionary().
50
+ WithRerankerNvidia(apiApiKey)
51
+ return
52
+ }
platform/dbops/binaries/weaviate-src/test/modules/reranker-transformers/reranker_transformers_test.go ADDED
@@ -0,0 +1,309 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package test
13
+
14
+ import (
15
+ "fmt"
16
+ "testing"
17
+ "time"
18
+
19
+ "github.com/stretchr/testify/assert"
20
+ "github.com/stretchr/testify/require"
21
+ pb "github.com/weaviate/weaviate/grpc/generated/protocol/v1"
22
+ "github.com/weaviate/weaviate/test/helper"
23
+ graphqlhelper "github.com/weaviate/weaviate/test/helper/graphql"
24
+ grpchelper "github.com/weaviate/weaviate/test/helper/grpc"
25
+ "github.com/weaviate/weaviate/test/helper/sample-schema/books"
26
+ )
27
+
28
+ func testRerankerTransformers(rest, grpc, ollamaEndpoint string) func(t *testing.T) {
29
+ return func(t *testing.T) {
30
+ helper.SetupClient(rest)
31
+ helper.SetupGRPCClient(t, grpc)
32
+ booksClass := books.ClassModel2VecVectorizer()
33
+ helper.CreateClass(t, booksClass)
34
+ defer helper.DeleteClass(t, booksClass.Class)
35
+
36
+ assertResults := func(t *testing.T, result *graphqlhelper.GraphQLResult, checkGenerate bool) {
37
+ booksResponse := result.Get("Get", "Books").AsSlice()
38
+ require.True(t, len(booksResponse) > 0)
39
+ results, ok := booksResponse[0].(map[string]any)
40
+ require.True(t, ok)
41
+ assert.True(t, results["title"] != nil)
42
+ assert.NotNil(t, results["_additional"])
43
+ additional, ok := results["_additional"].(map[string]any)
44
+ require.True(t, ok)
45
+ assert.Equal(t, books.Dune.String(), additional["id"])
46
+ assert.NotNil(t, additional["rerank"])
47
+ rerank, ok := additional["rerank"].([]any)
48
+ require.True(t, ok)
49
+ score, ok := rerank[0].(map[string]any)
50
+ require.True(t, ok)
51
+ require.NotNil(t, score)
52
+ assert.NotNil(t, score["score"])
53
+
54
+ if checkGenerate {
55
+ generateExists := false
56
+ for _, obj := range booksResponse {
57
+ book, ok := obj.(map[string]any)
58
+ require.True(t, ok)
59
+ assert.NotNil(t, book["_additional"])
60
+ additional, ok := book["_additional"].(map[string]any)
61
+ require.True(t, ok)
62
+ generate, ok := additional["generate"].(map[string]any)
63
+ if ok {
64
+ generateExists = true
65
+ if generate["error"] != nil {
66
+ t.Logf("\n----------------\nerror: %v\n----------------\n", generate["error"])
67
+ }
68
+ require.Nil(t, generate["error"])
69
+ debug, ok := generate["debug"].(map[string]any)
70
+ require.True(t, ok)
71
+ prompt, ok := debug["prompt"].(string)
72
+ require.True(t, ok)
73
+ assert.True(t, len(prompt) > 0)
74
+ groupedResult, ok := generate["groupedResult"].(string)
75
+ require.True(t, ok)
76
+ assert.True(t, len(groupedResult) > 0)
77
+ t.Logf("---------------\nDebug.Prompt: %v\n\nGroupedResult: %v\n---------------\n", prompt, groupedResult)
78
+ }
79
+ }
80
+ require.True(t, generateExists)
81
+ }
82
+ }
83
+
84
+ t.Run("import data", func(t *testing.T) {
85
+ for _, book := range books.Objects() {
86
+ helper.CreateObject(t, book)
87
+ helper.AssertGetObjectEventually(t, book.Class, book.ID)
88
+ }
89
+ })
90
+
91
+ t.Run("rerank", func(t *testing.T) {
92
+ query := `
93
+ {
94
+ Get {
95
+ Books
96
+ %s
97
+ {
98
+ title
99
+ _additional{
100
+ id
101
+ rerank(property:"description", query: "Who is the author of Dune?") {
102
+ score
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }`
108
+ tests := []struct {
109
+ name string
110
+ searchArgument string
111
+ }{
112
+ {
113
+ name: "without search argument",
114
+ },
115
+ {
116
+ name: "with nearText",
117
+ searchArgument: `(nearText:{concepts:"project hail mary"})`,
118
+ },
119
+ {
120
+ name: "with nearObject",
121
+ searchArgument: fmt.Sprintf("(nearObject:{id:%q})", books.TheLordOfTheIceGarden),
122
+ },
123
+ {
124
+ name: "with hybrid",
125
+ searchArgument: `(hybrid:{query:"project hail mary" properties:["title"]})`,
126
+ },
127
+ }
128
+ for _, tt := range tests {
129
+ t.Run(tt.name, func(t *testing.T) {
130
+ assertResults(t, graphqlhelper.AssertGraphQL(t, helper.RootAuth, fmt.Sprintf(query, tt.searchArgument)), false)
131
+ })
132
+ }
133
+ })
134
+
135
+ t.Run("rerank with generate", func(t *testing.T) {
136
+ query := `
137
+ {
138
+ Get {
139
+ Books
140
+ %s
141
+ {
142
+ title
143
+ _additional{
144
+ id
145
+ rerank(property:"description", query: "Who is the author of Dune?") {
146
+ score
147
+ }
148
+ generate(
149
+ groupedResult:{
150
+ ollama:{
151
+ apiEndpoint:%q
152
+ model:"tinyllama"
153
+ }
154
+ task:"Write a short tweet about this content"
155
+ properties:["title","description"]
156
+ debug:true
157
+ }
158
+ ){
159
+ groupedResult
160
+ error
161
+ debug{
162
+ prompt
163
+ }
164
+ }
165
+ }
166
+ }
167
+ }
168
+ }`
169
+ tests := []struct {
170
+ name string
171
+ searchArgument string
172
+ }{
173
+ {
174
+ name: "without search argument",
175
+ },
176
+ {
177
+ name: "with nearText",
178
+ searchArgument: `(nearText:{concepts:"project hail mary"})`,
179
+ },
180
+ {
181
+ name: "with nearObject",
182
+ searchArgument: fmt.Sprintf("(nearObject:{id:%q})", books.TheLordOfTheIceGarden),
183
+ },
184
+ {
185
+ name: "with hybrid",
186
+ searchArgument: `(hybrid:{query:"project hail mary" properties:["title"]})`,
187
+ },
188
+ }
189
+ for _, tt := range tests {
190
+ t.Run(tt.name, func(t *testing.T) {
191
+ result := graphqlhelper.AssertGraphQL(t, helper.RootAuth, fmt.Sprintf(query, tt.searchArgument, ollamaEndpoint))
192
+ assertResults(t, result, true)
193
+ })
194
+ }
195
+ })
196
+
197
+ t.Run("rerank using gRPC", func(t *testing.T) {
198
+ tests := []struct {
199
+ name string
200
+ nearText *pb.NearTextSearch
201
+ nearObject *pb.NearObject
202
+ hybrid *pb.Hybrid
203
+ withGenerate bool
204
+ }{
205
+ {
206
+ name: "without search argument",
207
+ },
208
+ {
209
+ name: "without search argument with generate",
210
+ withGenerate: true,
211
+ },
212
+ {
213
+ name: "with nearText",
214
+ nearText: &pb.NearTextSearch{
215
+ Query: []string{"project hail mary"},
216
+ },
217
+ },
218
+ {
219
+ name: "with nearText with generate",
220
+ nearText: &pb.NearTextSearch{
221
+ Query: []string{"project hail mary"},
222
+ },
223
+ withGenerate: true,
224
+ },
225
+ {
226
+ name: "with nearObject",
227
+ nearObject: &pb.NearObject{
228
+ Id: books.TheLordOfTheIceGarden.String(),
229
+ },
230
+ },
231
+ {
232
+ name: "with nearObject with generate",
233
+ nearObject: &pb.NearObject{
234
+ Id: books.TheLordOfTheIceGarden.String(),
235
+ },
236
+ withGenerate: true,
237
+ },
238
+ {
239
+ name: "with hybrid",
240
+ hybrid: &pb.Hybrid{
241
+ Query: "project hail mary",
242
+ Alpha: 0.5,
243
+ Properties: []string{"title", "description"},
244
+ },
245
+ },
246
+ {
247
+ name: "with hybrid with generate",
248
+ hybrid: &pb.Hybrid{
249
+ Query: "project hail mary",
250
+ Alpha: 0.5,
251
+ Properties: []string{"title", "description"},
252
+ },
253
+ withGenerate: true,
254
+ },
255
+ }
256
+ for _, tt := range tests {
257
+ t.Run(tt.name, func(t *testing.T) {
258
+ req := &pb.SearchRequest{
259
+ Collection: booksClass.Class,
260
+ NearText: tt.nearText,
261
+ NearObject: tt.nearObject,
262
+ HybridSearch: tt.hybrid,
263
+ Rerank: &pb.Rerank{
264
+ Property: "description",
265
+ Query: grpchelper.ToPtr("Who is the author of Dune?"),
266
+ },
267
+ Metadata: &pb.MetadataRequest{
268
+ Score: true,
269
+ },
270
+ Uses_127Api: true,
271
+ }
272
+ if tt.withGenerate {
273
+ req.Generative = &pb.GenerativeSearch{
274
+ Grouped: &pb.GenerativeSearch_Grouped{
275
+ Task: "Write a short tweet about this content",
276
+ Debug: true,
277
+ Properties: &pb.TextArray{Values: []string{"title", "description"}},
278
+ Queries: []*pb.GenerativeProvider{{
279
+ ReturnMetadata: false, // no metadata for ollama
280
+ Kind: &pb.GenerativeProvider_Ollama{
281
+ Ollama: &pb.GenerativeOllama{
282
+ ApiEndpoint: grpchelper.ToPtr(ollamaEndpoint),
283
+ Model: grpchelper.ToPtr("tinyllama"),
284
+ },
285
+ },
286
+ }},
287
+ },
288
+ }
289
+ }
290
+ resp := grpchelper.AssertSearchWithTimeout(t, req, 10*time.Minute)
291
+ require.NotNil(t, resp)
292
+ require.NotEmpty(t, resp.Results)
293
+ require.Len(t, resp.Results, 3)
294
+ require.NotNil(t, resp.Results[0].Metadata)
295
+ require.True(t, resp.Results[0].Metadata.RerankScorePresent)
296
+ assert.GreaterOrEqual(t, resp.Results[0].Metadata.RerankScore, float64(8))
297
+ if tt.withGenerate {
298
+ require.NotNil(t, resp.GenerativeGroupedResults)
299
+ require.NotEmpty(t, resp.GenerativeGroupedResults.Values)
300
+ require.NotEmpty(t, resp.GenerativeGroupedResults.Values[0].Result)
301
+ require.NotNil(t, resp.GenerativeGroupedResults.Values[0].Debug)
302
+ require.NotEmpty(t, *resp.GenerativeGroupedResults.Values[0].Debug.FullPrompt)
303
+ t.Logf("---------------\nDebug.Prompt: %v\n\nGroupedResult: %v\n---------------\n", *resp.GenerativeGroupedResults.Values[0].Debug.FullPrompt, resp.GenerativeGroupedResults.Values[0].Result)
304
+ }
305
+ })
306
+ }
307
+ })
308
+ }
309
+ }
platform/dbops/binaries/weaviate-src/test/modules/reranker-transformers/setup_test.go ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package test
13
+
14
+ import (
15
+ "context"
16
+ "testing"
17
+
18
+ "github.com/stretchr/testify/require"
19
+ "github.com/weaviate/weaviate/test/docker"
20
+ )
21
+
22
+ func TestRerankerTransformers(t *testing.T) {
23
+ ctx := context.Background()
24
+ compose, err := docker.New().
25
+ WithWeaviateWithGRPC().
26
+ WithWeaviateEnv("API_BASED_MODULES_DISABLED", "true").
27
+ WithText2VecModel2Vec().
28
+ WithRerankerTransformers().
29
+ WithGenerativeOllama().
30
+ Start(ctx)
31
+ require.NoError(t, err)
32
+ defer func() {
33
+ require.NoError(t, compose.Terminate(ctx))
34
+ }()
35
+ rest := compose.GetWeaviate().URI()
36
+ grpc := compose.GetWeaviate().GrpcURI()
37
+ ollamaApiEndpoint := compose.GetOllamaGenerative().GetEndpoint("apiEndpoint")
38
+
39
+ t.Run("reranker-transformers", testRerankerTransformers(rest, grpc, ollamaApiEndpoint))
40
+ }
platform/dbops/binaries/weaviate-src/test/modules/sum-transformers/setup_test.go ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package test
13
+
14
+ import (
15
+ "context"
16
+ "os"
17
+ "testing"
18
+
19
+ "github.com/pkg/errors"
20
+ "github.com/weaviate/weaviate/test/docker"
21
+ )
22
+
23
+ const weaviateEndpoint = "WEAVIATE_ENDPOINT"
24
+
25
+ func TestMain(m *testing.M) {
26
+ ctx := context.Background()
27
+ compose, err := docker.New().
28
+ WithWeaviate().WithText2VecContextionary().WithSUMTransformers().
29
+ Start(ctx)
30
+ if err != nil {
31
+ panic(errors.Wrapf(err, "cannot start"))
32
+ }
33
+
34
+ os.Setenv(weaviateEndpoint, compose.GetWeaviate().URI())
35
+ code := m.Run()
36
+
37
+ if err := compose.Terminate(ctx); err != nil {
38
+ panic(errors.Wrapf(err, "cannot terminate"))
39
+ }
40
+
41
+ os.Exit(code)
42
+ }
platform/dbops/binaries/weaviate-src/test/modules/sum-transformers/sum_test.go ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package test
13
+
14
+ import (
15
+ "os"
16
+ "testing"
17
+
18
+ "github.com/stretchr/testify/assert"
19
+ "github.com/weaviate/weaviate/entities/models"
20
+ "github.com/weaviate/weaviate/test/helper"
21
+ graphqlhelper "github.com/weaviate/weaviate/test/helper/graphql"
22
+ "github.com/weaviate/weaviate/test/helper/sample-schema/books"
23
+ )
24
+
25
+ func Test_SUMTransformers(t *testing.T) {
26
+ helper.SetupClient(os.Getenv(weaviateEndpoint))
27
+ tests := []struct {
28
+ name string
29
+ class *models.Class
30
+ }{
31
+ {
32
+ name: "with module config for sum-transformers module",
33
+ class: books.ClassContextionaryVectorizerWithSumTransformers(),
34
+ },
35
+ {
36
+ name: "without module config",
37
+ class: books.ClassContextionaryVectorizer(),
38
+ },
39
+ }
40
+ for _, tt := range tests {
41
+ t.Run(tt.name, func(t *testing.T) {
42
+ booksClass := tt.class
43
+ helper.CreateClass(t, booksClass)
44
+ defer helper.DeleteClass(t, booksClass.Class)
45
+
46
+ t.Run("add data to Books schema", func(t *testing.T) {
47
+ for _, book := range books.Objects() {
48
+ helper.CreateObject(t, book)
49
+ helper.AssertGetObjectEventually(t, book.Class, book.ID)
50
+ }
51
+ })
52
+
53
+ t.Run("query Books data with nearText", func(t *testing.T) {
54
+ result := graphqlhelper.AssertGraphQL(t, helper.RootAuth, `
55
+ {
56
+ Get {
57
+ Books(where: {
58
+ operator: Equal
59
+ path:["title"]
60
+ valueText: "Dune"
61
+ }){
62
+ title
63
+ _additional {
64
+ summary (properties:["description"]) {
65
+ property
66
+ result
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ `)
73
+ books := result.Get("Get", "Books").AsSlice()
74
+ expected := []interface{}{
75
+ map[string]interface{}{
76
+ "title": "Dune",
77
+ "_additional": map[string]interface{}{
78
+ "summary": []interface{}{
79
+ map[string]interface{}{
80
+ "property": "description",
81
+ "result": "Dune is a 1965 epic science fiction novel by American author Frank Herbert." +
82
+ "It is the first novel in the Dune series by Frank Herbert, and the first in the \"Dune\" series of books." +
83
+ "It was published in the United States by Simon & Schuster in 1965.",
84
+ },
85
+ },
86
+ },
87
+ },
88
+ }
89
+ assert.ElementsMatch(t, expected, books)
90
+ })
91
+ })
92
+ }
93
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2multivec-jinaai/setup_test.go ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "context"
16
+ "os"
17
+ "testing"
18
+
19
+ "github.com/stretchr/testify/require"
20
+ "github.com/weaviate/weaviate/test/docker"
21
+ )
22
+
23
+ func TestText2VecJinaAI(t *testing.T) {
24
+ jinaApiKey := os.Getenv("JINAAI_APIKEY")
25
+ if jinaApiKey == "" {
26
+ t.Skip("skipping, JINAAI_APIKEY environment variable not present")
27
+ }
28
+ ctx := context.Background()
29
+ compose, err := createSingleNodeEnvironment(ctx, jinaApiKey)
30
+ require.NoError(t, err)
31
+ defer func() {
32
+ require.NoError(t, compose.Terminate(ctx))
33
+ }()
34
+ rest := compose.GetWeaviate().URI()
35
+ grpc := compose.GetWeaviate().GrpcURI()
36
+
37
+ t.Run("text2multivec-jinaai", testText2MultivecJinaAI(rest, grpc, "text2multivec-jinaai"))
38
+ t.Run("text2colbert-jinaai", testText2MultivecJinaAI(rest, grpc, "text2colbert-jinaai"))
39
+ }
40
+
41
+ func createSingleNodeEnvironment(ctx context.Context, jinaApiKey string,
42
+ ) (compose *docker.DockerCompose, err error) {
43
+ compose, err = composeModules(jinaApiKey).
44
+ WithWeaviate().
45
+ WithWeaviateWithGRPC().
46
+ Start(ctx)
47
+ return
48
+ }
49
+
50
+ func composeModules(jinaApiKey string) (composeModules *docker.Compose) {
51
+ composeModules = docker.New().
52
+ WithText2MultivecJinaAI(jinaApiKey)
53
+ return
54
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2multivec-jinaai/text2multivec_jinaai_test.go ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "testing"
16
+
17
+ "github.com/stretchr/testify/assert"
18
+ "github.com/stretchr/testify/require"
19
+ "github.com/weaviate/weaviate/entities/models"
20
+ "github.com/weaviate/weaviate/entities/vectorindex/hnsw"
21
+ "github.com/weaviate/weaviate/test/helper"
22
+ "github.com/weaviate/weaviate/test/helper/sample-schema/companies"
23
+ )
24
+
25
+ func testText2MultivecJinaAI(host, grpc, vectorizerName string) func(t *testing.T) {
26
+ return func(t *testing.T) {
27
+ helper.SetupClient(host)
28
+ // Data
29
+ className := "BooksGenerativeTest"
30
+ data := companies.Companies
31
+ class := companies.BaseClass(className)
32
+ tests := []struct {
33
+ name string
34
+ model string
35
+ }{
36
+ {
37
+ name: "jina-colbert-v2",
38
+ model: "jina-colbert-v2",
39
+ },
40
+ }
41
+ for _, tt := range tests {
42
+ t.Run(tt.name, func(t *testing.T) {
43
+ // Define class
44
+ class.VectorConfig = map[string]models.VectorConfig{
45
+ "description": {
46
+ Vectorizer: map[string]interface{}{
47
+ vectorizerName: map[string]interface{}{
48
+ "properties": []interface{}{"description"},
49
+ "vectorizeClassName": false,
50
+ "model": tt.model,
51
+ "dimensions": 64,
52
+ },
53
+ },
54
+ VectorIndexType: "hnsw",
55
+ VectorIndexConfig: hnsw.MultivectorConfig{Enabled: true},
56
+ },
57
+ }
58
+ // create schema
59
+ helper.CreateClass(t, class)
60
+ defer helper.DeleteClass(t, class.Class)
61
+ // check that multivector is enabled
62
+ t.Run("check multivector config", func(t *testing.T) {
63
+ cls := helper.GetClass(t, class.Class)
64
+ assert.True(t, cls.VectorConfig["description"].VectorIndexConfig.(map[string]any)["multivector"].(map[string]any)["enabled"].(bool))
65
+ })
66
+ // create objects
67
+ t.Run("create objects", func(t *testing.T) {
68
+ companies.InsertObjects(t, host, class.Class)
69
+ })
70
+ t.Run("check objects existence", func(t *testing.T) {
71
+ for _, company := range data {
72
+ t.Run(company.ID.String(), func(t *testing.T) {
73
+ obj, err := helper.GetObject(t, class.Class, company.ID, "vector")
74
+ require.NoError(t, err)
75
+ require.NotNil(t, obj)
76
+ require.IsType(t, [][]float32{}, obj.Vectors["description"])
77
+ assert.True(t, len(obj.Vectors["description"].([][]float32)) > 0)
78
+ })
79
+ }
80
+ })
81
+ t.Run("search tests", func(t *testing.T) {
82
+ companies.PerformAllSearchTests(t, host, grpc, class.Class)
83
+ })
84
+ })
85
+ }
86
+ }
87
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-aws/setup_test.go ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "context"
16
+ "os"
17
+ "testing"
18
+
19
+ "github.com/stretchr/testify/require"
20
+ "github.com/weaviate/weaviate/test/docker"
21
+ )
22
+
23
+ func TestText2VecAWS_SingleNode(t *testing.T) {
24
+ accessKey := os.Getenv("AWS_ACCESS_KEY")
25
+ if accessKey == "" {
26
+ accessKey = os.Getenv("AWS_ACCESS_KEY_ID")
27
+ if accessKey == "" {
28
+ t.Skip("skipping, AWS_ACCESS_KEY or AWS_ACCESS_KEY_ID environment variable not present")
29
+ }
30
+ }
31
+ secretKey := os.Getenv("AWS_SECRET_KEY")
32
+ if secretKey == "" {
33
+ secretKey = os.Getenv("AWS_SECRET_ACCESS_KEY")
34
+ if secretKey == "" {
35
+ t.Skip("skipping, AWS_SECRET_KEY or AWS_SECRET_ACCESS_KEY environment variable not present")
36
+ }
37
+ }
38
+ sessionToken := os.Getenv("AWS_SESSION_TOKEN")
39
+ if sessionToken == "" {
40
+ t.Skip("skipping, AWS_SESSION_TOKEN environment variable not present")
41
+ }
42
+ region := os.Getenv("AWS_REGION")
43
+ if region == "" {
44
+ t.Skip("skipping, AWS_REGION environment variable not present")
45
+ }
46
+ ctx := context.Background()
47
+ compose, err := createSingleNodeEnvironment(ctx, accessKey, secretKey, sessionToken)
48
+ require.NoError(t, err)
49
+ defer func() {
50
+ require.NoError(t, compose.Terminate(ctx))
51
+ }()
52
+ rest := compose.GetWeaviate().URI()
53
+ grpc := compose.GetWeaviate().GrpcURI()
54
+
55
+ t.Run("tests", testText2VecAWS(rest, grpc, region))
56
+ }
57
+
58
+ func createSingleNodeEnvironment(ctx context.Context, accessKey, secretKey, sessionToken string,
59
+ ) (compose *docker.DockerCompose, err error) {
60
+ compose, err = composeModules(accessKey, secretKey, sessionToken).
61
+ WithWeaviate().
62
+ WithWeaviateWithGRPC().
63
+ Start(ctx)
64
+ return
65
+ }
66
+
67
+ func composeModules(accessKey, secretKey, sessionToken string) (composeModules *docker.Compose) {
68
+ composeModules = docker.New().
69
+ WithText2VecAWS(accessKey, secretKey, sessionToken)
70
+ return
71
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-aws/text2vec_aws_test.go ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "testing"
16
+
17
+ "github.com/stretchr/testify/assert"
18
+ "github.com/stretchr/testify/require"
19
+ "github.com/weaviate/weaviate/entities/models"
20
+ "github.com/weaviate/weaviate/test/helper"
21
+ "github.com/weaviate/weaviate/test/helper/sample-schema/companies"
22
+ )
23
+
24
+ func testText2VecAWS(rest, grpc, region string) func(t *testing.T) {
25
+ return func(t *testing.T) {
26
+ helper.SetupClient(rest)
27
+ // Data
28
+ data := companies.Companies
29
+ className := "VectorizerTest"
30
+ class := companies.BaseClass(className)
31
+ tests := []struct {
32
+ name string
33
+ model string
34
+ }{
35
+ {
36
+ name: "amazon.titan-embed-text-v1",
37
+ model: "amazon.titan-embed-text-v1",
38
+ },
39
+ {
40
+ name: "amazon.titan-embed-text-v2:0",
41
+ model: "amazon.titan-embed-text-v2:0",
42
+ },
43
+ {
44
+ name: "cohere.embed-english-v3",
45
+ model: "cohere.embed-english-v3",
46
+ },
47
+ {
48
+ name: "cohere.embed-multilingual-v3",
49
+ model: "cohere.embed-multilingual-v3",
50
+ },
51
+ }
52
+ for _, tt := range tests {
53
+ t.Run(tt.name, func(t *testing.T) {
54
+ // Define class
55
+ class.VectorConfig = map[string]models.VectorConfig{
56
+ "description": {
57
+ Vectorizer: map[string]interface{}{
58
+ "text2vec-aws": map[string]interface{}{
59
+ "properties": []interface{}{"description"},
60
+ "vectorizeClassName": false,
61
+ "service": "bedrock",
62
+ "region": region,
63
+ "model": tt.model,
64
+ },
65
+ },
66
+ VectorIndexType: "flat",
67
+ },
68
+ }
69
+ // create schema
70
+ helper.CreateClass(t, class)
71
+ defer helper.DeleteClass(t, class.Class)
72
+ // create objects
73
+ t.Run("create objects", func(t *testing.T) {
74
+ companies.InsertObjects(t, rest, class.Class)
75
+ })
76
+ t.Run("check objects existence", func(t *testing.T) {
77
+ for _, company := range data {
78
+ t.Run(company.ID.String(), func(t *testing.T) {
79
+ obj, err := helper.GetObject(t, class.Class, company.ID, "vector")
80
+ require.NoError(t, err)
81
+ require.NotNil(t, obj)
82
+ require.Len(t, obj.Vectors, 1)
83
+ require.IsType(t, []float32{}, obj.Vectors["description"])
84
+ assert.True(t, len(obj.Vectors["description"].([]float32)) > 0)
85
+ })
86
+ }
87
+ })
88
+ t.Run("search tests", func(t *testing.T) {
89
+ companies.PerformAllSearchTests(t, rest, grpc, class.Class)
90
+ })
91
+ })
92
+ }
93
+ }
94
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-contextionary/cluster_nodes_api_test.go ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package test
13
+
14
+ import (
15
+ "fmt"
16
+ "os"
17
+ "testing"
18
+
19
+ "github.com/stretchr/testify/assert"
20
+ "github.com/stretchr/testify/require"
21
+ "github.com/weaviate/weaviate/client/nodes"
22
+ "github.com/weaviate/weaviate/entities/models"
23
+ "github.com/weaviate/weaviate/entities/verbosity"
24
+ "github.com/weaviate/weaviate/test/helper"
25
+ "github.com/weaviate/weaviate/test/helper/sample-schema/books"
26
+ "github.com/weaviate/weaviate/test/helper/sample-schema/multishard"
27
+ )
28
+
29
+ func Test_WeaviateCluster_NodesAPI(t *testing.T) {
30
+ helper.SetupClient(os.Getenv(weaviateNode1Endpoint))
31
+ booksClass := books.ClassContextionaryVectorizer()
32
+ multiShardClass := multishard.ClassContextionaryVectorizer()
33
+ // we override multishard.ShardingConfig to make sure it matches nodes count
34
+ // and exists in every node
35
+ multiShardClass.ShardingConfig = map[string]interface{}{
36
+ "actualCount": float64(3),
37
+ "actualVirtualCount": float64(128),
38
+ "desiredCount": float64(3),
39
+ "desiredVirtualCount": float64(128),
40
+ "function": "murmur3",
41
+ "key": "_id",
42
+ "strategy": "hash",
43
+ "virtualPerPhysical": float64(128),
44
+ }
45
+
46
+ helper.CreateClass(t, booksClass)
47
+ helper.CreateClass(t, multiShardClass)
48
+ defer helper.DeleteClass(t, booksClass.Class)
49
+ defer helper.DeleteClass(t, multiShardClass.Class)
50
+
51
+ t.Run("import data", func(t *testing.T) {
52
+ for _, book := range books.Objects() {
53
+ helper.CreateObject(t, book)
54
+ helper.AssertGetObjectEventually(t, book.Class, book.ID)
55
+ }
56
+ for _, multishard := range multishard.Objects() {
57
+ helper.CreateObject(t, multishard)
58
+ helper.AssertGetObjectEventually(t, multishard.Class, multishard.ID)
59
+ }
60
+ })
61
+
62
+ t.Run("check nodes api", func(t *testing.T) {
63
+ for _, endpoint := range []string{weaviateNode1Endpoint, weaviateNode2Endpoint, weaviateNode3Endpoint} {
64
+ t.Run(endpoint, func(t *testing.T) {
65
+ helper.SetupClient(os.Getenv(endpoint))
66
+ verbose := verbosity.OutputVerbose
67
+ params := nodes.NewNodesGetParams().WithOutput(&verbose)
68
+ resp, err := helper.Client(t).Nodes.NodesGet(params, nil)
69
+ require.Nil(t, err)
70
+
71
+ nodeStatusResp := resp.GetPayload()
72
+ require.NotNil(t, nodeStatusResp)
73
+
74
+ nodes := nodeStatusResp.Nodes
75
+ require.NotNil(t, nodes)
76
+ require.Len(t, nodes, 3)
77
+
78
+ assert.Equal(t, "node1", nodes[0].Name)
79
+ assert.Equal(t, "node2", nodes[1].Name)
80
+ assert.Equal(t, "node3", nodes[2].Name)
81
+
82
+ for i, nodeStatus := range nodes {
83
+ require.NotNil(t, nodeStatus)
84
+ assert.Equal(t, models.NodeStatusStatusHEALTHY, *nodeStatus.Status)
85
+ assert.Equal(t, fmt.Sprintf("node%d", i+1), nodeStatus.Name)
86
+ assert.True(t, nodeStatus.GitHash != "" && nodeStatus.GitHash != "unknown")
87
+ assert.Len(t, nodeStatus.Shards, 2)
88
+ var objectCount int64
89
+ var shardCount int64
90
+ for _, shard := range nodeStatus.Shards {
91
+ assert.True(t, len(shard.Name) > 0)
92
+ assert.True(t, shard.Class == multiShardClass.Class || shard.Class == booksClass.Class)
93
+ assert.GreaterOrEqual(t, shard.ObjectCount, int64(0))
94
+ assert.GreaterOrEqual(t, shard.VectorQueueLength, int64(0))
95
+ objectCount += shard.ObjectCount
96
+ shardCount++
97
+ }
98
+ require.NotNil(t, nodeStatus.Stats)
99
+ assert.Equal(t, objectCount, nodeStatus.Stats.ObjectCount)
100
+ assert.Equal(t, shardCount, nodeStatus.Stats.ShardCount)
101
+ }
102
+ })
103
+ }
104
+ })
105
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-contextionary/group_by_cluster_test.go ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package test
13
+
14
+ import (
15
+ "os"
16
+ "testing"
17
+
18
+ "github.com/weaviate/weaviate/test/helper/journey"
19
+ )
20
+
21
+ func Test_WeaviateCluster_GroupBy(t *testing.T) {
22
+ t.Run("multi node", func(t *testing.T) {
23
+ journey.GroupBySingleAndMultiShardTests(t, os.Getenv(weaviateNode1Endpoint))
24
+ })
25
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-contextionary/near_text_test.go ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package test
13
+
14
+ import (
15
+ "os"
16
+ "reflect"
17
+ "testing"
18
+
19
+ "github.com/weaviate/weaviate/test/helper"
20
+ graphqlhelper "github.com/weaviate/weaviate/test/helper/graphql"
21
+ "github.com/weaviate/weaviate/test/helper/sample-schema/books"
22
+ "github.com/weaviate/weaviate/test/helper/sample-schema/multishard"
23
+ )
24
+
25
+ func Test_Text2Vec_NearText(t *testing.T) {
26
+ helper.SetupClient(os.Getenv(weaviateNode1Endpoint))
27
+ booksClass := books.ClassContextionaryVectorizer()
28
+ multiShardClass := multishard.ClassContextionaryVectorizer()
29
+ helper.CreateClass(t, booksClass)
30
+ helper.CreateClass(t, multiShardClass)
31
+ defer helper.DeleteClass(t, booksClass.Class)
32
+ defer helper.DeleteClass(t, multiShardClass.Class)
33
+
34
+ t.Run("import data", func(t *testing.T) {
35
+ for _, book := range books.Objects() {
36
+ helper.CreateObject(t, book)
37
+ helper.AssertGetObjectEventually(t, book.Class, book.ID)
38
+ }
39
+ for _, multi := range multishard.Objects() {
40
+ helper.CreateObject(t, multi)
41
+ helper.AssertGetObjectEventually(t, multi.Class, multi.ID)
42
+ }
43
+ })
44
+
45
+ t.Run("nearText with sorting, asc", func(t *testing.T) {
46
+ query := `
47
+ {
48
+ Get {
49
+ Books(
50
+ nearText: {concepts: ["novel"]}
51
+ sort: [{path: ["title"], order: asc}]
52
+ ) {
53
+ title
54
+ }
55
+ }
56
+ }`
57
+
58
+ expected := []interface{}{
59
+ map[string]interface{}{"title": "Dune"},
60
+ map[string]interface{}{"title": "Project Hail Mary"},
61
+ map[string]interface{}{"title": "The Lord of the Ice Garden"},
62
+ }
63
+ result := graphqlhelper.AssertGraphQL(t, helper.RootAuth, query)
64
+ received := result.Get("Get", "Books").AsSlice()
65
+ if !reflect.DeepEqual(expected, received) {
66
+ t.Errorf("sort objects expected = %v, received %v", expected, received)
67
+ }
68
+ })
69
+
70
+ t.Run("nearText with sorting, desc", func(t *testing.T) {
71
+ query := `
72
+ {
73
+ Get {
74
+ Books(
75
+ nearText: {concepts: ["novel"]}
76
+ sort: [{path: ["title"], order: desc}]
77
+ ) {
78
+ title
79
+ }
80
+ }
81
+ }`
82
+
83
+ expected := []interface{}{
84
+ map[string]interface{}{"title": "The Lord of the Ice Garden"},
85
+ map[string]interface{}{"title": "Project Hail Mary"},
86
+ map[string]interface{}{"title": "Dune"},
87
+ }
88
+ result := graphqlhelper.AssertGraphQL(t, helper.RootAuth, query)
89
+ received := result.Get("Get", "Books").AsSlice()
90
+ if !reflect.DeepEqual(expected, received) {
91
+ t.Errorf("sort objects expected = %v, received %v", expected, received)
92
+ }
93
+ })
94
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-contextionary/setup_test.go ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package test
13
+
14
+ import (
15
+ "context"
16
+ "os"
17
+ "testing"
18
+
19
+ "github.com/pkg/errors"
20
+ "github.com/weaviate/weaviate/test/docker"
21
+ )
22
+
23
+ const (
24
+ weaviateNode1Endpoint = "WEAVIATE1_ENDPOINT"
25
+ weaviateNode2Endpoint = "WEAVIATE2_ENDPOINT"
26
+ weaviateNode3Endpoint = "WEAVIATE3_ENDPOINT"
27
+ )
28
+
29
+ func TestMain(m *testing.M) {
30
+ ctx := context.Background()
31
+ compose, err := docker.New().
32
+ WithWeaviateCluster(3).WithText2VecContextionary().
33
+ Start(ctx)
34
+ if err != nil {
35
+ panic(errors.Wrapf(err, "cannot start"))
36
+ }
37
+
38
+ os.Setenv(weaviateNode1Endpoint, compose.GetWeaviate().URI())
39
+ os.Setenv(weaviateNode2Endpoint, compose.GetWeaviateNode2().URI())
40
+ os.Setenv(weaviateNode3Endpoint, compose.GetWeaviateNode3().URI())
41
+ code := m.Run()
42
+
43
+ if err := compose.Terminate(ctx); err != nil {
44
+ panic(errors.Wrapf(err, "cannot terminate"))
45
+ }
46
+
47
+ os.Exit(code)
48
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-google/setup_test.go ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "context"
16
+ "os"
17
+ "testing"
18
+
19
+ "github.com/stretchr/testify/require"
20
+ "github.com/weaviate/weaviate/test/docker"
21
+ )
22
+
23
+ func TestText2VecGoogle_VertexAI_SingleNode(t *testing.T) {
24
+ gcpProject := os.Getenv("GCP_PROJECT")
25
+ if gcpProject == "" {
26
+ t.Skip("skipping, GCP_PROJECT environment variable not present")
27
+ }
28
+ googleApiKey := os.Getenv("GOOGLE_APIKEY")
29
+ if googleApiKey == "" {
30
+ t.Skip("skipping, GOOGLE_APIKEY environment variable not present")
31
+ }
32
+ ctx := context.Background()
33
+ compose, err := createSingleNodeEnvironment(ctx, googleApiKey)
34
+ require.NoError(t, err)
35
+ defer func() {
36
+ require.NoError(t, compose.Terminate(ctx))
37
+ }()
38
+ rest := compose.GetWeaviate().URI()
39
+ grpc := compose.GetWeaviate().GrpcURI()
40
+
41
+ t.Run("text2vec-google", testText2VecGoogle(rest, grpc, gcpProject, "text2vec-google"))
42
+ t.Run("text2vec-palm", testText2VecGoogle(rest, grpc, gcpProject, "text2vec-palm"))
43
+ }
44
+
45
+ func createSingleNodeEnvironment(ctx context.Context, googleApiKey string,
46
+ ) (compose *docker.DockerCompose, err error) {
47
+ compose, err = composeModules(googleApiKey).
48
+ WithWeaviate().
49
+ WithWeaviateWithGRPC().
50
+ Start(ctx)
51
+ return
52
+ }
53
+
54
+ func composeModules(googleApiKey string) (composeModules *docker.Compose) {
55
+ composeModules = docker.New().
56
+ WithText2VecGoogle(googleApiKey).
57
+ WithGenerativeGoogle(googleApiKey)
58
+ return
59
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-google/text2vec_google_test.go ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "testing"
16
+
17
+ "github.com/stretchr/testify/assert"
18
+ "github.com/stretchr/testify/require"
19
+ "github.com/weaviate/weaviate/entities/models"
20
+ "github.com/weaviate/weaviate/test/helper"
21
+ "github.com/weaviate/weaviate/test/helper/sample-schema/companies"
22
+ )
23
+
24
+ func testText2VecGoogle(rest, grpc, gcpProject, vectorizerName string) func(t *testing.T) {
25
+ return func(t *testing.T) {
26
+ helper.SetupClient(rest)
27
+ // Data
28
+ dimensions1024 := 1024
29
+ data := companies.Companies
30
+ className := "VectorizerTest"
31
+ class := companies.BaseClass(className)
32
+ tests := []struct {
33
+ name string
34
+ model string
35
+ dimensions *int
36
+ taskType string
37
+ }{
38
+ {
39
+ name: "textembedding-gecko@latest",
40
+ model: "textembedding-gecko@latest",
41
+ },
42
+ {
43
+ name: "textembedding-gecko-multilingual@latest",
44
+ model: "textembedding-gecko-multilingual@latest",
45
+ },
46
+ {
47
+ name: "text-embedding-005",
48
+ model: "text-embedding-005",
49
+ },
50
+ {
51
+ name: "text-multilingual-embedding-002",
52
+ model: "text-multilingual-embedding-002",
53
+ },
54
+ {
55
+ name: "gemini-embedding-001",
56
+ model: "gemini-embedding-001",
57
+ },
58
+ {
59
+ name: "gemini-embedding-001 with 1024 dimensions",
60
+ model: "gemini-embedding-001",
61
+ dimensions: &dimensions1024,
62
+ },
63
+ {
64
+ name: "text-embedding-005 with FACT_VERIFICATION taskType",
65
+ model: "text-embedding-005",
66
+ taskType: "FACT_VERIFICATION",
67
+ },
68
+ }
69
+ for _, tt := range tests {
70
+ t.Run(tt.name, func(t *testing.T) {
71
+ // Define class
72
+ vectorizerSettings := map[string]any{
73
+ "properties": []any{"description"},
74
+ "vectorizeClassName": false,
75
+ "projectId": gcpProject,
76
+ "modelId": tt.model,
77
+ }
78
+ if tt.dimensions != nil {
79
+ vectorizerSettings["dimensions"] = *tt.dimensions
80
+ }
81
+ if tt.taskType != "" {
82
+ vectorizerSettings["taskType"] = tt.taskType
83
+ }
84
+ class.VectorConfig = map[string]models.VectorConfig{
85
+ "description": {
86
+ Vectorizer: map[string]any{
87
+ vectorizerName: vectorizerSettings,
88
+ },
89
+ VectorIndexType: "flat",
90
+ },
91
+ }
92
+ // create schema
93
+ helper.CreateClass(t, class)
94
+ defer helper.DeleteClass(t, class.Class)
95
+ // create objects
96
+ t.Run("create objects", func(t *testing.T) {
97
+ companies.InsertObjects(t, rest, class.Class)
98
+ })
99
+ t.Run("check objects existence", func(t *testing.T) {
100
+ for _, company := range data {
101
+ t.Run(company.ID.String(), func(t *testing.T) {
102
+ obj, err := helper.GetObject(t, class.Class, company.ID, "vector")
103
+ require.NoError(t, err)
104
+ require.NotNil(t, obj)
105
+ require.Len(t, obj.Vectors, 1)
106
+ require.IsType(t, []float32{}, obj.Vectors["description"])
107
+ assert.True(t, len(obj.Vectors["description"].([]float32)) > 0)
108
+ if tt.dimensions != nil {
109
+ assert.Equal(t, *tt.dimensions, len(obj.Vectors["description"].([]float32)))
110
+ }
111
+ })
112
+ }
113
+ })
114
+ t.Run("search tests", func(t *testing.T) {
115
+ companies.PerformAllSearchTests(t, rest, grpc, class.Class)
116
+ })
117
+ })
118
+ }
119
+ }
120
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-huggingface/setup_test.go ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "context"
16
+ "os"
17
+ "testing"
18
+
19
+ "github.com/stretchr/testify/require"
20
+ "github.com/weaviate/weaviate/test/docker"
21
+ )
22
+
23
+ func TestText2VecHuggingFace(t *testing.T) {
24
+ apiKey := os.Getenv("HUGGINGFACE_APIKEY")
25
+ if apiKey == "" {
26
+ t.Skip("skipping, HUGGINGFACE_APIKEY environment variable not present")
27
+ }
28
+ ctx := context.Background()
29
+ compose, err := createSingleNodeEnvironment(ctx, apiKey)
30
+ require.NoError(t, err)
31
+ defer func() {
32
+ require.NoError(t, compose.Terminate(ctx))
33
+ }()
34
+ endpoint := compose.GetWeaviate().URI()
35
+
36
+ t.Run("tests", testText2VecHuggingFace(endpoint))
37
+ }
38
+
39
+ func createSingleNodeEnvironment(ctx context.Context, apiKey string,
40
+ ) (compose *docker.DockerCompose, err error) {
41
+ compose, err = composeModules(apiKey).
42
+ WithWeaviate().
43
+ Start(ctx)
44
+ return
45
+ }
46
+
47
+ func composeModules(apiKey string) (composeModules *docker.Compose) {
48
+ composeModules = docker.New().
49
+ WithText2VecHuggingFace(apiKey)
50
+ return
51
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-huggingface/text2vec_huggingface_test.go ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "testing"
16
+
17
+ "github.com/stretchr/testify/require"
18
+ "github.com/weaviate/weaviate/entities/models"
19
+ "github.com/weaviate/weaviate/test/helper"
20
+ "github.com/weaviate/weaviate/test/helper/sample-schema/companies"
21
+ )
22
+
23
+ func testText2VecHuggingFace(host string) func(t *testing.T) {
24
+ return func(t *testing.T) {
25
+ helper.SetupClient(host)
26
+ // Data
27
+ className := "BooksGenerativeTest"
28
+ data := companies.Companies
29
+ class := companies.BaseClass(className)
30
+ tests := []struct {
31
+ name string
32
+ model string
33
+ }{
34
+ {
35
+ name: "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2",
36
+ model: "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2",
37
+ },
38
+ }
39
+ for _, tt := range tests {
40
+ t.Run(tt.name, func(t *testing.T) {
41
+ // Define class
42
+ class.VectorConfig = map[string]models.VectorConfig{
43
+ "description": {
44
+ Vectorizer: map[string]interface{}{
45
+ "text2vec-huggingface": map[string]interface{}{
46
+ "properties": []interface{}{"description"},
47
+ "vectorizeClassName": false,
48
+ "model": tt.model,
49
+ "options": map[string]interface{}{
50
+ "waitForModel": true,
51
+ "useGPU": false,
52
+ "useCache": true,
53
+ },
54
+ },
55
+ },
56
+ VectorIndexType: "flat",
57
+ },
58
+ }
59
+ // create schema
60
+ helper.CreateClass(t, class)
61
+ defer helper.DeleteClass(t, class.Class)
62
+ // create objects
63
+ t.Run("create objects", func(t *testing.T) {
64
+ companies.InsertObjects(t, host, class.Class)
65
+ })
66
+ t.Run("check objects existence", func(t *testing.T) {
67
+ for _, company := range data {
68
+ t.Run(company.ID.String(), func(t *testing.T) {
69
+ obj, err := helper.GetObject(t, class.Class, company.ID, "vector")
70
+ require.NoError(t, err)
71
+ require.NotNil(t, obj)
72
+ require.Len(t, obj.Vectors, 1)
73
+ require.NotEmpty(t, obj.Vectors["description"])
74
+ })
75
+ }
76
+ })
77
+ // vector search
78
+ t.Run("perform vector search", func(t *testing.T) {
79
+ companies.PerformVectorSearchTest(t, host, class.Class)
80
+ })
81
+ // hybird search
82
+ t.Run("perform hybrid search", func(t *testing.T) {
83
+ companies.PerformHybridSearchTest(t, host, class.Class)
84
+ })
85
+ })
86
+ }
87
+ }
88
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-jinaai/setup_test.go ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "context"
16
+ "fmt"
17
+ "os"
18
+ "testing"
19
+
20
+ "github.com/stretchr/testify/require"
21
+ "github.com/weaviate/weaviate/test/docker"
22
+ "github.com/weaviate/weaviate/test/helper/sample-schema/companies"
23
+ )
24
+
25
+ func TestText2VecJinaAI(t *testing.T) {
26
+ jinaApiKey := os.Getenv("JINAAI_APIKEY")
27
+ if jinaApiKey == "" {
28
+ t.Skip("skipping, JINAAI_APIKEY environment variable not present")
29
+ }
30
+ ctx := context.Background()
31
+ compose, err := createSingleNodeEnvironment(ctx, jinaApiKey)
32
+ require.NoError(t, err)
33
+ defer func() {
34
+ require.NoError(t, compose.Terminate(ctx))
35
+ }()
36
+ rest := compose.GetWeaviate().URI()
37
+ grpc := compose.GetWeaviate().GrpcURI()
38
+
39
+ t.Run("tests", testText2VecJinaAI(rest, grpc))
40
+ }
41
+
42
+ func createSingleNodeEnvironment(ctx context.Context, jinaApiKey string,
43
+ ) (compose *docker.DockerCompose, err error) {
44
+ compose, err = composeModules(jinaApiKey).
45
+ WithWeaviate().
46
+ WithWeaviateWithGRPC().
47
+ WithWeaviateEnv("MODULES_CLIENT_TIMEOUT", fmt.Sprintf("%.0fs", companies.DefaultTimeout.Seconds())).
48
+ Start(ctx)
49
+ return
50
+ }
51
+
52
+ func composeModules(jinaApiKey string) (composeModules *docker.Compose) {
53
+ composeModules = docker.New().
54
+ WithText2VecJinaAI(jinaApiKey)
55
+ return
56
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-jinaai/text2vec_jinaai_test.go ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "testing"
16
+
17
+ "github.com/stretchr/testify/assert"
18
+ "github.com/stretchr/testify/require"
19
+ "github.com/weaviate/weaviate/entities/models"
20
+ "github.com/weaviate/weaviate/test/helper"
21
+ "github.com/weaviate/weaviate/test/helper/sample-schema/companies"
22
+ )
23
+
24
+ func testText2VecJinaAI(rest, grpc string) func(t *testing.T) {
25
+ return func(t *testing.T) {
26
+ helper.SetupClient(rest)
27
+ // Data
28
+ className := "BooksGenerativeTest"
29
+ data := companies.Companies
30
+ class := companies.BaseClass(className)
31
+ tests := []struct {
32
+ name string
33
+ model string
34
+ dimensions int
35
+ }{
36
+ {
37
+ name: "jina-embeddings-v2-base-en",
38
+ model: "jina-embeddings-v2-base-en",
39
+ },
40
+ {
41
+ name: "jina-embeddings-v3",
42
+ model: "jina-embeddings-v3",
43
+ dimensions: 64,
44
+ },
45
+ {
46
+ name: "jina-embeddings-v4",
47
+ model: "jina-embeddings-v4",
48
+ },
49
+ {
50
+ name: "default settings",
51
+ },
52
+ }
53
+ for _, tt := range tests {
54
+ t.Run(tt.name, func(t *testing.T) {
55
+ // Define module settings
56
+ settings := map[string]interface{}{
57
+ "properties": []interface{}{"description"},
58
+ "vectorizeClassName": false,
59
+ }
60
+ if tt.model != "" {
61
+ settings["model"] = tt.model
62
+ }
63
+ if tt.dimensions > 0 {
64
+ settings["dimensions"] = tt.dimensions
65
+ }
66
+ // Define class
67
+ class.VectorConfig = map[string]models.VectorConfig{
68
+ "description": {
69
+ Vectorizer: map[string]interface{}{
70
+ "text2vec-jinaai": settings,
71
+ },
72
+ VectorIndexType: "flat",
73
+ },
74
+ }
75
+ // create schema
76
+ helper.CreateClass(t, class)
77
+ defer helper.DeleteClass(t, class.Class)
78
+ // create objects
79
+ t.Run("create objects", func(t *testing.T) {
80
+ companies.InsertObjects(t, rest, class.Class)
81
+ })
82
+ t.Run("check objects existence", func(t *testing.T) {
83
+ for _, company := range data {
84
+ t.Run(company.ID.String(), func(t *testing.T) {
85
+ obj, err := helper.GetObject(t, class.Class, company.ID, "vector")
86
+ require.NoError(t, err)
87
+ require.NotNil(t, obj)
88
+ require.Len(t, obj.Vectors, 1)
89
+ require.IsType(t, []float32{}, obj.Vectors["description"])
90
+ assert.True(t, len(obj.Vectors["description"].([]float32)) > 0)
91
+ })
92
+ }
93
+ })
94
+ t.Run("search tests", func(t *testing.T) {
95
+ companies.PerformAllSearchTests(t, rest, grpc, class.Class)
96
+ })
97
+ })
98
+ }
99
+ }
100
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-mistral/setup_test.go ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "context"
16
+ "os"
17
+ "testing"
18
+
19
+ "github.com/stretchr/testify/require"
20
+ "github.com/weaviate/weaviate/test/docker"
21
+ )
22
+
23
+ func TestText2VecMistral(t *testing.T) {
24
+ apiKey := os.Getenv("MISTRAL_APIKEY")
25
+ if apiKey == "" {
26
+ t.Skip("skipping, MISTRAL_APIKEY environment variable not present")
27
+ }
28
+ ctx := context.Background()
29
+ compose, err := createSingleNodeEnvironment(ctx, apiKey)
30
+ require.NoError(t, err)
31
+ defer func() {
32
+ require.NoError(t, compose.Terminate(ctx))
33
+ }()
34
+ endpoint := compose.GetWeaviate().URI()
35
+
36
+ t.Run("tests", testText2VecMistral(endpoint))
37
+ }
38
+
39
+ func createSingleNodeEnvironment(ctx context.Context, apiKey string,
40
+ ) (compose *docker.DockerCompose, err error) {
41
+ compose, err = composeModules(apiKey).
42
+ WithWeaviate().
43
+ Start(ctx)
44
+ return
45
+ }
46
+
47
+ func composeModules(apiKey string) (composeModules *docker.Compose) {
48
+ composeModules = docker.New().
49
+ WithText2VecMistral(apiKey)
50
+ return
51
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-mistral/text2vec_mistral_test.go ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "testing"
16
+
17
+ "github.com/stretchr/testify/require"
18
+ "github.com/weaviate/weaviate/entities/models"
19
+ "github.com/weaviate/weaviate/test/helper"
20
+ "github.com/weaviate/weaviate/test/helper/sample-schema/companies"
21
+ )
22
+
23
+ func testText2VecMistral(host string) func(t *testing.T) {
24
+ return func(t *testing.T) {
25
+ helper.SetupClient(host)
26
+ // Data
27
+ className := "BooksGenerativeTest"
28
+ data := companies.Companies
29
+ class := companies.BaseClass(className)
30
+ tests := []struct {
31
+ name string
32
+ model string
33
+ }{
34
+ {
35
+ name: "mistral-embed",
36
+ model: "mistral-embed",
37
+ },
38
+ }
39
+ for _, tt := range tests {
40
+ t.Run(tt.name, func(t *testing.T) {
41
+ // Define class
42
+ class.VectorConfig = map[string]models.VectorConfig{
43
+ "description": {
44
+ Vectorizer: map[string]interface{}{
45
+ "text2vec-mistral": map[string]interface{}{
46
+ "properties": []interface{}{"description"},
47
+ "vectorizeClassName": false,
48
+ "model": tt.model,
49
+ },
50
+ },
51
+ VectorIndexType: "flat",
52
+ },
53
+ }
54
+ // create schema
55
+ helper.CreateClass(t, class)
56
+ defer helper.DeleteClass(t, class.Class)
57
+ // create objects
58
+ t.Run("create objects", func(t *testing.T) {
59
+ companies.InsertObjects(t, host, class.Class)
60
+ })
61
+ t.Run("check objects existence", func(t *testing.T) {
62
+ for _, company := range data {
63
+ t.Run(company.ID.String(), func(t *testing.T) {
64
+ obj, err := helper.GetObject(t, class.Class, company.ID, "vector")
65
+ require.NoError(t, err)
66
+ require.NotNil(t, obj)
67
+ require.Len(t, obj.Vectors, 1)
68
+ require.NotEmpty(t, obj.Vectors["description"])
69
+ })
70
+ }
71
+ })
72
+ // vector search
73
+ t.Run("perform vector search", func(t *testing.T) {
74
+ companies.PerformVectorSearchTest(t, host, class.Class)
75
+ })
76
+ // hybird search
77
+ t.Run("perform hybrid search", func(t *testing.T) {
78
+ companies.PerformHybridSearchTest(t, host, class.Class)
79
+ })
80
+ })
81
+ }
82
+ }
83
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-model2vec/setup_test.go ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "context"
16
+ "testing"
17
+
18
+ "github.com/stretchr/testify/require"
19
+ "github.com/weaviate/weaviate/test/docker"
20
+ )
21
+
22
+ func TestText2VecModel2Vec(t *testing.T) {
23
+ ctx := context.Background()
24
+ compose, err := createSingleNodeEnvironment(ctx)
25
+ require.NoError(t, err)
26
+ defer func() {
27
+ require.NoError(t, compose.Terminate(ctx))
28
+ }()
29
+ endpoint := compose.GetWeaviate().URI()
30
+
31
+ t.Run("tests", testText2VecModel2Vec(endpoint))
32
+ }
33
+
34
+ func createSingleNodeEnvironment(ctx context.Context,
35
+ ) (compose *docker.DockerCompose, err error) {
36
+ compose, err = docker.New().
37
+ WithText2VecModel2Vec().
38
+ WithWeaviate().
39
+ Start(ctx)
40
+ return
41
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-model2vec/text2vec_model2vec_test.go ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "testing"
16
+
17
+ "github.com/stretchr/testify/assert"
18
+ "github.com/stretchr/testify/require"
19
+ "github.com/weaviate/weaviate/entities/models"
20
+ "github.com/weaviate/weaviate/test/helper"
21
+ "github.com/weaviate/weaviate/test/helper/sample-schema/companies"
22
+ )
23
+
24
+ func testText2VecModel2Vec(host string) func(t *testing.T) {
25
+ return func(t *testing.T) {
26
+ helper.SetupClient(host)
27
+ // Data
28
+ className := "BooksGenerativeTest"
29
+ data := companies.Companies
30
+ class := companies.BaseClass(className)
31
+ tests := []struct {
32
+ name string
33
+ insertNonVocabularWords bool
34
+ }{
35
+ {
36
+ name: "default",
37
+ },
38
+ {
39
+ name: "vectorize non-vocabular words",
40
+ insertNonVocabularWords: true,
41
+ },
42
+ }
43
+ for _, tt := range tests {
44
+ t.Run(tt.name, func(t *testing.T) {
45
+ // Define class
46
+ class.VectorConfig = map[string]models.VectorConfig{
47
+ "description": {
48
+ Vectorizer: map[string]any{
49
+ "text2vec-model2vec": map[string]any{
50
+ "properties": []any{"description"},
51
+ },
52
+ },
53
+ VectorIndexType: "flat",
54
+ },
55
+ }
56
+ // create schema
57
+ helper.CreateClass(t, class)
58
+ defer helper.DeleteClass(t, class.Class)
59
+ // create objects
60
+ t.Run("create objects", func(t *testing.T) {
61
+ companies.InsertObjects(t, host, class.Class)
62
+ })
63
+ t.Run("check objects existence", func(t *testing.T) {
64
+ for _, company := range data {
65
+ t.Run(company.ID.String(), func(t *testing.T) {
66
+ obj, err := helper.GetObject(t, class.Class, company.ID, "vector")
67
+ require.NoError(t, err)
68
+ require.NotNil(t, obj)
69
+ require.Len(t, obj.Vectors, 1)
70
+ })
71
+ }
72
+ })
73
+ // vector search
74
+ t.Run("perform vector search", func(t *testing.T) {
75
+ companies.PerformVectorSearchTest(t, host, class.Class)
76
+ })
77
+ // hybird search
78
+ t.Run("perform hybrid search", func(t *testing.T) {
79
+ companies.PerformHybridSearchTest(t, host, class.Class)
80
+ })
81
+ if tt.insertNonVocabularWords {
82
+ t.Run("query with non-vocabular words", func(t *testing.T) {
83
+ companies.PerformHybridSearchWithTextTest(t, host, class.Class, "no-vocabular text: **77aaee sss fb")
84
+ })
85
+ t.Run("insert objects with non-vocabular words", func(t *testing.T) {
86
+ obj := &models.Object{
87
+ Class: className,
88
+ ID: "00000000-0000-0000-0000-00000000000a",
89
+ Properties: map[string]interface{}{
90
+ "name": "non vocabular words",
91
+ "description": "words that are not in vocabulary: asdaddasd fjfjjgkk asda222ef (((sssss))) ko%$#$@@@@@@...",
92
+ },
93
+ }
94
+ helper.CreateObject(t, obj)
95
+ helper.AssertGetObjectEventually(t, obj.Class, obj.ID)
96
+
97
+ dbObject, err := helper.GetObject(t, class.Class, obj.ID, "vector")
98
+ require.NoError(t, err)
99
+ require.NotNil(t, dbObject)
100
+ require.Len(t, dbObject.Vectors, 1)
101
+ assert.True(t, len(dbObject.Vectors["description"].([]float32)) > 0)
102
+ })
103
+ }
104
+ })
105
+ }
106
+ }
107
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-nvidia/setup_test.go ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "context"
16
+ "os"
17
+ "testing"
18
+
19
+ "github.com/stretchr/testify/require"
20
+ "github.com/weaviate/weaviate/test/docker"
21
+ )
22
+
23
+ func TestText2VecNvidia(t *testing.T) {
24
+ apiKey := os.Getenv("NVIDIA_APIKEY")
25
+ if apiKey == "" {
26
+ t.Skip("skipping, NVIDIA_APIKEY environment variable not present")
27
+ }
28
+ ctx := context.Background()
29
+ compose, err := createSingleNodeEnvironment(ctx, apiKey)
30
+ require.NoError(t, err)
31
+ defer func() {
32
+ require.NoError(t, compose.Terminate(ctx))
33
+ }()
34
+ endpoint := compose.GetWeaviate().URI()
35
+
36
+ t.Run("tests", testText2VecNvidia(endpoint))
37
+ }
38
+
39
+ func createSingleNodeEnvironment(ctx context.Context, apiKey string,
40
+ ) (compose *docker.DockerCompose, err error) {
41
+ compose, err = composeModules(apiKey).
42
+ WithWeaviate().
43
+ Start(ctx)
44
+ return
45
+ }
46
+
47
+ func composeModules(apiKey string) (composeModules *docker.Compose) {
48
+ composeModules = docker.New().
49
+ WithText2VecNvidia(apiKey)
50
+ return
51
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-nvidia/text2vec_nvidia_test.go ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "testing"
16
+
17
+ "github.com/stretchr/testify/require"
18
+ "github.com/weaviate/weaviate/entities/models"
19
+ "github.com/weaviate/weaviate/test/helper"
20
+ "github.com/weaviate/weaviate/test/helper/sample-schema/companies"
21
+ )
22
+
23
+ func testText2VecNvidia(host string) func(t *testing.T) {
24
+ return func(t *testing.T) {
25
+ helper.SetupClient(host)
26
+ // Data
27
+ className := "BooksGenerativeTest"
28
+ data := companies.Companies
29
+ class := companies.BaseClass(className)
30
+ tests := []struct {
31
+ name string
32
+ model string
33
+ }{
34
+ {
35
+ name: "nvidia/nv-embed-v1",
36
+ model: "nvidia/nv-embed-v1",
37
+ },
38
+ {
39
+ name: "baai/bge-m3",
40
+ model: "baai/bge-m3",
41
+ },
42
+ {
43
+ name: "snowflake/arctic-embed-l",
44
+ model: "snowflake/arctic-embed-l",
45
+ },
46
+ }
47
+ for _, tt := range tests {
48
+ t.Run(tt.name, func(t *testing.T) {
49
+ // Define class
50
+ class.VectorConfig = map[string]models.VectorConfig{
51
+ "description": {
52
+ Vectorizer: map[string]interface{}{
53
+ "text2vec-nvidia": map[string]interface{}{
54
+ "properties": []interface{}{"description"},
55
+ "vectorizeClassName": false,
56
+ "model": tt.model,
57
+ },
58
+ },
59
+ VectorIndexType: "flat",
60
+ },
61
+ }
62
+ // create schema
63
+ helper.CreateClass(t, class)
64
+ defer helper.DeleteClass(t, class.Class)
65
+ // create objects
66
+ t.Run("create objects", func(t *testing.T) {
67
+ companies.InsertObjects(t, host, class.Class)
68
+ })
69
+ t.Run("check objects existence", func(t *testing.T) {
70
+ for _, company := range data {
71
+ t.Run(company.ID.String(), func(t *testing.T) {
72
+ obj, err := helper.GetObject(t, class.Class, company.ID, "vector")
73
+ require.NoError(t, err)
74
+ require.NotNil(t, obj)
75
+ require.Len(t, obj.Vectors, 1)
76
+ })
77
+ }
78
+ })
79
+ // vector search
80
+ t.Run("perform vector search", func(t *testing.T) {
81
+ companies.PerformVectorSearchTest(t, host, class.Class)
82
+ })
83
+ // hybird search
84
+ t.Run("perform hybrid search", func(t *testing.T) {
85
+ companies.PerformHybridSearchTest(t, host, class.Class)
86
+ })
87
+ })
88
+ }
89
+ }
90
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-ollama/ollama_vectorizer_test.go ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "encoding/json"
16
+ "fmt"
17
+ "testing"
18
+
19
+ "github.com/stretchr/testify/assert"
20
+ "github.com/stretchr/testify/require"
21
+ "github.com/weaviate/weaviate/entities/models"
22
+ "github.com/weaviate/weaviate/test/helper"
23
+ graphqlhelper "github.com/weaviate/weaviate/test/helper/graphql"
24
+ "github.com/weaviate/weaviate/test/helper/sample-schema/companies"
25
+ )
26
+
27
+ func testText2VecOllama(host, ollamaApiEndpoint string) func(t *testing.T) {
28
+ return func(t *testing.T) {
29
+ helper.SetupClient(host)
30
+ // companiesList data
31
+ className := "OllamaVectorizerTest"
32
+ companiesList := companies.Companies
33
+ class := companies.BaseClass(className)
34
+ // Define class
35
+ class.VectorConfig = map[string]models.VectorConfig{
36
+ "description": {
37
+ Vectorizer: map[string]interface{}{
38
+ "text2vec-ollama": map[string]interface{}{
39
+ "properties": []interface{}{"description"},
40
+ "vectorizeClassName": false,
41
+ "apiEndpoint": ollamaApiEndpoint,
42
+ "model": "nomic-embed-text",
43
+ },
44
+ },
45
+ VectorIndexType: "flat",
46
+ },
47
+ }
48
+ tests := []struct {
49
+ name string
50
+ useBatch bool
51
+ }{
52
+ {
53
+ name: "without batch", useBatch: false,
54
+ },
55
+ {
56
+ name: "with batch", useBatch: true,
57
+ },
58
+ }
59
+ for _, tt := range tests {
60
+ t.Run(tt.name, func(t *testing.T) {
61
+ // create schema
62
+ helper.CreateClass(t, class)
63
+ defer helper.DeleteClass(t, class.Class)
64
+ if tt.useBatch {
65
+ t.Run("batch create objects", func(t *testing.T) {
66
+ companies.BatchInsertObjects(t, host, class.Class)
67
+ })
68
+ } else {
69
+ t.Run("create objects", func(t *testing.T) {
70
+ companies.InsertObjects(t, host, class.Class)
71
+ })
72
+ }
73
+ t.Run("check objects existence", func(t *testing.T) {
74
+ for _, company := range companiesList {
75
+ t.Run(company.ID.String(), func(t *testing.T) {
76
+ obj, err := helper.GetObject(t, class.Class, company.ID, "vector")
77
+ require.NoError(t, err)
78
+ require.NotNil(t, obj)
79
+ require.Len(t, obj.Vectors, 1)
80
+ require.IsType(t, []float32{}, obj.Vectors["description"])
81
+ assert.True(t, len(obj.Vectors["description"].([]float32)) > 0)
82
+ })
83
+ }
84
+ })
85
+ t.Run("perform vector search", func(t *testing.T) {
86
+ companies.PerformVectorSearchTest(t, host, class.Class)
87
+ })
88
+ t.Run("perform hybrid search", func(t *testing.T) {
89
+ companies.PerformHybridSearchTest(t, host, class.Class)
90
+ })
91
+ t.Run("perform second vector search", func(t *testing.T) {
92
+ query := fmt.Sprintf(`
93
+ {
94
+ Get {
95
+ %s(
96
+ nearText:{
97
+ concepts: "Space flight"
98
+ }
99
+ ){
100
+ name
101
+ _additional {
102
+ id
103
+ certainty
104
+ }
105
+ }
106
+ }
107
+ }
108
+ `, class.Class)
109
+ result := graphqlhelper.AssertGraphQL(t, helper.RootAuth, query)
110
+ objs := result.Get("Get", class.Class).AsSlice()
111
+ require.Len(t, objs, 2)
112
+ for i, obj := range objs {
113
+ name := obj.(map[string]interface{})["name"]
114
+ assert.NotEmpty(t, name)
115
+ additional, ok := obj.(map[string]interface{})["_additional"].(map[string]interface{})
116
+ require.True(t, ok)
117
+ require.NotNil(t, additional)
118
+ id, ok := additional["id"].(string)
119
+ require.True(t, ok)
120
+ expectedID := companies.SpaceX.String()
121
+ if i > 0 {
122
+ expectedID = companies.OpenAI.String()
123
+ }
124
+ require.Equal(t, expectedID, id)
125
+ certainty := additional["certainty"].(json.Number)
126
+ assert.NotNil(t, certainty)
127
+ certaintyValue, err := certainty.Float64()
128
+ require.NoError(t, err)
129
+ assert.Greater(t, certaintyValue, 0.1)
130
+ }
131
+ })
132
+ })
133
+ }
134
+ }
135
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-ollama/setup_test.go ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "context"
16
+ "testing"
17
+
18
+ "github.com/stretchr/testify/require"
19
+ "github.com/weaviate/weaviate/test/docker"
20
+ )
21
+
22
+ func TestText2VecOllama_SingleNode(t *testing.T) {
23
+ ctx := context.Background()
24
+ compose, err := createSingleNodeEnvironment(ctx)
25
+ require.NoError(t, err)
26
+ defer func() {
27
+ require.NoError(t, compose.Terminate(ctx))
28
+ }()
29
+ endpoint := compose.GetWeaviate().URI()
30
+ ollamaApiEndpoint := compose.GetOllamaVectorizer().GetEndpoint("apiEndpoint")
31
+
32
+ t.Run("tests", testText2VecOllama(endpoint, ollamaApiEndpoint))
33
+ }
34
+
35
+ func TestText2VecOllama_Cluster(t *testing.T) {
36
+ ctx := context.Background()
37
+ compose, err := createClusterEnvironment(ctx)
38
+ require.NoError(t, err)
39
+ defer func() {
40
+ require.NoError(t, compose.Terminate(ctx))
41
+ }()
42
+ endpoint := compose.GetWeaviate().URI()
43
+ ollamaApiEndpoint := compose.GetOllamaVectorizer().GetEndpoint("apiEndpoint")
44
+
45
+ t.Run("tests", testText2VecOllama(endpoint, ollamaApiEndpoint))
46
+ }
47
+
48
+ func createSingleNodeEnvironment(ctx context.Context) (compose *docker.DockerCompose, err error) {
49
+ compose, err = composeModules().
50
+ WithWeaviate().
51
+ Start(ctx)
52
+ return
53
+ }
54
+
55
+ func createClusterEnvironment(ctx context.Context) (compose *docker.DockerCompose, err error) {
56
+ compose, err = composeModules().
57
+ WithWeaviateCluster(3).
58
+ Start(ctx)
59
+ return
60
+ }
61
+
62
+ func composeModules() (composeModules *docker.Compose) {
63
+ composeModules = docker.New().WithText2VecOllama()
64
+ return
65
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-transformers/setup_test.go ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package test
13
+
14
+ import (
15
+ "context"
16
+ "os"
17
+ "testing"
18
+
19
+ "github.com/pkg/errors"
20
+ "github.com/weaviate/weaviate/test/docker"
21
+ )
22
+
23
+ const weaviateEndpoint = "WEAVIATE_ENDPOINT"
24
+
25
+ func TestMain(m *testing.M) {
26
+ ctx := context.Background()
27
+ compose, err := docker.New().
28
+ WithWeaviate().WithText2VecTransformers().
29
+ Start(ctx)
30
+ if err != nil {
31
+ panic(errors.Wrapf(err, "cannot start"))
32
+ }
33
+
34
+ os.Setenv(weaviateEndpoint, compose.GetWeaviate().URI())
35
+ code := m.Run()
36
+
37
+ if err := compose.Terminate(ctx); err != nil {
38
+ panic(errors.Wrapf(err, "cannot terminate"))
39
+ }
40
+
41
+ os.Exit(code)
42
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-transformers/transformers_test.go ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package test
13
+
14
+ import (
15
+ "os"
16
+ "testing"
17
+
18
+ "github.com/stretchr/testify/assert"
19
+ "github.com/weaviate/weaviate/test/helper"
20
+ graphqlhelper "github.com/weaviate/weaviate/test/helper/graphql"
21
+ "github.com/weaviate/weaviate/test/helper/sample-schema/books"
22
+ )
23
+
24
+ func Test_T2VTransformers(t *testing.T) {
25
+ helper.SetupClient(os.Getenv(weaviateEndpoint))
26
+ booksClass := books.ClassTransformersVectorizer()
27
+ helper.CreateClass(t, booksClass)
28
+ defer helper.DeleteClass(t, booksClass.Class)
29
+
30
+ t.Run("add data to Books schema", func(t *testing.T) {
31
+ for _, book := range books.Objects() {
32
+ helper.CreateObject(t, book)
33
+ helper.AssertGetObjectEventually(t, book.Class, book.ID)
34
+ }
35
+ })
36
+
37
+ t.Run("query Books data with nearText", func(t *testing.T) {
38
+ result := graphqlhelper.AssertGraphQL(t, helper.RootAuth, `
39
+ {
40
+ Get {
41
+ Books(
42
+ nearText: {
43
+ concepts: ["Frank Herbert"]
44
+ distance: 0.3
45
+ }
46
+ ){
47
+ title
48
+ }
49
+ }
50
+ }
51
+ `)
52
+ books := result.Get("Get", "Books").AsSlice()
53
+ expected := []interface{}{
54
+ map[string]interface{}{"title": "Dune"},
55
+ }
56
+ assert.ElementsMatch(t, expected, books)
57
+ })
58
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-voyageai/setup_test.go ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "context"
16
+ "os"
17
+ "testing"
18
+
19
+ "github.com/stretchr/testify/require"
20
+ "github.com/weaviate/weaviate/test/docker"
21
+ )
22
+
23
+ func TestText2VecVoyageAI(t *testing.T) {
24
+ apiKey := os.Getenv("VOYAGEAI_APIKEY")
25
+ if apiKey == "" {
26
+ t.Skip("skipping, VOYAGEAI_APIKEY environment variable not present")
27
+ }
28
+ ctx := context.Background()
29
+ compose, err := createSingleNodeEnvironment(ctx, apiKey)
30
+ require.NoError(t, err)
31
+ defer func() {
32
+ require.NoError(t, compose.Terminate(ctx))
33
+ }()
34
+ rest := compose.GetWeaviate().URI()
35
+ grpc := compose.GetWeaviate().GrpcURI()
36
+
37
+ t.Run("text2vec-voyageai", testText2VecVoyageAI(rest, grpc))
38
+ }
39
+
40
+ func createSingleNodeEnvironment(ctx context.Context, apiKey string,
41
+ ) (compose *docker.DockerCompose, err error) {
42
+ compose, err = composeModules(apiKey).
43
+ WithWeaviate().
44
+ WithWeaviateWithGRPC().
45
+ Start(ctx)
46
+ return
47
+ }
48
+
49
+ func composeModules(apiKey string) (composeModules *docker.Compose) {
50
+ composeModules = docker.New().
51
+ WithText2VecVoyageAI(apiKey)
52
+ return
53
+ }
platform/dbops/binaries/weaviate-src/test/modules/text2vec-voyageai/text2vec_voyageai_test.go ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // _ _
2
+ // __ _____ __ ___ ___ __ _| |_ ___
3
+ // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
4
+ // \ V V / __/ (_| |\ V /| | (_| | || __/
5
+ // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
6
+ //
7
+ // Copyright © 2016 - 2025 Weaviate B.V. All rights reserved.
8
+ //
9
+ // CONTACT: hello@weaviate.io
10
+ //
11
+
12
+ package tests
13
+
14
+ import (
15
+ "testing"
16
+
17
+ "github.com/stretchr/testify/assert"
18
+ "github.com/stretchr/testify/require"
19
+ "github.com/weaviate/weaviate/entities/models"
20
+ "github.com/weaviate/weaviate/test/helper"
21
+ "github.com/weaviate/weaviate/test/helper/sample-schema/companies"
22
+ )
23
+
24
+ func testText2VecVoyageAI(rest, grpc string) func(t *testing.T) {
25
+ return func(t *testing.T) {
26
+ helper.SetupClient(rest)
27
+ // Data
28
+ className := "BooksGenerativeTest"
29
+ data := companies.Companies
30
+ class := companies.BaseClass(className)
31
+ tests := []struct {
32
+ name string
33
+ model string
34
+ }{
35
+ {
36
+ name: "voyage-3.5",
37
+ model: "voyage-3.5",
38
+ },
39
+ {
40
+ name: "voyage-3.5-lite",
41
+ model: "voyage-3.5-lite",
42
+ },
43
+ {
44
+ name: "voyage-3",
45
+ model: "voyage-3",
46
+ },
47
+ {
48
+ name: "voyage-3-lite",
49
+ model: "voyage-3-lite",
50
+ },
51
+ }
52
+ for _, tt := range tests {
53
+ t.Run(tt.name, func(t *testing.T) {
54
+ // Define class
55
+ class.VectorConfig = map[string]models.VectorConfig{
56
+ "description": {
57
+ Vectorizer: map[string]interface{}{
58
+ "text2vec-voyageai": map[string]interface{}{
59
+ "properties": []interface{}{"description"},
60
+ "vectorizeClassName": false,
61
+ "model": tt.model,
62
+ "dimensions": 64,
63
+ },
64
+ },
65
+ VectorIndexType: "flat",
66
+ },
67
+ }
68
+ // create schema
69
+ helper.CreateClass(t, class)
70
+ defer helper.DeleteClass(t, class.Class)
71
+ // create objects
72
+ t.Run("create objects", func(t *testing.T) {
73
+ companies.InsertObjects(t, rest, class.Class)
74
+ })
75
+ t.Run("check objects existence", func(t *testing.T) {
76
+ for _, company := range data {
77
+ t.Run(company.ID.String(), func(t *testing.T) {
78
+ obj, err := helper.GetObject(t, class.Class, company.ID, "vector")
79
+ require.NoError(t, err)
80
+ require.NotNil(t, obj)
81
+ require.Len(t, obj.Vectors, 1)
82
+ require.IsType(t, []float32{}, obj.Vectors["description"])
83
+ assert.True(t, len(obj.Vectors["description"].([]float32)) > 0)
84
+ })
85
+ }
86
+ })
87
+ t.Run("search tests", func(t *testing.T) {
88
+ companies.PerformAllSearchTests(t, rest, grpc, class.Class)
89
+ })
90
+ })
91
+ }
92
+ }
93
+ }
platform/dbops/binaries/weaviate-src/tools/ci/gcloud.sh ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # change current working directory to ./tools/ci
5
+ CWD=./tools/ci
6
+ cd $CWD
7
+
8
+ # Latest packages can be found here: https://cloud.google.com/sdk/docs/install
9
+ GOOGLE_CLOUD_CLI_PKG=google-cloud-cli-482.0.0-linux-x86_64.tar.gz
10
+
11
+ # install gcloud
12
+ sudo apt-get install apt-transport-https ca-certificates gnupg curl -y
13
+ curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/$GOOGLE_CLOUD_CLI_PKG
14
+ tar -xf $GOOGLE_CLOUD_CLI_PKG
15
+
16
+ ./google-cloud-sdk/install.sh -q
17
+ cd ./google-cloud-sdk/bin/ && ln -s $PWD/gcloud /usr/local/bin/gcloud && cd -
18
+
19
+ gcloud --version
20
+
21
+ # decode key file
22
+ gpg --quiet --batch --yes --decrypt --passphrase="$GPG_PASSPHRASE" --output sa.json sa.json.gpg
23
+
24
+ # configure project
25
+ gcloud auth activate-service-account --key-file sa.json
26
+ gcloud config set project $GCP_PROJECT
platform/dbops/binaries/weaviate-src/tools/ci/sa.json.gpg ADDED
Binary file (1.74 kB). View file
 
platform/dbops/binaries/weaviate-src/tools/dev/README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ## Usage
4
+ ### gen-code-from-swagger.sh
5
+ #### Steps
6
+
7
+ 1. Download the specified version of go-swagger if it is not already present.
8
+
9
+ 2. Install `goimports` to ensure consistent formatting https://pkg.go.dev/golang.org/x/tools/cmd/goimports
10
+
11
+ 3. Make sure go path is exported `export PATH=$GOPATH/bin:$PATH`
12
+
13
+ 4. you should find `Success` message which means the script ran :)
platform/dbops/binaries/weaviate-src/tools/dev/config.docker.yaml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ authentication:
2
+ anonymous_access:
3
+ enabled: true
4
+ configuration_storage:
5
+ type: etcd
6
+ url: http://etcd:2379
7
+ vector_index:
8
+ enabled: true
9
+ url: http://esvector:9200
10
+ denormalizationDepth: 3
11
+ contextionary:
12
+ url: contextionary:9999
13
+ network:
14
+ genesis_url: http://genesis_fake:8090
15
+ public_url: http://localhost:8080
16
+ peer_name: bestWeaviate
17
+ query_defaults:
18
+ limit: 100
19
+ logging:
20
+ interval: 1
21
+ enabled: true
22
+ url: http://telemetry_mock_api:8087/mock/new
23
+ telemetry:
24
+ interval: 1
25
+ disabled: false
26
+ remote_url: http://telemetry_mock_api:8087/mock/new
platform/dbops/binaries/weaviate-src/tools/dev/config.local-customdb.yaml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ authentication:
2
+ anonymous_access:
3
+ enabled: true
4
+ vector_index:
5
+ enabled: true
6
+ url: http://localhost:9201
7
+ denormalizationDepth: 2
8
+ configuration_storage:
9
+ type: etcd
10
+ url: http://localhost:2379
11
+ persistence:
12
+ dataPath: "./data"
13
+ contextionary:
14
+ url: localhost:9999
15
+ query_defaults:
16
+ limit: 100
17
+ debug: true
18
+ logging:
19
+ interval: 1
20
+ enabled: false
21
+ url: http://telemetry_mock_api:8087/mock/new
22
+ # network:
23
+ # genesis_url: http://localhost:8090
24
+ # public_url: http://localhost:8080
25
+ # peer_name: bestWeaviate
26
+ telemetry:
27
+ disabled: true
28
+
29
+ # feature toggle
30
+ customdb: true
platform/dbops/binaries/weaviate-src/tools/dev/config.local-development.yaml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ authentication:
2
+ anonymous_access:
3
+ enabled: true
4
+ vector_index:
5
+ enabled: true
6
+ url: http://localhost:9201
7
+ denormalizationDepth: 2
8
+ numberOfShards: 1
9
+ analytics_engine:
10
+ enabled: true
11
+ defaultUseAnalyticsEngine: false
12
+ configuration_storage:
13
+ type: etcd
14
+ url: http://localhost:2379
15
+ contextionary:
16
+ url: localhost:9999
17
+ query_defaults:
18
+ limit: 20
19
+ debug: true
20
+ logging:
21
+ interval: 1
22
+ enabled: false
23
+ url: http://telemetry_mock_api:8087/mock/new
24
+ # network:
25
+ # genesis_url: http://localhost:8090
26
+ # public_url: http://localhost:8080
27
+ # peer_name: bestWeaviate
28
+ telemetry:
29
+ disabled: true
30
+ origin: http://localhost:8080
platform/dbops/binaries/weaviate-src/tools/dev/config.local-esvector-only.yaml ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ authentication:
2
+ anonymous_access:
3
+ enabled: true
4
+ vector_index:
5
+ enabled: true
6
+ url: http://localhost:9201
7
+ denormalizationDepth: 2
8
+ configuration_storage:
9
+ type: etcd
10
+ url: http://localhost:2379
11
+ contextionary:
12
+ url: localhost:9999
13
+ query_defaults:
14
+ limit: 100
15
+ debug: true
16
+ logging:
17
+ interval: 1
18
+ enabled: false
19
+ url: http://telemetry_mock_api:8087/mock/new
20
+ # network:
21
+ # genesis_url: http://localhost:8090
22
+ # public_url: http://localhost:8080
23
+ # peer_name: bestWeaviate
24
+ telemetry:
25
+ disabled: true
26
+
27
+ # feature toggle
28
+ esvectorOnly: true
platform/dbops/binaries/weaviate-src/tools/dev/config.local-oidc.yaml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ vector_index:
2
+ enabled: true
3
+ url: http://localhost:9201
4
+ denormalizationDepth: 2
5
+ authentication:
6
+ anonymous_access:
7
+ enabled: false
8
+ oidc:
9
+ enabled: true
10
+ issuer: http://localhost:9090/auth/realms/weaviate
11
+ username_claim: email
12
+ groups_claim: groups
13
+ client_id: demo
14
+ skip_client_id_check: false
15
+ authorization:
16
+ admin_list:
17
+ enabled: true
18
+ users:
19
+ read_only_users:
20
+ - john@doe.com
21
+ groups:
22
+ read_only_groups:
23
+ generic
24
+ configuration_storage:
25
+ type: etcd
26
+ url: http://localhost:2379
27
+ contextionary:
28
+ url: localhost:9999
29
+ query_defaults:
30
+ limit: 20
31
+ debug: true
32
+ logging:
33
+ interval: 1
34
+ enabled: false
35
+ url: http://telemetry_mock_api:8087/mock/new
36
+ telemetry:
37
+ disabled: true
platform/dbops/binaries/weaviate-src/tools/dev/config.readonly.yaml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ authentication:
2
+ anonymous_access:
3
+ enabled: true
4
+ authorization:
5
+ admin_list:
6
+ enabled: true
7
+ users: []
8
+ read_only_users:
9
+ - anonymous
10
+ groups: []
11
+ read_only_groups:
12
+ - generic
13
+ vector_index:
14
+ enabled: true
15
+ url: http://localhost:9201
16
+ denormalizationDepth: 2
17
+ numberOfShards: 1
18
+ analytics_engine:
19
+ enabled: true
20
+ defaultUseAnalyticsEngine: false
21
+ configuration_storage:
22
+ type: etcd
23
+ url: http://localhost:2379
24
+ contextionary:
25
+ url: localhost:9999
26
+ query_defaults:
27
+ limit: 20
28
+ debug: true
29
+ logging:
30
+ interval: 1
31
+ enabled: false
32
+ url: http://telemetry_mock_api:8087/mock/new
33
+ # network:
34
+ # genesis_url: http://localhost:8090
35
+ # public_url: http://localhost:8080
36
+ # peer_name: bestWeaviate
37
+ telemetry:
38
+ disabled: true
platform/dbops/binaries/weaviate-src/tools/dev/config.runtime-overrides.yaml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ maximum_allowed_collections_count: 7
2
+ autoschema_enabled: true
3
+ async_replication_disabled: false
4
+ tenant_activity_read_log_level: info
5
+ tenant_activity_write_log_level: info
6
+ query_slow_log_enabled: true
7
+ query_slow_log_threshold: 100ms
8
+ inverted_sorter_disabled: false
9
+ # for usage module if enabled make sure that usage-gcs or usage-s3 module is enabled
10
+ # usage_scrape_interval: 1s
11
+ # usage_shard_jitter_interval: 50ms
12
+
13
+ # usage_gcs_bucket: weaviate-usage
14
+ # usage_gcs_prefix: billing
15
+
16
+ # usage_s3_bucket: weaviate-usage
17
+ # usage_s3_prefix: billing
18
+ ###########################
19
+
20
+ # exp_oidc_username_claim: "sub"
21
+ # exp_oidc_client_id: "<client_id>"
22
+ # exp_oidc_issuer: "<issuer_url>"
23
+ # exp_oidc_groups_claim: "teams"
platform/dbops/binaries/weaviate-src/tools/dev/config.wcsauth-dev.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ authentication:
2
+ anonymous_access:
3
+ enabled: false
4
+ oidc:
5
+ enabled: true
6
+ issuer: https://auth.dev.wcs.api.semi.technology/auth/realms/SeMI
7
+ username_claim: email
8
+ groups_claim: groups
9
+ client_id: wcs
10
+ skip_client_id_check: false
11
+ vector_index:
12
+ enabled: true
13
+ url: http://localhost:9201
14
+ denormalizationDepth: 2
15
+ numberOfShards: 1
16
+ analytics_engine:
17
+ enabled: true
18
+ defaultUseAnalyticsEngine: false
19
+ configuration_storage:
20
+ type: etcd
21
+ url: http://localhost:2379
22
+ contextionary:
23
+ url: localhost:9999
24
+ query_defaults:
25
+ limit: 20
26
+ debug: true
27
+ logging:
28
+ interval: 1
29
+ enabled: false
30
+ url: http://telemetry_mock_api:8087/mock/new
31
+ # network:
32
+ # genesis_url: http://localhost:8090
33
+ # public_url: http://localhost:8080
34
+ # peer_name: bestWeaviate
35
+ telemetry:
36
+ disabled: true
platform/dbops/binaries/weaviate-src/tools/dev/delve_connect.sh ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ echo "Connecting delve to headless instance at 127.0.0.1:2345..."
6
+
7
+ dlv connect 127.0.0.1:2345
platform/dbops/binaries/weaviate-src/tools/dev/ensure-buildx-builder.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #! /usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ if ! docker buildx inspect | grep -E 'Driver:\s+docker-container' >/dev/null; then
6
+ echo "Active buildx builder does not use the docker-container driver, which is required for mutli-architecture image builds. Creating a new buildx builder..."
7
+ docker buildx create --use
8
+ fi
platform/dbops/binaries/weaviate-src/tools/dev/flakyness.sh ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ # Jump to root directory
4
+ cd "$( dirname "${BASH_SOURCE[0]}" )"/../.. || exit 1
5
+
6
+ success=0
7
+ fail=0
8
+
9
+ for _ in {1..50}; do
10
+ if go test -count 1 ./test/acceptance/graphql_resolvers/...; then
11
+ success=$((success+1))
12
+ else
13
+ fail=$((fail+1))
14
+ fi
15
+ done
16
+
17
+ echo "Success: $success"
18
+ echo "Failure: $fail"
platform/dbops/binaries/weaviate-src/tools/dev/goreleaser_and_sign.sh ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -eou pipefail
3
+
4
+ # run from Weaviate Root!
5
+ #
6
+ # This script calls goreleaser and signs + notarize the binaries for macos. Thus needed to export few ENV variables
7
+ # to be used in .goreleaser.yaml in the root of the repository.
8
+
9
+ GIT_REVISION=$(git rev-parse --short HEAD)
10
+ GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
11
+ BUILD_USER="ci"
12
+ BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
13
+
14
+ extra_args=""
15
+
16
+ # detect if commit is tagged or not (format is "vA.B.Z" with tag and "vA.B.Z-commit" without tag)
17
+ VERSION="$(git describe --tag)"
18
+ if [[ "$VERSION" == *"-"* ]]; then
19
+ extra_args="--snapshot"
20
+ fi
21
+
22
+ GIT_REVISION="$GIT_REVISION" GIT_BRANCH="$GIT_BRANCH" BUILD_USER="$BUILD_USER" BUILD_DATE="$BUILD_DATE" goreleaser build --clean $extra_args
23
+
24
+ codesign -f -o runtime --timestamp -s "Developer ID Application: Weaviate B.V. (QUZ8SKLS6R)" dist/weaviate_darwin_all/weaviate
25
+
26
+ DARWIN_DIST="dist/weaviate-${VERSION}-darwin-all.zip"
27
+ zip -j "$DARWIN_DIST" dist/weaviate_darwin_all/weaviate LICENSE README.md
28
+
29
+ codesign -f -o runtime --timestamp -s "Developer ID Application: Weaviate B.V. (QUZ8SKLS6R)" "$DARWIN_DIST"
30
+
31
+ xcrun notarytool submit "$DARWIN_DIST" --keychain-profile "AC_PASSWORD" --wait
32
+
33
+
34
+ # add checksums
35
+ shasum -a 256 "$DARWIN_DIST" | cut -d ' ' -f 1 > "${DARWIN_DIST}.sha256"
36
+ md5 "$DARWIN_DIST" | cut -d ' ' -f 4 > "${DARWIN_DIST}.md5"
platform/dbops/binaries/weaviate-src/tools/dev/grpc_regenerate.sh ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ GEN_DIR=./grpc/generated
5
+ OUT_DIR="$GEN_DIR/protocol"
6
+
7
+ echo "Installing latest gRPC libs..."
8
+
9
+ if command -v brew >/dev/null 2>&1; then
10
+ brew update && brew upgrade protobuf protolint
11
+ fi
12
+
13
+ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
14
+ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
15
+
16
+ echo "Generating Go protocol stubs..."
17
+
18
+ rm -fr $OUT_DIR && mkdir -p $OUT_DIR && cd $GEN_DIR && protoc \
19
+ --proto_path=../proto \
20
+ --go_out=paths=source_relative:protocol \
21
+ --go-grpc_out=paths=source_relative:protocol \
22
+ ../proto/v0/*.proto && protoc \
23
+ --proto_path=../proto \
24
+ --go_out=paths=source_relative:protocol \
25
+ --go-grpc_out=paths=source_relative:protocol \
26
+ ../proto/v1/*.proto
27
+
28
+ cd - && sed -i '' '/versions:/, /source: .*/d' ./grpc/generated/protocol/**/*.go
29
+
30
+ go run ./tools/license_headers/main.go
31
+
32
+ goimports -w $OUT_DIR
33
+
34
+ # running gofumpt twice is on purpose
35
+ # it doesn't work for the first time only after second run the formatting is proper
36
+ gofumpt -w $OUT_DIR
37
+ gofumpt -w $OUT_DIR
38
+
39
+ echo "Success"
platform/dbops/binaries/weaviate-src/tools/dev/image-tag.sh ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ set -o pipefail
4
+ set -o errexit
5
+ set -o nounset
6
+
7
+ GIT_REVISION=$(git rev-parse --short HEAD)
8
+ GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
9
+ STABLE_REVISION=$(jq -r '.info.version' < openapi-specs/schema.json)
10
+
11
+ # If it's a stable branch use the official `.info.version` from openapi-specs
12
+ # for any other branch use the SHA hash as image tag.
13
+ #
14
+ # e.g:
15
+ # stable: semitechnologies/weaviate:1.25.29
16
+ # other: semitechnologies/weaviate:1.25.29-cac50cfe2
17
+ #
18
+ # Gives ability to build immutable image at any commit in your feature branch. Easy to put it on dev cluster, no cache issues, etc.
19
+
20
+ if [[ "$GIT_BRANCH" == stable* ]]
21
+ then
22
+ echo "${STABLE_REVISION}"
23
+ else
24
+ echo "${STABLE_REVISION}-${GIT_REVISION}"
25
+ fi