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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -2
- data/lib/weaviate/client.rb +5 -0
- data/lib/weaviate/query.rb +6 -2
- data/lib/weaviate/schema.rb +0 -2
- data/lib/weaviate/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb982e0efa4f7af24b5e5ddc344da70ada13abaf498c2b2cc23eabb0659a78f6
|
4
|
+
data.tar.gz: cb1caf49e8e3585f95f7a43d5b6c02acbfe52c4095c3594bd98ba3becc489c09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ee15a3b1c4b1a8df15e836e82073310911f7ccb298c49f44cc290533ce407ae5e7410b50424455ac228348ccd2c36b7adc693ffac668876e2af6306b6d7d28e
|
7
|
+
data.tar.gz: f9cae1a701db54b908409f1e631d7d1103e6ebef16949d273e565f994bb7eb5cae863372b1141a9646d2509c7b5570a88031855bfa8c4f88a39e71c8c0f70610
|
data/Gemfile.lock
CHANGED
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
|
+
|
6
|
-
<img alt='
|
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:
|
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:
|
data/lib/weaviate/client.rb
CHANGED
@@ -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,
|
data/lib/weaviate/query.rb
CHANGED
@@ -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
|
) {
|
data/lib/weaviate/schema.rb
CHANGED
data/lib/weaviate/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2023-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|