weaviate-ruby 0.8.4 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +2 -1
- data/lib/weaviate/client.rb +0 -1
- data/lib/weaviate/objects.rb +4 -0
- data/lib/weaviate/query.rb +4 -1
- data/lib/weaviate/schema.rb +35 -0
- data/lib/weaviate/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffbe97178df453d77bcd0071e405f77cdad6bea3278103ec23cd04250dbd5735
|
4
|
+
data.tar.gz: '038c9ef137b6c3222ec1eabbd18b571dc3db71b29e734f0045241790a94f96c2'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48689c5b2005f63fa6b55b975778aa5c0da34a82c1caf62abe8224f4ad1d2722481177ebb7f684cf12fa3f7485f058ab433d1ac3b8a8b0a818ea666a9b8eef2b
|
7
|
+
data.tar.gz: 3d06817dcab514c2e16ec68f8a870272635f0cfc19b5a6f6a12cc263f32fb99d18b7472c863c8f9144182dbec5550a3a1bbab4a3d3c925d42af120ab16f3db30
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
weaviate-ruby (0.8.
|
4
|
+
weaviate-ruby (0.8.5)
|
5
5
|
faraday (~> 1)
|
6
6
|
faraday_middleware (~> 1)
|
7
7
|
graphlient (~> 0.6.0)
|
@@ -93,6 +93,7 @@ GEM
|
|
93
93
|
yard (0.9.34)
|
94
94
|
|
95
95
|
PLATFORMS
|
96
|
+
arm64-darwin-21
|
96
97
|
x86_64-darwin-19
|
97
98
|
x86_64-linux
|
98
99
|
|
data/lib/weaviate/client.rb
CHANGED
data/lib/weaviate/objects.rb
CHANGED
@@ -8,6 +8,7 @@ module Weaviate
|
|
8
8
|
def list(
|
9
9
|
class_name: nil,
|
10
10
|
limit: nil,
|
11
|
+
tenant: nil,
|
11
12
|
offset: nil,
|
12
13
|
after: nil,
|
13
14
|
include: nil,
|
@@ -16,6 +17,7 @@ module Weaviate
|
|
16
17
|
)
|
17
18
|
response = client.connection.get(PATH) do |req|
|
18
19
|
req.params["class"] = class_name unless class_name.nil?
|
20
|
+
req.params["tenant"] = tenant unless tenant.nil?
|
19
21
|
req.params["limit"] = limit unless limit.nil?
|
20
22
|
req.params["offset"] = offset unless offset.nil?
|
21
23
|
req.params["after"] = after unless after.nil?
|
@@ -31,6 +33,7 @@ module Weaviate
|
|
31
33
|
def create(
|
32
34
|
class_name:,
|
33
35
|
properties:,
|
36
|
+
tenant: nil,
|
34
37
|
consistency_level: nil,
|
35
38
|
id: nil,
|
36
39
|
vector: nil
|
@@ -47,6 +50,7 @@ module Weaviate
|
|
47
50
|
req.body = {}
|
48
51
|
req.body["class"] = class_name
|
49
52
|
req.body["properties"] = properties
|
53
|
+
req.body["tenant"] = tenant unless tenant.blank?
|
50
54
|
req.body["id"] = id unless id.nil?
|
51
55
|
req.body["vector"] = vector unless vector.nil?
|
52
56
|
end
|
data/lib/weaviate/query.rb
CHANGED
@@ -6,6 +6,7 @@ module Weaviate
|
|
6
6
|
class_name:,
|
7
7
|
fields:,
|
8
8
|
after: nil,
|
9
|
+
tenant: nil,
|
9
10
|
limit: nil,
|
10
11
|
offset: nil,
|
11
12
|
sort: nil,
|
@@ -21,6 +22,7 @@ module Weaviate
|
|
21
22
|
response = client.graphql.execute(
|
22
23
|
get_query(
|
23
24
|
class_name: class_name,
|
25
|
+
tenant: tenant,
|
24
26
|
fields: fields,
|
25
27
|
sort: sort,
|
26
28
|
where: where,
|
@@ -131,7 +133,7 @@ module Weaviate
|
|
131
133
|
|
132
134
|
def get_query(
|
133
135
|
class_name:,
|
134
|
-
fields:,
|
136
|
+
fields:, tenant: nil,
|
135
137
|
where: nil,
|
136
138
|
near_text: nil,
|
137
139
|
near_vector: nil,
|
@@ -153,6 +155,7 @@ module Weaviate
|
|
153
155
|
after: $after,
|
154
156
|
limit: $limit,
|
155
157
|
offset: $offset,
|
158
|
+
#{tenant.present? ? "tenant: #{tenant}" : ""}
|
156
159
|
#{near_text.present? ? "nearText: #{near_text}" : ""},
|
157
160
|
#{near_vector.present? ? "nearVector: #{near_vector}" : ""},
|
158
161
|
#{near_image.present? ? "nearImage: #{near_image}" : ""},
|
data/lib/weaviate/schema.rb
CHANGED
@@ -26,6 +26,7 @@ module Weaviate
|
|
26
26
|
class_name:,
|
27
27
|
description: nil,
|
28
28
|
properties: nil,
|
29
|
+
multi_tenant: nil,
|
29
30
|
vector_index_type: nil,
|
30
31
|
vector_index_config: nil,
|
31
32
|
vectorizer: nil,
|
@@ -42,6 +43,7 @@ module Weaviate
|
|
42
43
|
req.body["vectorizer"] = vectorizer unless vectorizer.nil?
|
43
44
|
req.body["moduleConfig"] = module_config unless module_config.nil?
|
44
45
|
req.body["properties"] = properties unless properties.nil?
|
46
|
+
req.body["multiTenancyConfig"] = {enabled: true} unless multi_tenant.nil?
|
45
47
|
req.body["invertedIndexConfig"] = inverted_index_config unless inverted_index_config.nil?
|
46
48
|
req.body["replicationConfig"] = replication_config unless replication_config.nil?
|
47
49
|
end
|
@@ -93,6 +95,39 @@ module Weaviate
|
|
93
95
|
response.body
|
94
96
|
end
|
95
97
|
|
98
|
+
# Adds one or more tenants to a class.
|
99
|
+
def add_tenants(
|
100
|
+
class_name:,
|
101
|
+
tenants:
|
102
|
+
)
|
103
|
+
response = client.connection.post("#{PATH}/#{class_name}/tenants") do |req|
|
104
|
+
tenants_str = tenants.map { |t| %({"name": "#{t}"}) }.join(", ")
|
105
|
+
req.body = "[#{tenants_str}]"
|
106
|
+
end
|
107
|
+
response.body
|
108
|
+
end
|
109
|
+
|
110
|
+
# List tenants of a class.
|
111
|
+
def list_tenants(class_name:)
|
112
|
+
response = client.connection.get("#{PATH}/#{class_name}/tenants")
|
113
|
+
response.body
|
114
|
+
end
|
115
|
+
|
116
|
+
# Remove one or more tenants from a class.
|
117
|
+
def remove_tenants(
|
118
|
+
class_name:,
|
119
|
+
tenants:
|
120
|
+
)
|
121
|
+
response = client.connection.delete("#{PATH}/#{class_name}/tenants") do |req|
|
122
|
+
req.body = tenants
|
123
|
+
end
|
124
|
+
|
125
|
+
if response.success?
|
126
|
+
end
|
127
|
+
|
128
|
+
response.body
|
129
|
+
end
|
130
|
+
|
96
131
|
# Add a property to an existing schema class.
|
97
132
|
def add_property(
|
98
133
|
class_name:,
|
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.8.
|
4
|
+
version: 0.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Bondarev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|