anndb_api 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/anndb_api.rb +1 -0
- data/lib/anndb_api/client.rb +29 -0
- data/lib/anndb_api/dataset.rb +54 -0
- data/lib/anndb_api/image_dataset.rb +79 -0
- data/lib/anndb_api/text_dataset.rb +57 -0
- data/lib/anndb_api/util.rb +11 -0
- data/lib/anndb_api/vector_dataset.rb +61 -0
- data/lib/core_pb.rb +48 -0
- data/lib/image_dataset_pb.rb +33 -0
- data/lib/image_dataset_services_pb.rb +26 -0
- data/lib/text_dataset_pb.rb +28 -0
- data/lib/text_dataset_services_pb.rb +25 -0
- data/lib/vector_dataset_pb.rb +28 -0
- data/lib/vector_dataset_services_pb.rb +25 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 40231828a91cb8e7abaf19f7f59106653fd1a2f1879ef296af3b16ff254d0aa9
|
4
|
+
data.tar.gz: f5a4247b51dcbb1c0a0cd847057d3128e80b8230c18262085b1e158a6eb2a8d6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ae3175f1cb7b5f85d6aba9839f1df6850017ea77aba31ff692ee72cd4244f705bc07ac0e335d6b4c6f3a56ae91eae43059ac56d7b3a831714f1e67ff1530cb10
|
7
|
+
data.tar.gz: 2ce06b8904d9a2e87bfff59e009883c740a0e9ffa4f7a66cadd7a586a71e8147ea2d740f4d55595a7580cb9d289d60a030c4a6f6e83fe7a8710bc7a473353ab7
|
data/lib/anndb_api.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'anndb_api/client'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'anndb_api/image_dataset'
|
2
|
+
|
3
|
+
module AnndbApi
|
4
|
+
SERVER_ADDR = 'grpc-api.anndb.com:1433'
|
5
|
+
|
6
|
+
class Client
|
7
|
+
def initialize(api_key)
|
8
|
+
@api_key = api_key
|
9
|
+
end
|
10
|
+
|
11
|
+
def images(dataset_name)
|
12
|
+
AnndbApi::ImageDataset.new(AnndbApi::SERVER_ADDR, rpc_metadata_for_dataset(dataset_name))
|
13
|
+
end
|
14
|
+
|
15
|
+
def text(dataset_name)
|
16
|
+
AnndbApi::TextDataset.new(AnndbApi::SERVER_ADDR, rpc_metadata_for_dataset(dataset_name))
|
17
|
+
end
|
18
|
+
|
19
|
+
def vector(dataset_name)
|
20
|
+
AnndbApi::VectorDataset.new(AnndbApi::SERVER_ADDR, rpc_metadata_for_dataset(dataset_name))
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def rpc_metadata_for_dataset(dataset_name)
|
26
|
+
{ 'authorization': @api_key, 'dataset': dataset_name }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'anndb_api/util'
|
2
|
+
|
3
|
+
module AnndbApi
|
4
|
+
class DatasetOpError < RuntimeError
|
5
|
+
end
|
6
|
+
|
7
|
+
class Dataset
|
8
|
+
|
9
|
+
def delete(id)
|
10
|
+
format_dataset_op_result_single @stub.delete(AnndbApiPb::DeleteRequest.new(ids: [
|
11
|
+
AnndbApiPb::UUID.new(data: AnndbApi::Util.uuid_string_to_bytes(id))
|
12
|
+
]), { metadata: @rpc_metadata })
|
13
|
+
end
|
14
|
+
|
15
|
+
def delete_batch(ids)
|
16
|
+
format_dataset_op_result @stub.delete(AnndbApiPb::DeleteRequest.new(ids: ids.map { |id|
|
17
|
+
AnndbApiPb::UUID.new(data: AnndbApi::Util.uuid_string_to_bytes(id))
|
18
|
+
}), { metadata: @rpc_metadata })
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
|
23
|
+
def format_search_result(result)
|
24
|
+
result.items.map { |item|
|
25
|
+
{
|
26
|
+
id: AnndbApi::Util.ascii8bit_to_uuid(item.id),
|
27
|
+
metadata: item.metadata
|
28
|
+
}
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def format_dataset_op_result(result)
|
33
|
+
(0..result.ids.length-1).map { |i|
|
34
|
+
{
|
35
|
+
id: AnndbApi::Util.ascii8bit_to_uuid(result.ids[i].data),
|
36
|
+
error: result.errors[i].message
|
37
|
+
}
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def format_dataset_op_result_single(result)
|
42
|
+
error = result.errors.first.message
|
43
|
+
if error.length > 0
|
44
|
+
raise AnndbApi::DatasetOpError.new(error)
|
45
|
+
end
|
46
|
+
|
47
|
+
AnndbApi::Util.ascii8bit_to_uuid(result.ids.first.data)
|
48
|
+
end
|
49
|
+
|
50
|
+
def format_req_metadata(metadata)
|
51
|
+
metadata.collect{ |k, v| [k.to_s, v] }.to_h
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'grpc'
|
2
|
+
|
3
|
+
require 'anndb_api/dataset'
|
4
|
+
require 'core_pb'
|
5
|
+
require 'image_dataset_pb'
|
6
|
+
require 'image_dataset_services_pb'
|
7
|
+
|
8
|
+
module AnndbApi
|
9
|
+
class ImageDataset < AnndbApi::Dataset
|
10
|
+
def initialize(server_addr, rpc_metadata)
|
11
|
+
@rpc_metadata = rpc_metadata
|
12
|
+
@stub = AnndbApiPb::ImageDataset::Stub.new(server_addr, GRPC::Core::ChannelCredentials.new())
|
13
|
+
end
|
14
|
+
|
15
|
+
def insert(image, metadata = {})
|
16
|
+
format_dataset_op_result_single @stub.insert(AnndbApiPb::ImageDatasetRequest.new(items: [
|
17
|
+
AnndbApiPb::ImageItem.new(
|
18
|
+
image: image_proto(image),
|
19
|
+
metadata: format_req_metadata(metadata)
|
20
|
+
)
|
21
|
+
]), { metadata: @rpc_metadata })
|
22
|
+
end
|
23
|
+
|
24
|
+
def insert_batch(items)
|
25
|
+
format_dataset_op_result @stub.insert(AnndbApiPb::ImageDatasetRequest.new(items: items.map { |item|
|
26
|
+
AnndbApiPb::ImageItem.new(
|
27
|
+
image: image_proto(item[:image]),
|
28
|
+
metadata: format_req_metadata(item.fetch(:metadata, {}))
|
29
|
+
)
|
30
|
+
}), { metadata: @rpc_metadata })
|
31
|
+
end
|
32
|
+
|
33
|
+
def update(id, image, metadata = {})
|
34
|
+
format_dataset_op_result_single @stub.update(AnndbApiPb::ImageDatasetRequest.new(items: [
|
35
|
+
AnndbApiPb::ImageItem.new(
|
36
|
+
id: AnndbApiPb::UUID.new(data: AnndbApi::Util.uuid_string_to_bytes(id)),
|
37
|
+
image: image_proto(image),
|
38
|
+
metadata: format_req_metadata(metadata)
|
39
|
+
)
|
40
|
+
]), { metadata: @rpc_metadata })
|
41
|
+
end
|
42
|
+
|
43
|
+
def update_batch(items)
|
44
|
+
format_dataset_op_result @stub.update(AnndbApiPb::ImageDatasetRequest.new(items: items.map { |item|
|
45
|
+
AnndbApiPb::ImageItem.new(
|
46
|
+
id: AnndbApiPb::UUID.new(data: AnndbApi::Util.uuid_string_to_bytes(item[:id])),
|
47
|
+
image: image_proto(item[:image]),
|
48
|
+
metadata: format_req_metadata(item.fetch(:metadata, {}))
|
49
|
+
)
|
50
|
+
}), { metadata: @rpc_metadata })
|
51
|
+
end
|
52
|
+
|
53
|
+
def search_image(query, n)
|
54
|
+
format_search_result @stub.search_image(AnndbApiPb::ImageSearchImageRequest.new(
|
55
|
+
query: image_proto(query),
|
56
|
+
n: n.to_i
|
57
|
+
), { metadata: @rpc_metadata })
|
58
|
+
end
|
59
|
+
|
60
|
+
def search_text(query, n)
|
61
|
+
format_search_result @stub.search_text(AnndbApiPb::ImageSearchTextRequest.new(
|
62
|
+
query: query.to_s,
|
63
|
+
n: n.to_i
|
64
|
+
), { metadata: @rpc_metadata })
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def image_proto(img)
|
70
|
+
if img.is_a? Array
|
71
|
+
return AnndbApiPb::Image.new(data: img)
|
72
|
+
elsif img.is_a? String
|
73
|
+
return AnndbApiPb::Image.new(url: img)
|
74
|
+
end
|
75
|
+
|
76
|
+
raise TypeError.new('Image has to be either an array or a string')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'grpc'
|
2
|
+
|
3
|
+
require 'anndb_api/dataset'
|
4
|
+
require 'text_dataset_pb'
|
5
|
+
require 'text_dataset_services_pb'
|
6
|
+
|
7
|
+
module AnndbApi
|
8
|
+
class TextDataset < AnndbApi::Dataset
|
9
|
+
def initialize(server_addr, rpc_metadata)
|
10
|
+
@rpc_metadata = rpc_metadata
|
11
|
+
@stub = AnndbApiPb::TextDataset::Stub.new(server_addr, GRPC::Core::ChannelCredentials.new())
|
12
|
+
end
|
13
|
+
|
14
|
+
def insert(text, metadata = {})
|
15
|
+
format_dataset_op_result_single @stub.insert(AnndbApiPb::TextDatasetRequest.new(items: [
|
16
|
+
AnndbApiPb::TextItem.new(
|
17
|
+
text: text,
|
18
|
+
metadata: format_req_metadata(metadata)
|
19
|
+
)
|
20
|
+
]), { metadata: @rpc_metadata })
|
21
|
+
end
|
22
|
+
|
23
|
+
def insert_batch(items)
|
24
|
+
format_dataset_op_result @stub.insert(AnndbApiPb::TextDatasetRequest.new(items: items.map { |item|
|
25
|
+
AnndbApiPb::TextItem.new(
|
26
|
+
text: item[:text],
|
27
|
+
metadata: format_req_metadata(item.fetch(:metadata, {}))
|
28
|
+
)
|
29
|
+
|
30
|
+
}), { metadata: @rpc_metadata })
|
31
|
+
end
|
32
|
+
|
33
|
+
def update(id, text, metadata = {})
|
34
|
+
format_dataset_op_result_single @stub.update(AnndbApiPb::TextDatasetRequest.new(items: [
|
35
|
+
AnndbApiPb::TextItem.new(
|
36
|
+
id: AnndbApiPb::UUID.new(data: AnndbApi::Util.uuid_string_to_bytes(id)),
|
37
|
+
text: text,
|
38
|
+
metadata: format_req_metadata(metadata)
|
39
|
+
)
|
40
|
+
]), { metadata: @rpc_metadata })
|
41
|
+
end
|
42
|
+
|
43
|
+
def update_batch(items)
|
44
|
+
format_dataset_op_result @stub.update(AnndbApiPb::TextDatasetRequest.new(items: items.map { |item|
|
45
|
+
AnndbApiPb::ImageItem.new(
|
46
|
+
id: AnndbApiPb::UUID.new(data: AnndbApi::Util.uuid_string_to_bytes(item[:id])),
|
47
|
+
text: item[:text],
|
48
|
+
metadata: format_req_metadata(item.fetch(:metadata, {}))
|
49
|
+
)
|
50
|
+
}), { metadata: @rpc_metadata })
|
51
|
+
end
|
52
|
+
|
53
|
+
def search(query, n)
|
54
|
+
format_search_result @stub.search(AnndbApiPb::TextSearchRequest.new(query: query, n: n), { metadata: @rpc_metadata })
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'grpc'
|
2
|
+
|
3
|
+
require 'anndb_api/dataset'
|
4
|
+
require 'core_pb'
|
5
|
+
require 'vector_dataset_pb'
|
6
|
+
require 'vector_dataset_services_pb'
|
7
|
+
|
8
|
+
module AnndbApi
|
9
|
+
class VectorDataset < AnndbApi::Dataset
|
10
|
+
def initialize(server_addr, rpc_metadata)
|
11
|
+
@rpc_metadata = rpc_metadata
|
12
|
+
@stub = AnndbApiPb::VectorDataset::Stub.new(server_addr, GRPC::Core::ChannelCredentials.new())
|
13
|
+
end
|
14
|
+
|
15
|
+
def insert(vector, metadata = {})
|
16
|
+
format_dataset_op_result_single @stub.insert(AnndbApiPb::VectorDatasetRequest.new(items: [
|
17
|
+
AnndbApiPb::VectorItem.new(
|
18
|
+
vector: AnndbApiPb::Vector.new(values: vector),
|
19
|
+
metadata: format_req_metadata(metadata)
|
20
|
+
)
|
21
|
+
]), { metadata: @rpc_metadata })
|
22
|
+
end
|
23
|
+
|
24
|
+
def insert_batch(items)
|
25
|
+
format_dataset_op_result @stub.insert(AnndbApiPb::VectorDatasetRequest.new(items: items.map { |item|
|
26
|
+
AnndbApiPb::VectorItem.new(
|
27
|
+
vector: AnndbApiPb::Vector.new(values: item[:vector]),
|
28
|
+
metadata: format_req_metadata(item.fetch(:metadata, {}))
|
29
|
+
)
|
30
|
+
|
31
|
+
}), { metadata: @rpc_metadata })
|
32
|
+
end
|
33
|
+
|
34
|
+
def update(id, vector, metadata = {})
|
35
|
+
format_dataset_op_result_single @stub.update(AnndbApiPb::VectorDatasetRequest.new(items: [
|
36
|
+
AnndbApiPb::VectorItem.new(
|
37
|
+
id: AnndbApiPb::UUID.new(data: AnndbApi::Util.uuid_string_to_bytes(id)),
|
38
|
+
vector: AnndbApiPb::Vector.new(values: vector),
|
39
|
+
metadata: format_req_metadata(metadata)
|
40
|
+
)
|
41
|
+
]), { metadata: @rpc_metadata })
|
42
|
+
end
|
43
|
+
|
44
|
+
def update_batch(items)
|
45
|
+
format_dataset_op_result @stub.update(AnndbApiPb::VectorDatasetRequest.new(items: items.map { |item|
|
46
|
+
AnndbApiPb::ImageItem.new(
|
47
|
+
id: AnndbApiPb::UUID.new(data: AnndbApi::Util.uuid_string_to_bytes(item[:id])),
|
48
|
+
vector: AnndbApiPb::Vector.new(values: item[:vector]),
|
49
|
+
metadata: format_req_metadata(item.fetch(:metadata, {}))
|
50
|
+
)
|
51
|
+
}), { metadata: @rpc_metadata })
|
52
|
+
end
|
53
|
+
|
54
|
+
def search(query, n)
|
55
|
+
format_search_result @stub.search(AnndbApiPb::VectorSearchRequest.new(
|
56
|
+
query: AnndbApiPb::Vector.new(values: query),
|
57
|
+
n: n
|
58
|
+
), { metadata: @rpc_metadata })
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/core_pb.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: core.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("core.proto", :syntax => :proto3) do
|
8
|
+
add_message "anndb_api_pb.Image" do
|
9
|
+
optional :data, :bytes, 1
|
10
|
+
optional :url, :string, 2
|
11
|
+
end
|
12
|
+
add_message "anndb_api_pb.Vector" do
|
13
|
+
repeated :values, :float, 1
|
14
|
+
end
|
15
|
+
add_message "anndb_api_pb.UUID" do
|
16
|
+
optional :data, :bytes, 1
|
17
|
+
end
|
18
|
+
add_message "anndb_api_pb.Error" do
|
19
|
+
optional :code, :uint32, 1
|
20
|
+
optional :message, :string, 2
|
21
|
+
end
|
22
|
+
add_message "anndb_api_pb.DeleteRequest" do
|
23
|
+
repeated :ids, :message, 1, "anndb_api_pb.UUID"
|
24
|
+
end
|
25
|
+
add_message "anndb_api_pb.DatasetOpResult" do
|
26
|
+
repeated :ids, :message, 1, "anndb_api_pb.UUID"
|
27
|
+
repeated :errors, :message, 2, "anndb_api_pb.Error"
|
28
|
+
end
|
29
|
+
add_message "anndb_api_pb.SearchResult" do
|
30
|
+
repeated :items, :message, 1, "anndb_api_pb.SearchResultItem"
|
31
|
+
end
|
32
|
+
add_message "anndb_api_pb.SearchResultItem" do
|
33
|
+
optional :id, :bytes, 1
|
34
|
+
map :metadata, :string, :string, 2
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
module AnndbApiPb
|
40
|
+
Image = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.Image").msgclass
|
41
|
+
Vector = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.Vector").msgclass
|
42
|
+
UUID = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.UUID").msgclass
|
43
|
+
Error = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.Error").msgclass
|
44
|
+
DeleteRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.DeleteRequest").msgclass
|
45
|
+
DatasetOpResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.DatasetOpResult").msgclass
|
46
|
+
SearchResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.SearchResult").msgclass
|
47
|
+
SearchResultItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.SearchResultItem").msgclass
|
48
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: image_dataset.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'core_pb'
|
7
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
8
|
+
add_file("image_dataset.proto", :syntax => :proto3) do
|
9
|
+
add_message "anndb_api_pb.ImageDatasetRequest" do
|
10
|
+
repeated :items, :message, 1, "anndb_api_pb.ImageItem"
|
11
|
+
end
|
12
|
+
add_message "anndb_api_pb.ImageItem" do
|
13
|
+
optional :id, :message, 1, "anndb_api_pb.UUID"
|
14
|
+
optional :image, :message, 2, "anndb_api_pb.Image"
|
15
|
+
map :metadata, :string, :string, 3
|
16
|
+
end
|
17
|
+
add_message "anndb_api_pb.ImageSearchImageRequest" do
|
18
|
+
optional :query, :message, 1, "anndb_api_pb.Image"
|
19
|
+
optional :n, :uint32, 2
|
20
|
+
end
|
21
|
+
add_message "anndb_api_pb.ImageSearchTextRequest" do
|
22
|
+
optional :query, :string, 1
|
23
|
+
optional :n, :uint32, 2
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
module AnndbApiPb
|
29
|
+
ImageDatasetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.ImageDatasetRequest").msgclass
|
30
|
+
ImageItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.ImageItem").msgclass
|
31
|
+
ImageSearchImageRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.ImageSearchImageRequest").msgclass
|
32
|
+
ImageSearchTextRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.ImageSearchTextRequest").msgclass
|
33
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: image_dataset.proto for package 'anndb_api_pb'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require 'image_dataset_pb'
|
6
|
+
|
7
|
+
module AnndbApiPb
|
8
|
+
module ImageDataset
|
9
|
+
class Service
|
10
|
+
|
11
|
+
include GRPC::GenericService
|
12
|
+
|
13
|
+
self.marshal_class_method = :encode
|
14
|
+
self.unmarshal_class_method = :decode
|
15
|
+
self.service_name = 'anndb_api_pb.ImageDataset'
|
16
|
+
|
17
|
+
rpc :Insert, ImageDatasetRequest, DatasetOpResult
|
18
|
+
rpc :Update, ImageDatasetRequest, DatasetOpResult
|
19
|
+
rpc :Delete, DeleteRequest, DatasetOpResult
|
20
|
+
rpc :SearchImage, ImageSearchImageRequest, SearchResult
|
21
|
+
rpc :SearchText, ImageSearchTextRequest, SearchResult
|
22
|
+
end
|
23
|
+
|
24
|
+
Stub = Service.rpc_stub_class
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: text_dataset.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'core_pb'
|
7
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
8
|
+
add_file("text_dataset.proto", :syntax => :proto3) do
|
9
|
+
add_message "anndb_api_pb.TextDatasetRequest" do
|
10
|
+
repeated :items, :message, 1, "anndb_api_pb.TextItem"
|
11
|
+
end
|
12
|
+
add_message "anndb_api_pb.TextItem" do
|
13
|
+
optional :id, :message, 1, "anndb_api_pb.UUID"
|
14
|
+
optional :text, :string, 2
|
15
|
+
map :metadata, :string, :string, 3
|
16
|
+
end
|
17
|
+
add_message "anndb_api_pb.TextSearchRequest" do
|
18
|
+
optional :query, :string, 1
|
19
|
+
optional :n, :uint32, 2
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module AnndbApiPb
|
25
|
+
TextDatasetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.TextDatasetRequest").msgclass
|
26
|
+
TextItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.TextItem").msgclass
|
27
|
+
TextSearchRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.TextSearchRequest").msgclass
|
28
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: text_dataset.proto for package 'anndb_api_pb'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require 'text_dataset_pb'
|
6
|
+
|
7
|
+
module AnndbApiPb
|
8
|
+
module TextDataset
|
9
|
+
class Service
|
10
|
+
|
11
|
+
include GRPC::GenericService
|
12
|
+
|
13
|
+
self.marshal_class_method = :encode
|
14
|
+
self.unmarshal_class_method = :decode
|
15
|
+
self.service_name = 'anndb_api_pb.TextDataset'
|
16
|
+
|
17
|
+
rpc :Insert, TextDatasetRequest, DatasetOpResult
|
18
|
+
rpc :Update, TextDatasetRequest, DatasetOpResult
|
19
|
+
rpc :Delete, DeleteRequest, DatasetOpResult
|
20
|
+
rpc :Search, TextSearchRequest, SearchResult
|
21
|
+
end
|
22
|
+
|
23
|
+
Stub = Service.rpc_stub_class
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: vector_dataset.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'core_pb'
|
7
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
8
|
+
add_file("vector_dataset.proto", :syntax => :proto3) do
|
9
|
+
add_message "anndb_api_pb.VectorDatasetRequest" do
|
10
|
+
repeated :items, :message, 1, "anndb_api_pb.VectorItem"
|
11
|
+
end
|
12
|
+
add_message "anndb_api_pb.VectorItem" do
|
13
|
+
optional :id, :message, 1, "anndb_api_pb.UUID"
|
14
|
+
optional :vector, :message, 2, "anndb_api_pb.Vector"
|
15
|
+
map :metadata, :string, :string, 3
|
16
|
+
end
|
17
|
+
add_message "anndb_api_pb.VectorSearchRequest" do
|
18
|
+
optional :query, :message, 1, "anndb_api_pb.Vector"
|
19
|
+
optional :n, :uint32, 2
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module AnndbApiPb
|
25
|
+
VectorDatasetRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.VectorDatasetRequest").msgclass
|
26
|
+
VectorItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.VectorItem").msgclass
|
27
|
+
VectorSearchRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("anndb_api_pb.VectorSearchRequest").msgclass
|
28
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: vector_dataset.proto for package 'anndb_api_pb'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require 'vector_dataset_pb'
|
6
|
+
|
7
|
+
module AnndbApiPb
|
8
|
+
module VectorDataset
|
9
|
+
class Service
|
10
|
+
|
11
|
+
include GRPC::GenericService
|
12
|
+
|
13
|
+
self.marshal_class_method = :encode
|
14
|
+
self.unmarshal_class_method = :decode
|
15
|
+
self.service_name = 'anndb_api_pb.VectorDataset'
|
16
|
+
|
17
|
+
rpc :Insert, VectorDatasetRequest, DatasetOpResult
|
18
|
+
rpc :Update, VectorDatasetRequest, DatasetOpResult
|
19
|
+
rpc :Delete, DeleteRequest, DatasetOpResult
|
20
|
+
rpc :Search, VectorSearchRequest, SearchResult
|
21
|
+
end
|
22
|
+
|
23
|
+
Stub = Service.rpc_stub_class
|
24
|
+
end
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: anndb_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marek Galovic
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-04-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: grpc
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.28.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.28.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: google-protobuf
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.12.2
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.12.2
|
41
|
+
description:
|
42
|
+
email: contact@anndb.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/anndb_api.rb
|
48
|
+
- lib/anndb_api/client.rb
|
49
|
+
- lib/anndb_api/dataset.rb
|
50
|
+
- lib/anndb_api/image_dataset.rb
|
51
|
+
- lib/anndb_api/text_dataset.rb
|
52
|
+
- lib/anndb_api/util.rb
|
53
|
+
- lib/anndb_api/vector_dataset.rb
|
54
|
+
- lib/core_pb.rb
|
55
|
+
- lib/image_dataset_pb.rb
|
56
|
+
- lib/image_dataset_services_pb.rb
|
57
|
+
- lib/text_dataset_pb.rb
|
58
|
+
- lib/text_dataset_services_pb.rb
|
59
|
+
- lib/vector_dataset_pb.rb
|
60
|
+
- lib/vector_dataset_services_pb.rb
|
61
|
+
homepage: https://github.com/anndb-com/anndb-api-client-ruby
|
62
|
+
licenses:
|
63
|
+
- Apache-2.0
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubygems_version: 3.1.2
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: AnnDB client for Ruby
|
84
|
+
test_files: []
|