weaviate-ruby 0.8.4 → 0.8.6

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: 83fb7552f634c79632cbc4cbcfcd02364085cd67ce58669f6f90448e383f573b
4
+ data.tar.gz: b8584df9da3abeeed1db9df7730ad4f145feb3c6055396f810a4d2b9c962ba58
5
5
  SHA512:
6
- metadata.gz: 054647b0b92945fe8e4cfaaf8b783f40220c6f557c39654b664421f4019f4b8721c6bdbd8b75590ea7fc6941e9677cd2a407bf2b910770f69325826f0620e8b1
7
- data.tar.gz: 6333ab94a2f13066c37fd80c32ce3f33b9b8446449bf2463e51e55e3bbde55aa51eb2c0b6ef33b3b3136adb39ea5500c7ed8cf5bb4b3073796d81c6836fba579
6
+ metadata.gz: 70252389e7843f713252cb57a3c005760804c2b36f8180926762d7ac20f574e0470ccc24dafd56fed418de40a572ebf81c30fe1734d724357230c0ac81598b2f
7
+ data.tar.gz: dcc69f3e64e513a10f1d41ee8086bef3e58d5abcd9b264eb7db8aa84d79a19b72eb174bdfb7868d056e9d256366c3fbeacddf6428759c7e23bd28dfb2b57c29c
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,10 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- weaviate-ruby (0.8.4)
5
- faraday (~> 1)
6
- faraday_middleware (~> 1)
7
- graphlient (~> 0.6.0)
4
+ weaviate-ruby (0.8.6)
5
+ faraday (>= 2.0.1, < 3.0)
6
+ graphlient (~> 0.7.0)
8
7
 
9
8
  GEM
10
9
  remote: https://rubygems.org/
@@ -19,14 +18,12 @@ GEM
19
18
  coderay (1.1.3)
20
19
  concurrent-ruby (1.2.2)
21
20
  diff-lcs (1.5.0)
22
- faraday (1.2.0)
23
- multipart-post (>= 1.2, < 3)
24
- ruby2_keywords
25
- faraday_middleware (1.2.0)
26
- faraday (~> 1.0)
27
- graphlient (0.6.0)
28
- faraday (>= 1.0)
29
- faraday_middleware
21
+ faraday (2.7.10)
22
+ faraday-net_http (>= 2.0, < 3.1)
23
+ ruby2_keywords (>= 0.0.4)
24
+ faraday-net_http (3.0.2)
25
+ graphlient (0.7.0)
26
+ faraday (~> 2.0)
30
27
  graphql-client
31
28
  graphql (2.0.19)
32
29
  graphql-client (0.18.0)
@@ -38,7 +35,6 @@ GEM
38
35
  language_server-protocol (3.17.0.3)
39
36
  method_source (1.0.0)
40
37
  minitest (5.18.0)
41
- multipart-post (2.3.0)
42
38
  parallel (1.22.1)
43
39
  parser (3.2.1.1)
44
40
  ast (~> 2.4.1)
@@ -93,7 +89,9 @@ GEM
93
89
  yard (0.9.34)
94
90
 
95
91
  PLATFORMS
92
+ arm64-darwin-21
96
93
  x86_64-darwin-19
94
+ x86_64-darwin-21
97
95
  x86_64-linux
98
96
 
99
97
  DEPENDENCIES
@@ -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,7 +6,9 @@ module Weaviate
6
6
  class_name:,
7
7
  fields:,
8
8
  after: nil,
9
+ tenant: nil,
9
10
  limit: nil,
11
+ autocut: nil,
10
12
  offset: nil,
11
13
  sort: nil,
12
14
  where: nil,
@@ -21,7 +23,9 @@ module Weaviate
21
23
  response = client.graphql.execute(
22
24
  get_query(
23
25
  class_name: class_name,
26
+ tenant: tenant,
24
27
  fields: fields,
28
+ autocut: autocut,
25
29
  sort: sort,
26
30
  where: where,
27
31
  near_text: near_text,
@@ -83,6 +87,8 @@ module Weaviate
83
87
  response = client.graphql.execute(
84
88
  explore_query(
85
89
  fields: fields,
90
+ sort: sort,
91
+ where: where,
86
92
  near_text: near_text,
87
93
  near_vector: near_vector,
88
94
  near_image: near_image,
@@ -119,7 +125,7 @@ module Weaviate
119
125
  #{near_text.present? ? "nearText: #{near_text}" : ""},
120
126
  #{near_vector.present? ? "nearVector: #{near_vector}" : ""},
121
127
  #{near_image.present? ? "nearImage: #{near_image}" : ""},
122
- #{near_object.present? ? "nearObject: #{near_object}" : ""}
128
+ #{near_object.present? ? "nearObject: #{near_object}" : ""},
123
129
  #{where.present? ? "where: #{where}" : ""},
124
130
  #{sort.present? ? "sort: #{sort}" : ""}
125
131
  ) {
@@ -132,6 +138,8 @@ module Weaviate
132
138
  def get_query(
133
139
  class_name:,
134
140
  fields:,
141
+ autocut:,
142
+ tenant: nil,
135
143
  where: nil,
136
144
  near_text: nil,
137
145
  near_vector: nil,
@@ -153,6 +161,8 @@ module Weaviate
153
161
  after: $after,
154
162
  limit: $limit,
155
163
  offset: $offset,
164
+ #{autocut.present? ? "autocut: #{autocut}" : ""},
165
+ #{tenant.present? ? "tenant: #{tenant}" : ""},
156
166
  #{near_text.present? ? "nearText: #{near_text}" : ""},
157
167
  #{near_vector.present? ? "nearVector: #{near_vector}" : ""},
158
168
  #{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.6"
5
5
  end
metadata CHANGED
@@ -1,57 +1,49 @@
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.6
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-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
19
+ version: 2.0.1
20
+ - - "<"
25
21
  - !ruby/object:Gem::Version
26
- version: '1'
27
- - !ruby/object:Gem::Dependency
28
- name: faraday_middleware
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1'
22
+ version: '3.0'
34
23
  type: :runtime
35
24
  prerelease: false
36
25
  version_requirements: !ruby/object:Gem::Requirement
37
26
  requirements:
38
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 2.0.1
30
+ - - "<"
39
31
  - !ruby/object:Gem::Version
40
- version: '1'
32
+ version: '3.0'
41
33
  - !ruby/object:Gem::Dependency
42
34
  name: graphlient
43
35
  requirement: !ruby/object:Gem::Requirement
44
36
  requirements:
45
37
  - - "~>"
46
38
  - !ruby/object:Gem::Version
47
- version: 0.6.0
39
+ version: 0.7.0
48
40
  type: :runtime
49
41
  prerelease: false
50
42
  version_requirements: !ruby/object:Gem::Requirement
51
43
  requirements:
52
44
  - - "~>"
53
45
  - !ruby/object:Gem::Version
54
- version: 0.6.0
46
+ version: 0.7.0
55
47
  - !ruby/object:Gem::Dependency
56
48
  name: pry-byebug
57
49
  requirement: !ruby/object:Gem::Requirement