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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 498b6ca989e0572928f453d88084e765e79112d9cb7c96dad92da06752aaeb7e
4
- data.tar.gz: e708949fa1faf0c250173a6e86b31b23eea7d5231a2cb9b3fd8f6c89aef97552
3
+ metadata.gz: ffbe97178df453d77bcd0071e405f77cdad6bea3278103ec23cd04250dbd5735
4
+ data.tar.gz: '038c9ef137b6c3222ec1eabbd18b571dc3db71b29e734f0045241790a94f96c2'
5
5
  SHA512:
6
- metadata.gz: 054647b0b92945fe8e4cfaaf8b783f40220c6f557c39654b664421f4019f4b8721c6bdbd8b75590ea7fc6941e9677cd2a407bf2b910770f69325826f0620e8b1
7
- data.tar.gz: 6333ab94a2f13066c37fd80c32ce3f33b9b8446449bf2463e51e55e3bbde55aa51eb2c0b6ef33b3b3136adb39ea5500c7ed8cf5bb4b3073796d81c6836fba579
6
+ metadata.gz: 48689c5b2005f63fa6b55b975778aa5c0da34a82c1caf62abe8224f4ad1d2722481177ebb7f684cf12fa3f7485f058ab433d1ac3b8a8b0a818ea666a9b8eef2b
7
+ data.tar.gz: 3d06817dcab514c2e16ec68f8a870272635f0cfc19b5a6f6a12cc263f32fb99d18b7472c863c8f9144182dbec5550a3a1bbab4a3d3c925d42af120ab16f3db30
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.8.5] - 2023-07-19
4
+ - Add multi-tenancy support
5
+
6
+ ## [0.8.4] - 2023-06-30
7
+ - Adding yard
8
+
3
9
  ## [0.8.3] - 2023-06-25
4
10
  - Add Google PaLM support
5
11
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- weaviate-ruby (0.8.4)
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
 
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "faraday"
4
- require "faraday_middleware"
5
4
  require "graphlient"
6
5
 
7
6
  module Weaviate
@@ -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
@@ -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}" : ""},
@@ -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:,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Weaviate
4
- VERSION = "0.8.4"
4
+ VERSION = "0.8.5"
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.8.4
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-06-30 00:00:00.000000000 Z
11
+ date: 2023-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday