weaviate-ruby 0.7.1 → 0.7.2

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: fb982e0efa4f7af24b5e5ddc344da70ada13abaf498c2b2cc23eabb0659a78f6
4
- data.tar.gz: cb1caf49e8e3585f95f7a43d5b6c02acbfe52c4095c3594bd98ba3becc489c09
3
+ metadata.gz: f1944f940c8677b6293af834af96e6b2c3635475703bffb96a123bfc7e164a4d
4
+ data.tar.gz: c4b719e54d31ae823054bd40d1a450efd7c5d7738bca23fb8187366ee4e9e140
5
5
  SHA512:
6
- metadata.gz: 9ee15a3b1c4b1a8df15e836e82073310911f7ccb298c49f44cc290533ce407ae5e7410b50424455ac228348ccd2c36b7adc693ffac668876e2af6306b6d7d28e
7
- data.tar.gz: f9cae1a701db54b908409f1e631d7d1103e6ebef16949d273e565f994bb7eb5cae863372b1141a9646d2509c7b5570a88031855bfa8c4f88a39e71c8c0f70610
6
+ metadata.gz: 4e81d9d0960153df197c746b120408f74a08da2c6336665e73756243e6ba2d84354b8ef6770998cae8d0411904a988fa0ec82f2ccba1d69ec4da6765b2da65c8
7
+ data.tar.gz: 62751834232ad87ef75aa115c55781dd9d9aec47ecddea7c9b21a035c91ebf8824dad0a506c7c8d44fa56ac8f16bb2f5295f5b7fdebf198ab5dc6c6d480392dd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- weaviate-ruby (0.7.1)
4
+ weaviate-ruby (0.7.2)
5
5
  faraday (~> 2.7)
6
6
  graphlient (~> 0.7.0)
7
7
 
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
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)
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)
12
12
 
13
13
  ## Installation
14
14
 
@@ -172,6 +172,7 @@ client.objects.batch_delete(
172
172
  near_text = '{ concepts: ["biology"] }'
173
173
  sort_obj = '{ path: ["category"], order: desc }'
174
174
  where_obj = '{ path: ["id"], operator: Equal, valueString: "..." }'
175
+ with_hybrid = '{ query: "Sweets", alpha: 0.5 }'
175
176
 
176
177
  client.query.get(
177
178
  class_name: 'Question',
@@ -187,13 +188,13 @@ client.query.get(
187
188
  near_text: near_text,
188
189
 
189
190
  # To use this parameter you must have created your schema by setting the `vectorizer:` property to 'multi2vec-clip' or 'img2vec-neural'
190
- # near_image: ...,
191
+ near_image: near_image,
191
192
 
192
- # hybrid: ...,
193
+ with_hybrid: with_hybrid,
193
194
 
194
- # bm25: ...,
195
+ bm25: bm25,
195
196
 
196
- # near_object: ...,
197
+ near_object: near_object,
197
198
 
198
199
  ask: '{ question: "your-question?" }'
199
200
  )
@@ -5,7 +5,8 @@ require "graphlient"
5
5
 
6
6
  module Weaviate
7
7
  class Client
8
- attr_reader :scheme, :host, :api_key, :model_service, :model_service_api_key, :adapter
8
+ attr_reader :scheme, :host, :api_key, :model_service, :model_service_api_key, :adapter,
9
+ :username, :password
9
10
 
10
11
  API_VERSION = "v1"
11
12
 
@@ -21,7 +22,9 @@ module Weaviate
21
22
  api_key: nil,
22
23
  model_service: nil,
23
24
  model_service_api_key: nil,
24
- adapter: Faraday.default_adapter
25
+ adapter: Faraday.default_adapter,
26
+ username: nil,
27
+ password: nil
25
28
  )
26
29
  validate_model_service!(model_service) unless model_service.nil?
27
30
 
@@ -31,6 +34,8 @@ module Weaviate
31
34
  @model_service = model_service
32
35
  @model_service_api_key = model_service_api_key
33
36
  @adapter = adapter
37
+ @username = username
38
+ @password = password
34
39
  end
35
40
 
36
41
  def oidc
@@ -77,6 +82,10 @@ module Weaviate
77
82
  @query ||= Weaviate::Query.new(client: self)
78
83
  end
79
84
 
85
+ def clusters
86
+ @clusters ||= Weaviate::Clusters.new(client: self)
87
+ end
88
+
80
89
  def graphql
81
90
  headers = {}
82
91
 
@@ -98,6 +107,21 @@ module Weaviate
98
107
  )
99
108
  end
100
109
 
110
+ def wsc
111
+ @wsc ||= Faraday.new(url: "https://wcs.api.semi.technology/v1") do |faraday|
112
+ # if api_key
113
+ # faraday.request :authorization, :Bearer, api_key
114
+ if password && username
115
+ # faraday.request :authorization, :Basic, Base64.encode64("#{username}:#{password}")
116
+ end
117
+
118
+
119
+ faraday.request :json
120
+ faraday.response :json, content_type: /\bjson$/
121
+ faraday.adapter adapter
122
+ end
123
+ end
124
+
101
125
  def connection
102
126
  @connection ||= Faraday.new(url: "#{scheme}://#{host}/#{API_VERSION}/") do |faraday|
103
127
  if api_key
@@ -13,6 +13,8 @@ module Weaviate
13
13
  near_text: nil,
14
14
  near_vector: nil,
15
15
  near_object: nil,
16
+ with_hybrid: nil,
17
+ bm25: nil,
16
18
  ask: nil
17
19
  )
18
20
  response = client.graphql.execute(
@@ -24,6 +26,8 @@ module Weaviate
24
26
  near_text: near_text,
25
27
  near_vector: near_vector,
26
28
  near_object: near_object,
29
+ with_hybrid: with_hybrid,
30
+ bm25: bm25,
27
31
  ask: ask
28
32
  ),
29
33
  after: after,
@@ -124,6 +128,8 @@ module Weaviate
124
128
  near_text: nil,
125
129
  near_vector: nil,
126
130
  near_object: nil,
131
+ with_hybrid: nil,
132
+ bm25: nil,
127
133
  ask: nil,
128
134
  sort: nil
129
135
  )
@@ -141,6 +147,8 @@ module Weaviate
141
147
  #{near_text.present? ? "nearText: #{near_text}" : ""},
142
148
  #{near_vector.present? ? "nearVector: #{near_vector}" : ""},
143
149
  #{near_object.present? ? "nearObject: #{near_object}" : ""},
150
+ #{with_hybrid.present? ? "hybrid: #{with_hybrid}" : ""},
151
+ #{bm25.present? ? "bm25: #{bm25}" : ""},
144
152
  #{ask.present? ? "ask: #{ask}" : ""},
145
153
  #{where.present? ? "where: #{where}" : ""},
146
154
  #{sort.present? ? "sort: #{sort}" : ""}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Weaviate
4
- VERSION = "0.7.1"
4
+ VERSION = "0.7.2"
5
5
  end
data/lib/weaviate.rb CHANGED
@@ -5,6 +5,7 @@ require_relative "weaviate/version"
5
5
  module Weaviate
6
6
  autoload :Base, "weaviate/base"
7
7
  autoload :Client, "weaviate/client"
8
+ autoload :Clusters, "weaviate/clusters"
8
9
  autoload :Error, "weaviate/error"
9
10
  autoload :Schema, "weaviate/schema"
10
11
  autoload :Meta, "weaviate/meta"
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.1
4
+ version: 0.7.2
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-09 00:00:00.000000000 Z
11
+ date: 2023-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday