weaviate-ruby 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df0801c83bc409a791c5a2737f0574def072660fdac96b32261b02aaa6665f33
4
- data.tar.gz: d720fc99beed7b91b844479116caa54f6805e8807c4375e67bdffdb9a52573fe
3
+ metadata.gz: 1132fea78a812b9835eef5a94fffc191551e9f327955e1ba89f4509888fa8146
4
+ data.tar.gz: 68eb70bc73f8641c2915028c6d64c48c959bb8bc785a042f0ddee95b0ef07c50
5
5
  SHA512:
6
- metadata.gz: 807e7b52c259e8559c0b581c1d96a175e95bba8dff16091dd67746a41451b10b3f68c26bbc081c22c862eafeeac2c9d65a7aa12dcbbf69d5521cab8b98cc3275
7
- data.tar.gz: 203f861b21b501deff8a787168920c3946cd28682112aa73ed3fc238a52feeb4dd6ee0a5d1eef7c28258210e88b3aca232fa63ee027fce976ab2c54ccba1e12c
6
+ metadata.gz: 1ac5684f8542587c703b2b694552bb256390af95171e25bce26157fb19c09d4e409a3adaee6b6b9372b8092b4d43e93b03784cbdfe761beb46fc2037d69d14f5
7
+ data.tar.gz: 5a1de134f24d453e4fdb2876d4d58ba0564f485aa093f727d37830a9f970c2dce60c648741dcf01dce2f33ccd458ebbb1a514ad546ea399be5c1feec0ec02b20
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.9.1] - 2024-09-19
4
+
3
5
  ## [0.9.0] - 2024-07-08
4
6
 
5
7
  - Add object.replace method which uses PUT which performs a complete object replacement
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- weaviate-ruby (0.9.0)
4
+ weaviate-ruby (0.9.1)
5
5
  faraday (>= 2.0.1, < 3.0)
6
- graphlient (~> 0.7.0)
6
+ graphlient (>= 0.7.0, < 0.9.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -144,7 +144,7 @@ client.schema.create(
144
144
  ### Using the Objects endpoint
145
145
  ```ruby
146
146
  # Create a new data object.
147
- client.objects.create(
147
+ output = client.objects.create(
148
148
  class_name: 'Question',
149
149
  properties: {
150
150
  answer: '42',
@@ -152,6 +152,7 @@ client.objects.create(
152
152
  category: 'philosophy'
153
153
  }
154
154
  )
155
+ uuid = output["id"]
155
156
 
156
157
  # Lists all data objects in reverse order of creation.
157
158
  client.objects.list()
@@ -159,19 +160,19 @@ client.objects.list()
159
160
  # Get a single data object.
160
161
  client.objects.get(
161
162
  class_name: "Question",
162
- id: "uuid"
163
+ id: uuid
163
164
  )
164
165
 
165
166
  # Check if a data object exists.
166
167
  client.objects.exists?(
167
168
  class_name: "Question",
168
- id: "uuid"
169
+ id: uuid
169
170
  )
170
171
 
171
172
  # Perform a partial update on an object based on its uuid.
172
173
  client.objects.update(
173
174
  class_name: "Question",
174
- id: "uuid",
175
+ id: uuid,
175
176
  properties: {
176
177
  category: "simple-math"
177
178
  }
@@ -180,7 +181,7 @@ client.objects.update(
180
181
  # Replace an object based on its uuid.
181
182
  client.objects.replace(
182
183
  class_name: "Question",
183
- id: "uuid",
184
+ id: uuid,
184
185
  properties: {
185
186
  question: "What does 6 times 7 equal to?",
186
187
  category: "math",
@@ -191,34 +192,35 @@ client.objects.replace(
191
192
  # Delete a single data object from Weaviate.
192
193
  client.objects.delete(
193
194
  class_name: "Question",
194
- id: "uuid"
195
+ id: uuid
195
196
  )
196
197
 
197
198
  # Batch create objects
198
- client.objects.batch_create(objects: [
199
+ output = client.objects.batch_create(objects: [
199
200
  {
200
201
  class: "Question",
201
202
  properties: {
202
- answer: "42",
203
- question: "What is the meaning of life?",
204
- category: "philosophy"
203
+ answer: "42",
204
+ question: "What is the meaning of life?",
205
+ category: "philosophy"
205
206
  }
206
207
  }, {
207
208
  class: "Question",
208
209
  properties: {
209
- answer: "42",
210
- question: "What does 6 times 7 equal to?",
211
- category: "math"
210
+ answer: "42",
211
+ question: "What does 6 times 7 equal to?",
212
+ category: "math"
212
213
  }
213
214
  }
214
215
  ])
216
+ uuids = output.pluck("id")
215
217
 
216
218
  # Batch delete objects
217
219
  client.objects.batch_delete(
218
220
  class_name: "Question",
219
221
  where: {
220
- valueString: "uuid",
221
- operator: "Equal",
222
+ valueStringArray: uuids,
223
+ operator: "ContainsAny",
222
224
  path: ["id"]
223
225
  }
224
226
  )
@@ -352,21 +354,14 @@ client.ready?
352
354
 
353
355
  ### Tenants
354
356
 
355
- Any schema can be multi-tenant
356
-
357
- ```ruby
358
- client.schema.create(
359
- # Other keys...
360
- mutli_tenant: true, # passes { enabled: true } to weaviate
361
- )
362
- ```
363
-
364
- You can also manually specify your multi tenancy configuration with a hash
357
+ Any schema can be multi-tenant by passing in these options for to `schema.create()`.
365
358
 
366
359
  ```ruby
367
360
  client.schema.create(
368
361
  # Other keys...
369
- mutli_tenant: { enabled: true, autoTenantCreation: true, autoTenantActivation: true },
362
+ multi_tenant: true,
363
+ auto_tenant_creation: true,
364
+ auto_tenant_activation: true
370
365
  )
371
366
  ```
372
367
 
@@ -106,6 +106,7 @@ module Weaviate
106
106
  end
107
107
  faraday.request :json
108
108
  faraday.response :json, content_type: /\bjson$/
109
+ faraday.response :raise_error
109
110
  faraday.adapter adapter
110
111
 
111
112
  faraday.headers[API_KEY_HEADERS[model_service]] = model_service_api_key if model_service && model_service_api_key
@@ -50,7 +50,7 @@ module Weaviate
50
50
  req.body = {}
51
51
  req.body["class"] = class_name
52
52
  req.body["properties"] = properties
53
- req.body["tenant"] = tenant unless tenant.blank?
53
+ req.body["tenant"] = tenant unless tenant.nil?
54
54
  req.body["id"] = id unless id.nil?
55
55
  req.body["vector"] = vector unless vector.nil?
56
56
  end
@@ -26,7 +26,9 @@ module Weaviate
26
26
  class_name:,
27
27
  description: nil,
28
28
  properties: nil,
29
- multi_tenant: nil,
29
+ multi_tenant: false,
30
+ auto_tenant_creation: false,
31
+ auto_tenant_activation: false,
30
32
  vector_index_type: nil,
31
33
  vector_index_config: nil,
32
34
  vectorizer: nil,
@@ -43,11 +45,15 @@ module Weaviate
43
45
  req.body["vectorizer"] = vectorizer unless vectorizer.nil?
44
46
  req.body["moduleConfig"] = module_config unless module_config.nil?
45
47
  req.body["properties"] = properties unless properties.nil?
46
- if multi_tenant.is_a?(Hash)
47
- req.body["multiTenancyConfig"] = multi_tenant
48
- elsif multi_tenant.present?
49
- req.body["multiTenancyConfig"] = {enabled: true}
48
+
49
+ if multi_tenant
50
+ req.body["multiTenancyConfig"] = {
51
+ enabled: multi_tenant,
52
+ autoTenantCreation: auto_tenant_creation,
53
+ autoTenantActivation: auto_tenant_activation
54
+ }
50
55
  end
56
+
51
57
  req.body["invertedIndexConfig"] = inverted_index_config unless inverted_index_config.nil?
52
58
  req.body["replicationConfig"] = replication_config unless replication_config.nil?
53
59
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Weaviate
4
- VERSION = "0.9.0"
4
+ VERSION = "0.9.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weaviate-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Bondarev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-08 00:00:00.000000000 Z
11
+ date: 2024-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -34,16 +34,22 @@ dependencies:
34
34
  name: graphlient
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: 0.7.0
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: 0.9.0
40
43
  type: :runtime
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
43
46
  requirements:
44
- - - "~>"
47
+ - - ">="
45
48
  - !ruby/object:Gem::Version
46
49
  version: 0.7.0
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: 0.9.0
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: pry-byebug
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -138,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
144
  - !ruby/object:Gem::Version
139
145
  version: '0'
140
146
  requirements: []
141
- rubygems_version: 3.4.1
147
+ rubygems_version: 3.5.11
142
148
  signing_key:
143
149
  specification_version: 4
144
150
  summary: Ruby wrapper for the Weaviate.io API