weaviate-ruby 0.8.3 → 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: 8e63b3f0149e87dc2aec7c38970e91866e45dfccfc9e46c1378c27b9135f4a4d
4
- data.tar.gz: f22c4a1c4eb8cdd2acd9d70b95404c46afb11c19e3821be35fb5b49048563dcb
3
+ metadata.gz: ffbe97178df453d77bcd0071e405f77cdad6bea3278103ec23cd04250dbd5735
4
+ data.tar.gz: '038c9ef137b6c3222ec1eabbd18b571dc3db71b29e734f0045241790a94f96c2'
5
5
  SHA512:
6
- metadata.gz: 843a49164ce05ed851dcf80e228e75839f05d7ee73c65087da21f72ab689f2c5388ac14ba06a1782c3aeda62ff1b01104bf52eb230313df145b9afafcb856c25
7
- data.tar.gz: b1fd3ee9aa230da2499cc9ce1e8c24f69bb29a3199b07e16cf0f1095f53da9094a83ae849c9d266ff27a8292cb6d7b4166c7e257cb02a698b7d53702bbdb1f20
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.3)
4
+ weaviate-ruby (0.8.5)
5
5
  faraday (~> 1)
6
6
  faraday_middleware (~> 1)
7
7
  graphlient (~> 0.6.0)
@@ -50,6 +50,7 @@ GEM
50
50
  pry (>= 0.13, < 0.15)
51
51
  rainbow (3.1.1)
52
52
  rake (13.0.6)
53
+ rdiscount (2.2.7.1)
53
54
  regexp_parser (2.7.0)
54
55
  rexml (3.2.5)
55
56
  rspec (3.11.0)
@@ -89,17 +90,21 @@ GEM
89
90
  tzinfo (2.0.6)
90
91
  concurrent-ruby (~> 1.0)
91
92
  unicode-display_width (2.4.2)
93
+ yard (0.9.34)
92
94
 
93
95
  PLATFORMS
96
+ arm64-darwin-21
94
97
  x86_64-darwin-19
95
98
  x86_64-linux
96
99
 
97
100
  DEPENDENCIES
98
101
  pry-byebug (~> 3.9)
99
102
  rake (~> 13.0)
103
+ rdiscount
100
104
  rspec (~> 3.0)
101
105
  standard (~> 1.25.0)
102
106
  weaviate-ruby!
107
+ yard
103
108
 
104
109
  BUNDLED WITH
105
110
  2.4.0
data/README.md CHANGED
@@ -6,9 +6,15 @@
6
6
  <img alt='Ruby logo' src='https://user-images.githubusercontent.com/541665/230231593-43861278-4550-421d-a543-fd3553aac4f6.png' height='40' />
7
7
  </p>
8
8
 
9
- Ruby wrapper for the Weaviate.io API
9
+ Ruby wrapper for the Weaviate.io API.
10
10
 
11
- ![Tests status](https://github.com/andreibondarev/weaviate-ruby/actions/workflows/ci.yml/badge.svg) [![Gem Version](https://badge.fury.io/rb/weaviate-ruby.svg)](https://badge.fury.io/rb/weaviate-ruby)
11
+ Part of the [Langchain.rb](https://github.com/andreibondarev/langchainrb) stack.
12
+
13
+ ![Tests status](https://github.com/andreibondarev/weaviate-ruby/actions/workflows/ci.yml/badge.svg)
14
+ [![Gem Version](https://badge.fury.io/rb/weaviate-ruby.svg)](https://badge.fury.io/rb/weaviate-ruby)
15
+ [![Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/gems/weaviate-ruby)
16
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/andreibondarev/weaviate-ruby/blob/main/LICENSE.txt)
17
+ [![](https://dcbadge.vercel.app/api/server/WDARp7J2n8?compact=true&style=flat)](https://discord.gg/WDARp7J2n8)
12
18
 
13
19
  ## Installation
14
20
 
data/Rakefile CHANGED
@@ -2,7 +2,12 @@
2
2
 
3
3
  require "bundler/gem_tasks"
4
4
  require "rspec/core/rake_task"
5
+ require "yard"
5
6
 
6
7
  RSpec::Core::RakeTask.new(:spec)
7
8
 
8
9
  task default: :spec
10
+
11
+ YARD::Rake::YardocTask.new do |t|
12
+ t.options = ["--fail-on-warning"]
13
+ end
@@ -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.3"
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.3
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-26 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
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.9'
69
+ - !ruby/object:Gem::Dependency
70
+ name: yard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rdiscount
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  description: Ruby wrapper for the Weaviate.io API
70
98
  email:
71
99
  - andrei@sourcelabs.io