weaviate-ruby 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/Gemfile.lock +2 -2
- data/README.md +21 -26
- data/lib/weaviate/client.rb +1 -0
- data/lib/weaviate/objects.rb +1 -1
- data/lib/weaviate/schema.rb +11 -5
- data/lib/weaviate/version.rb +1 -1
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1132fea78a812b9835eef5a94fffc191551e9f327955e1ba89f4509888fa8146
|
4
|
+
data.tar.gz: 68eb70bc73f8641c2915028c6d64c48c959bb8bc785a042f0ddee95b0ef07c50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ac5684f8542587c703b2b694552bb256390af95171e25bce26157fb19c09d4e409a3adaee6b6b9372b8092b4d43e93b03784cbdfe761beb46fc2037d69d14f5
|
7
|
+
data.tar.gz: 5a1de134f24d453e4fdb2876d4d58ba0564f485aa093f727d37830a9f970c2dce60c648741dcf01dce2f33ccd458ebbb1a514ad546ea399be5c1feec0ec02b20
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
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:
|
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:
|
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:
|
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:
|
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:
|
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
|
-
|
203
|
-
|
204
|
-
|
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
|
-
|
210
|
-
|
211
|
-
|
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
|
-
|
221
|
-
operator: "
|
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
|
-
|
362
|
+
multi_tenant: true,
|
363
|
+
auto_tenant_creation: true,
|
364
|
+
auto_tenant_activation: true
|
370
365
|
)
|
371
366
|
```
|
372
367
|
|
data/lib/weaviate/client.rb
CHANGED
@@ -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
|
data/lib/weaviate/objects.rb
CHANGED
@@ -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.
|
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
|
data/lib/weaviate/schema.rb
CHANGED
@@ -26,7 +26,9 @@ module Weaviate
|
|
26
26
|
class_name:,
|
27
27
|
description: nil,
|
28
28
|
properties: nil,
|
29
|
-
multi_tenant:
|
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
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
data/lib/weaviate/version.rb
CHANGED
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.
|
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-
|
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.
|
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
|