epsilla-ruby 0.0.1 → 0.0.3

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: 02ec2167e8966de5929e21521bcd3640683d4ac7a4c27b42c811a85714d4d7bc
4
- data.tar.gz: 1c665e9af8e44e1a5f16b965c0996075ad4aa5833f6c92207c3492488293dc70
3
+ metadata.gz: 9435435295698aa14f7b69b1d1f333e8c1a13a2304d6e518526f6087fc0a8524
4
+ data.tar.gz: fadf46bfa45376d0273fdd13ad843bd136670957ef00e2a9be44d995d0de94a8
5
5
  SHA512:
6
- metadata.gz: 72ad5416ad62fc593691288456294781a16aeb6aac85e12ef5257e133b2abd6df834963a3c2f40656d45235d7a5ea61b912716ba8b7250ad778192e403e09339
7
- data.tar.gz: a805cb4f2ad872fbfeae05c7756bbb15f40d052cebc1c0fe68f4305e90078f0165095a104fec82de5759b5e43537bdf7544e65dd7f6ec899a4cc7ae8db4a05a5
6
+ metadata.gz: 7ef95679ea6ed03945b9992f7840eb37499cf2457fb7d9269e6a4f98ee1eb71d828e8df517550299a540c49359597e0c9f66cb6810cb9dee04946fac33e20c4f
7
+ data.tar.gz: e0b972ee620c489b888ed7b21132ae6fb5d844fa16af264b2d2917b314a40829627bf4136f0fea9264603f13226470567805fac95bbf9a5cb50f44190706b9d7
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Epsilla Ruby SDK
2
2
 
3
3
  Welcome to Ruby SDK for Epsilla Vector Database!
4
+ https://rubygems.org/gems/epsilla-ruby
5
+
4
6
 
5
7
  ## Installation
6
8
  ```shell
@@ -68,14 +70,16 @@ puts status_code, response
68
70
 
69
71
 
70
72
  # Drop table
71
- status_code, response = client.database.drop_table("MyTable")
72
- puts status_code, response
73
+ #status_code, response = client.database.drop_table("MyTable")
74
+ #puts status_code, response
73
75
 
74
76
  # Unload db
75
- status_code, response = client.database.unload_db("MyDB")
76
- puts status_code, response
77
+ #status_code, response = client.database.unload_db("MyDB")
78
+ #puts status_code, response
77
79
 
78
80
  ```
79
81
 
80
82
  ## Contributing
81
- Bug reports and pull requests are welcome on GitHub at https://github.com/epsilla-cloud/epsilla-ruby.
83
+ Bug reports and pull requests are welcome on GitHub at https://github.com/epsilla-cloud/epsilla-ruby-client
84
+
85
+ If you have any question or problem, please join our discord https://discord.com/invite/cDaY2CxZc5
data/epsilla.gemspec ADDED
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/epsilla/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "epsilla"
7
+ spec.version = Epsilla::VERSION
8
+ spec.authors = ["Epsilla Team"]
9
+ spec.email = ["eric@epsilla.com"]
10
+
11
+ spec.summary = "Ruby client for Epsilla Vector Database"
12
+ spec.description = "EpsillaDB is a scalable, high-performance, and cost-effective vector database"
13
+ spec.homepage = "https://github.com/epsilla-cloud/vectordb"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/epsilla-cloud/epsilla-ruby-client"
21
+ spec.metadata["changelog_uri"] = "https://github.com/epsilla-cloud/epsilla-ruby-client/blob/main/CHANGELOG.md"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(__dir__) do
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor|Gemfile)})
28
+ end
29
+ end
30
+
31
+ spec.bindir = "exe"
32
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ["lib"]
34
+
35
+ # Uncomment to register a new dependency of your gem
36
+ # spec.add_dependency "example-gem", "~> 1.0"
37
+ spec.add_dependency "faraday", "~> 1"
38
+
39
+ # For more information and examples about making a new gem, check out our
40
+ # guide at: https://bundler.io/guides/creating_gem.html
41
+ end
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+ # lib = File.expand_path("../lib", __FILE__)
55
+ # $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
56
+ # require "epsilla/version"
57
+
58
+ # Gem::Specification.new do |spec|
59
+ # spec.name = "epsilla"
60
+ # spec.version = Epsilla::VERSION
61
+ # spec.authors = ["Epsilla Team"]
62
+ # spec.email = ["eric@epsilla.com", "admin@epsilla.com"]
63
+
64
+ # spec.summary = "A scalable, high-performance, and cost-effective vector database"
65
+ # spec.description = "A scalable, high-performance, and cost-effective vector database"
66
+ # spec.homepage = "https://github.com/epsilla-cloud/vectordb"
67
+ # spec.license = "MIT"
68
+ # # spec.required_ruby_version = ">= 3.0.0"
69
+
70
+ # # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
71
+ # # to allow pushing to a single host or delete this section to allow pushing to any host.
72
+ # if spec.respond_to?(:metadata)
73
+ # #spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
74
+ # spec.metadata["homepage_uri"] = spec.homepage
75
+ # spec.metadata["source_code_uri"] = "https://github.com/eric-epsilla/epsilla-ruby"
76
+ # spec.metadata["changelog_uri"] = "https://github.com/eric-epsilla/epsilla-ruby"
77
+ # else
78
+ # raise "RubyGems 3.0 or newer is required to protect against " \
79
+ # "public gem pushes."
80
+ # end
81
+
82
+ # # Specify which files should be added to the gem when it is released.
83
+ # # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
84
+ # spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
85
+ # `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
86
+ # end
87
+ # spec.bindir = "exe"
88
+ # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
89
+ # spec.require_paths = ["lib"]
90
+
91
+ # spec.add_dependency "faraday", "~> 1"
92
+ # spec.add_development_dependency "bundler", "~> 1.17"
93
+ # end
94
+
@@ -8,6 +8,7 @@
8
8
 
9
9
  require "epsilla"
10
10
 
11
+
11
12
  # Connect to Epsilla VectorDB
12
13
  client = Epsilla::Client.new(protocol="http", host="127.0.0.1", port="8888")
13
14
  # puts client.live?
@@ -29,6 +30,10 @@ table_fields= [
29
30
  status_code, response = client.database.create_table(table_name="MyTable", table_fields=table_fields)
30
31
  puts status_code, response
31
32
 
33
+ # List tables
34
+ status_code, response = client.database.list_tables()
35
+ puts status_code, response
36
+
32
37
  # Insert new vector records into table
33
38
  table_records = [
34
39
  {"ID" => 1, "Doc" => "Berlin", "Embedding" => [0.05, 0.61, 0.76, 0.74]},
@@ -45,11 +50,11 @@ puts status_code, response
45
50
  status_code, response = client.database.rebuild()
46
51
  puts status_code, response
47
52
 
48
- # Query Vectors
53
+ # Query vectors
49
54
  query_field = "Embedding"
50
- response_fields = ["Doc"]
51
55
  query_vector=[0.35, 0.55, 0.47, 0.94]
52
- limit=1
56
+ response_fields = ["Doc"]
57
+ limit=2
53
58
  status_code, response = client.database.query(table_name="MyTable", query_field=query_field, query_vector=query_vector, response_fields=response_fields, limit=limit, with_distance=true)
54
59
  puts status_code, response
55
60
 
@@ -45,6 +45,19 @@ module Epsilla
45
45
  return response.status, response.body
46
46
  end
47
47
 
48
+ # get a list of table names in current DB
49
+ def list_tables()
50
+ unless @db_name
51
+ raise Exception("[ERROR] Please use_db() first!")
52
+ end
53
+
54
+ response = client.connection.post do |req|
55
+ req.url "/api/#{@db_name}/schema/tables/show"
56
+ end
57
+
58
+ return response.status, response.body
59
+ end
60
+
48
61
  # insert data into table
49
62
  def insert(table_name = "MyTable", table_records = nil)
50
63
  unless @db_name
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Epsilla
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epsilla-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Epsilla Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-13 00:00:00.000000000 Z
11
+ date: 2023-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -28,7 +28,6 @@ description: EpsillaDB is a scalable, high-performance, and cost-effective vecto
28
28
  database
29
29
  email:
30
30
  - eric@epsilla.com
31
- - admin@epsilla.com
32
31
  executables: []
33
32
  extensions: []
34
33
  extra_rdoc_files: []
@@ -36,6 +35,7 @@ files:
36
35
  - CHANGELOG.md
37
36
  - README.md
38
37
  - Rakefile
38
+ - epsilla.gemspec
39
39
  - examples/hello_epsilla.rb
40
40
  - lib/epsilla.rb
41
41
  - lib/epsilla/base.rb
@@ -50,8 +50,8 @@ licenses:
50
50
  - MIT
51
51
  metadata:
52
52
  homepage_uri: https://github.com/epsilla-cloud/vectordb
53
- source_code_uri: https://github.com/epsilla-cloud/epsilla-ruby
54
- changelog_uri: https://github.com/epsilla-cloud/epsilla-ruby/blob/main/CHANGELOG.md
53
+ source_code_uri: https://github.com/epsilla-cloud/epsilla-ruby-client
54
+ changelog_uri: https://github.com/epsilla-cloud/epsilla-ruby-client/blob/main/CHANGELOG.md
55
55
  post_install_message:
56
56
  rdoc_options: []
57
57
  require_paths: