weaviate-ruby 0.7.0 → 0.7.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: eec9c4e909fa4b73ed59023c291cbc0171c72fcc2aeeef2773b6744b2de6144c
4
- data.tar.gz: b66b81b77feb0b5777a15ef833eea0ebdd7f1660208c5f53893887c95aa56201
3
+ metadata.gz: fb982e0efa4f7af24b5e5ddc344da70ada13abaf498c2b2cc23eabb0659a78f6
4
+ data.tar.gz: cb1caf49e8e3585f95f7a43d5b6c02acbfe52c4095c3594bd98ba3becc489c09
5
5
  SHA512:
6
- metadata.gz: 2b32d7546e9dc5484b63abe834667e03733e694b1fd6d7c10306cc09cb96ecbb8e63f84aaa682452ae881de79cf3f6f2c49dccf744761e6c95a7539e3feef068
7
- data.tar.gz: 1a3774e88f29d0de254bd06b912bbcf4b4fa33cfa2b0ac87a60c38e340503c9119fdc6556bc5d7ff77c06097519e9f9122d2ef6cc8ca1541c245091c4bef0115
6
+ metadata.gz: 9ee15a3b1c4b1a8df15e836e82073310911f7ccb298c49f44cc290533ce407ae5e7410b50424455ac228348ccd2c36b7adc693ffac668876e2af6306b6d7d28e
7
+ data.tar.gz: f9cae1a701db54b908409f1e631d7d1103e6ebef16949d273e565f994bb7eb5cae863372b1141a9646d2509c7b5570a88031855bfa8c4f88a39e71c8c0f70610
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- weaviate-ruby (0.6.0)
4
+ weaviate-ruby (0.7.1)
5
5
  faraday (~> 2.7)
6
6
  graphlient (~> 0.7.0)
7
7
 
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <p>
4
4
  <img alt='Weaviate logo' src='https://weaviate.io/img/site/weaviate-logo-light.png' height='50' />
5
5
  +&nbsp;&nbsp;
6
- <img alt='Weaviate logo' src='https://user-images.githubusercontent.com/541665/230231593-43861278-4550-421d-a543-fd3553aac4f6.png' height='40' />
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
9
  Ruby wrapper for the Weaviate.io API
@@ -175,7 +175,7 @@ where_obj = '{ path: ["id"], operator: Equal, valueString: "..." }'
175
175
 
176
176
  client.query.get(
177
177
  class_name: 'Question',
178
- fields: 'question answer category',
178
+ fields: "question answer category _additional { answer { result hasAnswer property startPosition endPosition } }",
179
179
  limit: "1",
180
180
  offset: "1",
181
181
  after: "id",
@@ -194,6 +194,8 @@ client.query.get(
194
194
  # bm25: ...,
195
195
 
196
196
  # near_object: ...,
197
+
198
+ ask: '{ question: "your-question?" }'
197
199
  )
198
200
 
199
201
  # Example queries:
@@ -79,10 +79,15 @@ module Weaviate
79
79
 
80
80
  def graphql
81
81
  headers = {}
82
+
82
83
  if model_service && model_service_api_key
83
84
  headers[API_KEY_HEADERS[model_service]] = model_service_api_key
84
85
  end
85
86
 
87
+ if api_key
88
+ headers["Authorization"] = "Bearer #{api_key}"
89
+ end
90
+
86
91
  @graphql ||= Graphlient::Client.new(
87
92
  "#{scheme}://#{host}/#{API_VERSION}/graphql",
88
93
  headers: headers,
@@ -12,7 +12,8 @@ module Weaviate
12
12
  where: nil,
13
13
  near_text: nil,
14
14
  near_vector: nil,
15
- near_object: nil
15
+ near_object: nil,
16
+ ask: nil
16
17
  )
17
18
  response = client.graphql.execute(
18
19
  get_query(
@@ -22,7 +23,8 @@ module Weaviate
22
23
  where: where,
23
24
  near_text: near_text,
24
25
  near_vector: near_vector,
25
- near_object: near_object
26
+ near_object: near_object,
27
+ ask: ask
26
28
  ),
27
29
  after: after,
28
30
  limit: limit,
@@ -122,6 +124,7 @@ module Weaviate
122
124
  near_text: nil,
123
125
  near_vector: nil,
124
126
  near_object: nil,
127
+ ask: nil,
125
128
  sort: nil
126
129
  )
127
130
  client.graphql.parse <<~GRAPHQL
@@ -138,6 +141,7 @@ module Weaviate
138
141
  #{near_text.present? ? "nearText: #{near_text}" : ""},
139
142
  #{near_vector.present? ? "nearVector: #{near_vector}" : ""},
140
143
  #{near_object.present? ? "nearObject: #{near_object}" : ""},
144
+ #{ask.present? ? "ask: #{ask}" : ""},
141
145
  #{where.present? ? "where: #{where}" : ""},
142
146
  #{sort.present? ? "sort: #{sort}" : ""}
143
147
  ) {
@@ -46,8 +46,6 @@ module Weaviate
46
46
  req.body["replicationConfig"] = replication_config unless replication_config.nil?
47
47
  end
48
48
 
49
- if response.success?
50
- end
51
49
  response.body
52
50
  end
53
51
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Weaviate
4
- VERSION = "0.7.0"
4
+ VERSION = "0.7.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.0
4
+ version: 0.7.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-05 00:00:00.000000000 Z
11
+ date: 2023-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday