chroma-db 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/.rbnext/2.7/chroma/resources/collection.rb +26 -1
- data/lib/.rbnext/3.1/chroma/resources/collection.rb +26 -1
- data/lib/chroma/resources/collection.rb +25 -0
- data/lib/chroma/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: 2d7ef50774b1e00c56ee2f67670afc3b7d2fd0760ace64627985ed6460701b7b
|
4
|
+
data.tar.gz: 9e4f771c7ab2fe8b3ceead3efa3dbe3e03155d2ab8823c895b90e72ac78f7f9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dee2d6604b17ac0baf2872ba0b807ebe7acafdbce4c3fdbc1453f737161e1916b30fe80e7a09daf34d0ced994a918d604e74b4aac355381fff1f89b635fc2ce
|
7
|
+
data.tar.gz: bb8a63c2937041c4123d08f89704fa755a2096724e57176e37c8fed2d3902d7c6df2889c621cb7ced4372938a70870f47525560c09615c7d8d48520192d3ae4f
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -43,7 +43,7 @@ module Chroma
|
|
43
43
|
include: include
|
44
44
|
}
|
45
45
|
|
46
|
-
result = self.class.execute_request(:post, "#{Chroma.api_url}/collections/#{
|
46
|
+
result = self.class.execute_request(:post, "#{Chroma.api_url}/collections/#{id}/query", payload)
|
47
47
|
|
48
48
|
if result.success?
|
49
49
|
build_embeddings_response(result.success.body)
|
@@ -298,6 +298,31 @@ module Chroma
|
|
298
298
|
end
|
299
299
|
end
|
300
300
|
|
301
|
+
# Get or create a collection on the database.
|
302
|
+
#
|
303
|
+
# name - The name of the collection. Name needs to be between 3-63 characters, starts and ends
|
304
|
+
# with an alphanumeric character, contains only alphanumeric characters, underscores or hyphens (-), and
|
305
|
+
# contains no two consecutive periods
|
306
|
+
# metadata - A hash of additional metadata associated with the collection, this is used if collection is created.
|
307
|
+
#
|
308
|
+
# Examples
|
309
|
+
#
|
310
|
+
# collection = Chorma::Resources::Collection.get_or_create("ruby-documentation", {source: "Ruby lang website"})
|
311
|
+
#
|
312
|
+
# Returns the created collection object.
|
313
|
+
def self.get_or_create(name, metadata = nil)
|
314
|
+
payload = {name: name, metadata: metadata, get_or_create: true}
|
315
|
+
|
316
|
+
result = execute_request(:post, "#{Chroma.api_url}/collections", payload)
|
317
|
+
|
318
|
+
if result.success?
|
319
|
+
data = result.success.body
|
320
|
+
new(id: data["id"], name: data["name"], metadata: data["metadata"])
|
321
|
+
else
|
322
|
+
raise_failure_error(result)
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
301
326
|
# Retrieves all collections in the database.
|
302
327
|
#
|
303
328
|
# Examples
|
@@ -43,7 +43,7 @@ module Chroma
|
|
43
43
|
include: include
|
44
44
|
}
|
45
45
|
|
46
|
-
result = self.class.execute_request(:post, "#{Chroma.api_url}/collections/#{
|
46
|
+
result = self.class.execute_request(:post, "#{Chroma.api_url}/collections/#{id}/query", payload)
|
47
47
|
|
48
48
|
if result.success?
|
49
49
|
build_embeddings_response(result.success.body)
|
@@ -298,6 +298,31 @@ module Chroma
|
|
298
298
|
end
|
299
299
|
end
|
300
300
|
|
301
|
+
# Get or create a collection on the database.
|
302
|
+
#
|
303
|
+
# name - The name of the collection. Name needs to be between 3-63 characters, starts and ends
|
304
|
+
# with an alphanumeric character, contains only alphanumeric characters, underscores or hyphens (-), and
|
305
|
+
# contains no two consecutive periods
|
306
|
+
# metadata - A hash of additional metadata associated with the collection, this is used if collection is created.
|
307
|
+
#
|
308
|
+
# Examples
|
309
|
+
#
|
310
|
+
# collection = Chorma::Resources::Collection.get_or_create("ruby-documentation", {source: "Ruby lang website"})
|
311
|
+
#
|
312
|
+
# Returns the created collection object.
|
313
|
+
def self.get_or_create(name, metadata = nil)
|
314
|
+
payload = {name: name, metadata: metadata, get_or_create: true}
|
315
|
+
|
316
|
+
result = execute_request(:post, "#{Chroma.api_url}/collections", payload)
|
317
|
+
|
318
|
+
if result.success?
|
319
|
+
data = result.success.body
|
320
|
+
new(id: data["id"], name: data["name"], metadata: data["metadata"])
|
321
|
+
else
|
322
|
+
raise_failure_error(result)
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
301
326
|
# Retrieves all collections in the database.
|
302
327
|
#
|
303
328
|
# Examples
|
@@ -298,6 +298,31 @@ module Chroma
|
|
298
298
|
end
|
299
299
|
end
|
300
300
|
|
301
|
+
# Get or create a collection on the database.
|
302
|
+
#
|
303
|
+
# name - The name of the collection. Name needs to be between 3-63 characters, starts and ends
|
304
|
+
# with an alphanumeric character, contains only alphanumeric characters, underscores or hyphens (-), and
|
305
|
+
# contains no two consecutive periods
|
306
|
+
# metadata - A hash of additional metadata associated with the collection, this is used if collection is created.
|
307
|
+
#
|
308
|
+
# Examples
|
309
|
+
#
|
310
|
+
# collection = Chorma::Resources::Collection.get_or_create("ruby-documentation", {source: "Ruby lang website"})
|
311
|
+
#
|
312
|
+
# Returns the created collection object.
|
313
|
+
def self.get_or_create(name, metadata = nil)
|
314
|
+
payload = {name:, metadata:, get_or_create: true}
|
315
|
+
|
316
|
+
result = execute_request(:post, "#{Chroma.api_url}/collections", payload)
|
317
|
+
|
318
|
+
if result.success?
|
319
|
+
data = result.success.body
|
320
|
+
new(id: data["id"], name: data["name"], metadata: data["metadata"])
|
321
|
+
else
|
322
|
+
raise_failure_error(result)
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
301
326
|
# Retrieves all collections in the database.
|
302
327
|
#
|
303
328
|
# Examples
|
data/lib/chroma/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chroma-db
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Alberto Chávez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-monads
|