weaviate-ruby 0.7.2 → 0.7.3
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/lib/weaviate/client.rb +2 -26
- data/lib/weaviate/query.rb +12 -0
- data/lib/weaviate/version.rb +1 -1
- data/lib/weaviate.rb +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8565b08277a636e7d6ff9897060d1dafd4cb97292077f1b8f0ade8cc87ac019f
|
4
|
+
data.tar.gz: 960edbba086f83764c23d81b430931d9a4b3597f2fdd09a90d4f70552262d276
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f379f83adba19db042892faf35132c7a1f500653007e3627eedb07697916bb9720b136b8e72137fb22e738a974ec6d6e5249aee6620954e268ebc5a3fb151289
|
7
|
+
data.tar.gz: ea3bff55f289ac6fbf41a183248538c64b9d5534258507bf392c330248f618417ff897efb9b5724a294285d797cdec30444009aa2296d6da346ef70d4e48092a
|
data/Gemfile.lock
CHANGED
data/lib/weaviate/client.rb
CHANGED
@@ -5,8 +5,7 @@ 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
|
9
|
-
:username, :password
|
8
|
+
attr_reader :scheme, :host, :api_key, :model_service, :model_service_api_key, :adapter
|
10
9
|
|
11
10
|
API_VERSION = "v1"
|
12
11
|
|
@@ -22,9 +21,7 @@ module Weaviate
|
|
22
21
|
api_key: nil,
|
23
22
|
model_service: nil,
|
24
23
|
model_service_api_key: nil,
|
25
|
-
adapter: Faraday.default_adapter
|
26
|
-
username: nil,
|
27
|
-
password: nil
|
24
|
+
adapter: Faraday.default_adapter
|
28
25
|
)
|
29
26
|
validate_model_service!(model_service) unless model_service.nil?
|
30
27
|
|
@@ -34,8 +31,6 @@ module Weaviate
|
|
34
31
|
@model_service = model_service
|
35
32
|
@model_service_api_key = model_service_api_key
|
36
33
|
@adapter = adapter
|
37
|
-
@username = username
|
38
|
-
@password = password
|
39
34
|
end
|
40
35
|
|
41
36
|
def oidc
|
@@ -82,10 +77,6 @@ module Weaviate
|
|
82
77
|
@query ||= Weaviate::Query.new(client: self)
|
83
78
|
end
|
84
79
|
|
85
|
-
def clusters
|
86
|
-
@clusters ||= Weaviate::Clusters.new(client: self)
|
87
|
-
end
|
88
|
-
|
89
80
|
def graphql
|
90
81
|
headers = {}
|
91
82
|
|
@@ -107,21 +98,6 @@ module Weaviate
|
|
107
98
|
)
|
108
99
|
end
|
109
100
|
|
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
|
-
|
125
101
|
def connection
|
126
102
|
@connection ||= Faraday.new(url: "#{scheme}://#{host}/#{API_VERSION}/") do |faraday|
|
127
103
|
if api_key
|
data/lib/weaviate/query.rb
CHANGED
@@ -12,6 +12,7 @@ module Weaviate
|
|
12
12
|
where: nil,
|
13
13
|
near_text: nil,
|
14
14
|
near_vector: nil,
|
15
|
+
near_image: nil,
|
15
16
|
near_object: nil,
|
16
17
|
with_hybrid: nil,
|
17
18
|
bm25: nil,
|
@@ -25,6 +26,7 @@ module Weaviate
|
|
25
26
|
where: where,
|
26
27
|
near_text: near_text,
|
27
28
|
near_vector: near_vector,
|
29
|
+
near_image: near_image,
|
28
30
|
near_object: near_object,
|
29
31
|
with_hybrid: with_hybrid,
|
30
32
|
bm25: bm25,
|
@@ -45,6 +47,7 @@ module Weaviate
|
|
45
47
|
object_limit: nil,
|
46
48
|
near_text: nil,
|
47
49
|
near_vector: nil,
|
50
|
+
near_image: nil,
|
48
51
|
near_object: nil,
|
49
52
|
group_by: nil
|
50
53
|
)
|
@@ -54,6 +57,7 @@ module Weaviate
|
|
54
57
|
fields: fields,
|
55
58
|
near_text: near_text,
|
56
59
|
near_vector: near_vector,
|
60
|
+
near_image: near_image,
|
57
61
|
near_object: near_object
|
58
62
|
),
|
59
63
|
group_by: group_by,
|
@@ -73,6 +77,7 @@ module Weaviate
|
|
73
77
|
where: nil,
|
74
78
|
near_text: nil,
|
75
79
|
near_vector: nil,
|
80
|
+
near_image: nil,
|
76
81
|
near_object: nil
|
77
82
|
)
|
78
83
|
response = client.graphql.execute(
|
@@ -80,6 +85,7 @@ module Weaviate
|
|
80
85
|
fields: fields,
|
81
86
|
near_text: near_text,
|
82
87
|
near_vector: near_vector,
|
88
|
+
near_image: near_image,
|
83
89
|
near_object: near_object
|
84
90
|
),
|
85
91
|
after: after,
|
@@ -98,6 +104,7 @@ module Weaviate
|
|
98
104
|
where: nil,
|
99
105
|
near_text: nil,
|
100
106
|
near_vector: nil,
|
107
|
+
near_image: nil,
|
101
108
|
near_object: nil,
|
102
109
|
sort: nil
|
103
110
|
)
|
@@ -111,6 +118,7 @@ module Weaviate
|
|
111
118
|
offset: $offset,
|
112
119
|
#{near_text.present? ? "nearText: #{near_text}" : ""},
|
113
120
|
#{near_vector.present? ? "nearVector: #{near_vector}" : ""},
|
121
|
+
#{near_image.present? ? "nearImage: #{near_image}" : ""},
|
114
122
|
#{near_object.present? ? "nearObject: #{near_object}" : ""}
|
115
123
|
#{where.present? ? "where: #{where}" : ""},
|
116
124
|
#{sort.present? ? "sort: #{sort}" : ""}
|
@@ -127,6 +135,7 @@ module Weaviate
|
|
127
135
|
where: nil,
|
128
136
|
near_text: nil,
|
129
137
|
near_vector: nil,
|
138
|
+
near_image: nil,
|
130
139
|
near_object: nil,
|
131
140
|
with_hybrid: nil,
|
132
141
|
bm25: nil,
|
@@ -146,6 +155,7 @@ module Weaviate
|
|
146
155
|
offset: $offset,
|
147
156
|
#{near_text.present? ? "nearText: #{near_text}" : ""},
|
148
157
|
#{near_vector.present? ? "nearVector: #{near_vector}" : ""},
|
158
|
+
#{near_image.present? ? "nearImage: #{near_image}" : ""},
|
149
159
|
#{near_object.present? ? "nearObject: #{near_object}" : ""},
|
150
160
|
#{with_hybrid.present? ? "hybrid: #{with_hybrid}" : ""},
|
151
161
|
#{bm25.present? ? "bm25: #{bm25}" : ""},
|
@@ -165,6 +175,7 @@ module Weaviate
|
|
165
175
|
fields:,
|
166
176
|
near_text: nil,
|
167
177
|
near_vector: nil,
|
178
|
+
near_image: nil,
|
168
179
|
near_object: nil
|
169
180
|
)
|
170
181
|
client.graphql.parse <<~GRAPHQL
|
@@ -178,6 +189,7 @@ module Weaviate
|
|
178
189
|
groupBy: $group_by,
|
179
190
|
#{near_text.present? ? "nearText: #{near_text}" : ""},
|
180
191
|
#{near_vector.present? ? "nearVector: #{near_vector}" : ""},
|
192
|
+
#{near_image.present? ? "nearImage: #{near_image}" : ""},
|
181
193
|
#{near_object.present? ? "nearObject: #{near_object}" : ""}
|
182
194
|
) {
|
183
195
|
#{fields}
|
data/lib/weaviate/version.rb
CHANGED
data/lib/weaviate.rb
CHANGED
@@ -5,7 +5,6 @@ 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"
|
9
8
|
autoload :Error, "weaviate/error"
|
10
9
|
autoload :Schema, "weaviate/schema"
|
11
10
|
autoload :Meta, "weaviate/meta"
|