weaviate_record 0.0.4 → 0.1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d763c92aedebf48af6010dd279b83e50505efd1c2d754588826d90316bf0e71
|
4
|
+
data.tar.gz: ee07e2f4a8fba0243802c28383084cd0aa76a4259e780e3623c983a6a6475106
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65de891828ef016b2fff0a2971d765b140e2f0e573503feeb4e1ec2cc9a930410db22836bc9935681e4b1490851b76e66f99c1673840a56a274212f83666e064
|
7
|
+
data.tar.gz: cc284a067506e2fee9ddf45cbae30722d2e77caef7303ef68aa4fcfd283dfddc134728c8d6c2e0259aa501cf0e20ced0556a4647b8cf9782cae11b143ef56225
|
@@ -22,32 +22,46 @@ module WeaviateRecord
|
|
22
22
|
# Returns the present schema of the Weaviate database.
|
23
23
|
def schema_list
|
24
24
|
client.schema.list.deep_symbolize_keys!
|
25
|
+
rescue Faraday::ConnectionFailed => e
|
26
|
+
raise WeaviateRecord::Errors::DatabaseNotConnected, e.message, cause: nil
|
25
27
|
end
|
26
28
|
|
27
29
|
# :enddoc:
|
28
30
|
|
29
31
|
def find_call(id)
|
30
32
|
client.objects.get(class_name: @collection_name, id: id)
|
33
|
+
rescue Faraday::ConnectionFailed => e
|
34
|
+
raise WeaviateRecord::Errors::DatabaseNotConnected, e.message, cause: nil
|
31
35
|
end
|
32
36
|
|
33
37
|
def create_call(properties)
|
34
38
|
client.objects.create(class_name: @collection_name, properties: properties)
|
39
|
+
rescue Faraday::ConnectionFailed => e
|
40
|
+
raise WeaviateRecord::Errors::DatabaseNotConnected, e.message, cause: nil
|
35
41
|
end
|
36
42
|
|
37
43
|
def update_call(id, properties)
|
38
44
|
client.objects.update(class_name: @collection_name, id: id, properties: properties)
|
45
|
+
rescue Faraday::ConnectionFailed => e
|
46
|
+
raise WeaviateRecord::Errors::DatabaseNotConnected, e.message, cause: nil
|
39
47
|
end
|
40
48
|
|
41
49
|
def delete_call(id)
|
42
50
|
client.objects.delete(class_name: @collection_name, id: id)
|
51
|
+
rescue Faraday::ConnectionFailed => e
|
52
|
+
raise WeaviateRecord::Errors::DatabaseNotConnected, e.message, cause: nil
|
43
53
|
end
|
44
54
|
|
45
55
|
def check_existence(id)
|
46
56
|
client.objects.exists?(class_name: @collection_name, id: id)
|
57
|
+
rescue Faraday::ConnectionFailed => e
|
58
|
+
raise WeaviateRecord::Errors::DatabaseNotConnected, e.message, cause: nil
|
47
59
|
end
|
48
60
|
|
49
61
|
def delete_where(condition)
|
50
62
|
client.objects.batch_delete(class_name: @collection_name, where: condition)
|
63
|
+
rescue Faraday::ConnectionFailed => e
|
64
|
+
raise WeaviateRecord::Errors::DatabaseNotConnected, e.message, cause: nil
|
51
65
|
end
|
52
66
|
end
|
53
67
|
end
|
@@ -6,7 +6,7 @@ module WeaviateRecord
|
|
6
6
|
module Order
|
7
7
|
# Sort the records based on the given attributes.
|
8
8
|
# You can pass multiple attributes to sort the records.
|
9
|
-
# This sorting specification will be ignored if you are performing
|
9
|
+
# This sorting specification will be ignored if you are performing +bm25+ search.
|
10
10
|
#
|
11
11
|
# ==== Example:
|
12
12
|
# Article.order(:title)
|
@@ -88,12 +88,21 @@ module WeaviateRecord
|
|
88
88
|
def create_query_condition(equation)
|
89
89
|
return null_condition(equation[0]) if equation[2].nil?
|
90
90
|
|
91
|
+
validate_attribute!(equation[0])
|
91
92
|
handle_timestamps_condition(equation)
|
92
93
|
"{ path: [\"#{equation[0]}\"], " \
|
93
94
|
"operator: #{map_operator(equation[1])}, " \
|
94
95
|
"#{map_value_type(equation[2])}: #{equation[2].inspect} }"
|
95
96
|
end
|
96
97
|
|
98
|
+
def validate_attribute!(attribute)
|
99
|
+
unless ['id', 'created_at', 'updated_at',
|
100
|
+
*WeaviateRecord::Schema.find_collection(@klass).attributes_list].include?(attribute)
|
101
|
+
raise WeaviateRecord::Errors::InvalidAttributeError,
|
102
|
+
"Invalid attribute #{attribute} used for collection #{@klass}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
97
106
|
def handle_timestamps_condition(equation_array)
|
98
107
|
return nil unless equation_array[0] == 'created_at' || equation_array[0] == 'updated_at'
|
99
108
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weaviate_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sriram V
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06
|
11
|
+
date: 2024-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -53,8 +53,8 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.4'
|
55
55
|
description: An ORM for Weaviate vector database that follows the same conventions
|
56
|
-
as the ActiveRecord
|
57
|
-
|
56
|
+
as the ActiveRecord and brings the power of Vector database and Retrieval augmented
|
57
|
+
generation (RAG) to your Ruby application.
|
58
58
|
email: srira.venkat@gmail.com
|
59
59
|
executables: []
|
60
60
|
extensions: []
|