weaviate-ruby 0.7.3 → 0.8.1

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: 8565b08277a636e7d6ff9897060d1dafd4cb97292077f1b8f0ade8cc87ac019f
4
- data.tar.gz: 960edbba086f83764c23d81b430931d9a4b3597f2fdd09a90d4f70552262d276
3
+ metadata.gz: ff43dd4e48354bba53771fbc30f7c865f9df31d5dcc667b0b4b4f2d907eac333
4
+ data.tar.gz: a3dd981006d613a1cc459f73d1fdc097900d92f51d05949ae66d55382311a301
5
5
  SHA512:
6
- metadata.gz: f379f83adba19db042892faf35132c7a1f500653007e3627eedb07697916bb9720b136b8e72137fb22e738a974ec6d6e5249aee6620954e268ebc5a3fb151289
7
- data.tar.gz: ea3bff55f289ac6fbf41a183248538c64b9d5534258507bf392c330248f618417ff897efb9b5724a294285d797cdec30444009aa2296d6da346ef70d4e48092a
6
+ metadata.gz: cfd1bc9822c6ad3326f165de30480d67f71ba6f72eacb0a8eeb95c45e38d903b46d61b1b86d9b73a841ebf60d0e6f13b5e472288fca1fbb0fba640f825b54cad
7
+ data.tar.gz: 59e369bd4676ae0ad3a7429e5355db9898638ff339dc6779f99a4585f340243c4f25065af276eaff67add8aa58871539c726afd9f4096cacf8ce3ecf96c77490
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.8.0] - 2023-04-18
4
+
5
+ ### Breaking
6
+ - Initializing the weaviate client requires the single `url:` key instead of separate `host:` and `schema:`
7
+
3
8
  ## [0.1.0] - 2023-03-24
4
9
 
5
10
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- weaviate-ruby (0.7.3)
5
- faraday (~> 2.7)
6
- graphlient (~> 0.7.0)
4
+ weaviate-ruby (0.8.1)
5
+ faraday (~> 1)
6
+ faraday_middleware (~> 1)
7
+ graphlient (~> 0.6.0)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
@@ -18,12 +19,14 @@ GEM
18
19
  coderay (1.1.3)
19
20
  concurrent-ruby (1.2.2)
20
21
  diff-lcs (1.5.0)
21
- faraday (2.7.4)
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)
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
27
30
  graphql-client
28
31
  graphql (2.0.19)
29
32
  graphql-client (0.18.0)
@@ -35,6 +38,7 @@ GEM
35
38
  language_server-protocol (3.17.0.3)
36
39
  method_source (1.0.0)
37
40
  minitest (5.18.0)
41
+ multipart-post (2.3.0)
38
42
  parallel (1.22.1)
39
43
  parser (3.2.1.1)
40
44
  ast (~> 2.4.1)
data/README.md CHANGED
@@ -28,8 +28,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
28
28
  require 'weaviate'
29
29
 
30
30
  client = Weaviate::Client.new(
31
- scheme: 'https',
32
- host: 'some-endpoint.weaviate.network', # Replace with your endpoint
31
+ url: 'https://some-endpoint.weaviate.network', # Replace with your endpoint
33
32
  api_key: '', # Weaviate API key
34
33
  model_service: :openai, # Service that will be used to generate vectors. Possible values: :openai, :cohere, :huggingface
35
34
  model_service_api_key: 'xxxxxxx' # Either OpenAI, Cohere or Hugging Face API key
@@ -170,6 +169,7 @@ client.objects.batch_delete(
170
169
  #### Get{}
171
170
  ```ruby
172
171
  near_text = '{ concepts: ["biology"] }'
172
+ near_vector = '{ vector: [0.1, 0.2, ...] }'
173
173
  sort_obj = '{ path: ["category"], order: desc }'
174
174
  where_obj = '{ path: ["id"], operator: Equal, valueString: "..." }'
175
175
  with_hybrid = '{ query: "Sweets", alpha: 0.5 }'
@@ -181,7 +181,7 @@ client.query.get(
181
181
  offset: "1",
182
182
  after: "id",
183
183
  sort: sort_obj,
184
- where_obj: where_obj,
184
+ where: where_obj,
185
185
 
186
186
  # To use this parameter you must have created your schema by setting the `vectorizer:` property to
187
187
  # either 'text2vec-transformers', 'text2vec-contextionary', 'text2vec-openai', 'multi2vec-clip', 'text2vec-huggingface' or 'text2vec-cohere'
@@ -189,6 +189,8 @@ client.query.get(
189
189
 
190
190
  # To use this parameter you must have created your schema by setting the `vectorizer:` property to 'multi2vec-clip' or 'img2vec-neural'
191
191
  near_image: near_image,
192
+
193
+ near_vector: near_vector,
192
194
 
193
195
  with_hybrid: with_hybrid,
194
196
 
@@ -1,11 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "faraday"
4
+ require "faraday_middleware"
4
5
  require "graphlient"
5
6
 
6
7
  module Weaviate
7
8
  class Client
8
- attr_reader :scheme, :host, :api_key, :model_service, :model_service_api_key, :adapter
9
+ attr_reader :url, :api_key, :model_service, :model_service_api_key, :adapter
9
10
 
10
11
  API_VERSION = "v1"
11
12
 
@@ -16,8 +17,7 @@ module Weaviate
16
17
  }
17
18
 
18
19
  def initialize(
19
- scheme:,
20
- host:,
20
+ url:,
21
21
  api_key: nil,
22
22
  model_service: nil,
23
23
  model_service_api_key: nil,
@@ -25,8 +25,7 @@ module Weaviate
25
25
  )
26
26
  validate_model_service!(model_service) unless model_service.nil?
27
27
 
28
- @scheme = scheme
29
- @host = host
28
+ @url = url
30
29
  @api_key = api_key
31
30
  @model_service = model_service
32
31
  @model_service_api_key = model_service_api_key
@@ -89,7 +88,7 @@ module Weaviate
89
88
  end
90
89
 
91
90
  @graphql ||= Graphlient::Client.new(
92
- "#{scheme}://#{host}/#{API_VERSION}/graphql",
91
+ "#{url}/#{API_VERSION}/graphql",
93
92
  headers: headers,
94
93
  http_options: {
95
94
  read_timeout: 20,
@@ -99,7 +98,7 @@ module Weaviate
99
98
  end
100
99
 
101
100
  def connection
102
- @connection ||= Faraday.new(url: "#{scheme}://#{host}/#{API_VERSION}/") do |faraday|
101
+ @connection ||= Faraday.new(url: "#{url}/#{API_VERSION}/") do |faraday|
103
102
  if api_key
104
103
  faraday.request :authorization, :Bearer, api_key
105
104
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Weaviate
4
- VERSION = "0.7.3"
4
+ VERSION = "0.8.1"
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.7.3
4
+ version: 0.8.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: 2023-04-13 00:00:00.000000000 Z
11
+ date: 2023-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,28 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.7'
19
+ version: '1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.7'
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'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: graphlient
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: 0.7.0
47
+ version: 0.6.0
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: 0.7.0
54
+ version: 0.6.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: pry-byebug
43
57
  requirement: !ruby/object:Gem::Requirement