Qdrant
+
Ruby wrapper for the Qdrant vector search database API.
Part of the Langchain.rb stack.
Installation
Install the gem and add to the application's Gemfile by executing:
$ bundle add qdrant-ruby
If bundler is not being used to manage dependencies, install the gem by executing:
$ gem install qdrant-ruby
Usage
Instantiating API client
require 'qdrant'
client = Qdrant::Client.new(
url: ENV["QDRANT_URL"],
api_key: ENV["QDRANT_API_KEY"]
)
Collections
client.collections.list
client.collections.get(collection_name: "string")
client.collections.create(
collection_name: "string",
vectors: {},
shard_number: nil,
replication_factor: nil,
write_consistency_factor: nil,
on_disk_payload: nil,
hnsw_config: nil,
wal_config: nil,
optimizers_config: nil,
init_from: nil,
quantization_config: nil
)
client.collections.update(
collection_name: "string",
optimizers_config: nil,
params: nil
)
client.collections.delete(collection_name: "string")
client.collections.aliases(
collection_name: "string"
)
client.collections.update_aliases(
actions: [{
create_alias: {
collection_name: "string",
alias_name: "string"
}
}]
)
client.collections.create_index(
collection_name: "string",
field_name: "string",
field_schema: "string",
wait: "boolean",
ordering: "ordering"
)
client.collections.delete_index(
collection_name: "string",
field_name: "string",
wait: "boolean",
ordering: "ordering"
)
client.collections.cluster_info(
collection_name: "test_collection"
)
client.collections.update_cluster(
collection_name: "string",
move_shard: {
shard_id: "int",
to_peer_id: "int",
from_peer_id: "int"
},
timeout: "int"
)
client.collections.create_snapshot(
collection_name: "string",
)
client.collections.list_snapshots(
collection_name: "string",
)
client.collections.delete_snapshot(
collection_name: "string",
snapshot_name: "string"
)
client.collections.restore_snapshot(
collection_name: "string",
filepath: "string",
wait: "boolean",
priority: "string"
)
client.collections.download_snapshot(
collection_name: "string",
snapshot_name: "string",
filepath: "/dir/filename.snapshot"
)
Points
client.points.get(
collection_name: "string",
id: "int/string",
consistency: "int"
)
client.points.get_all(
collection_name: "string",
ids: "[int]",
with_payload: "boolean"
with_vector: "boolean"
)
client.points.list(
collection_name: "string",
ids: "[int/string]",
with_payload: nil,
with_vector: nil,
consistency: nil
)
client.points.upsert(
collection_name: "string",
batch: {},
wait: "boolean",
ordering: "string"
)
client.points.delete(
collection_name: "string",
points: "[int/string]",
filter: {},
wait: "boolean",
ordering: "string"
)
client.points.set_payload(
collection_name: "string",
payload: {
"property name" => "value"
},
points: "[int/string]",
filter: {},
wait: "boolean",
ordering: "string"
)
client.points.overwrite_payload(
collection_name: "string",
payload: {},
wait: "boolean",
ordering: "string",
points: "[int/string]",
filter: {}
)
client.points.clear_payload_keys(
collection_name: "string",
keys: "[string]",
points: "[int/string]",
filter: {},
wait: "boolean",
ordering: "string"
)
client.points.clear_payload(
collection_name: "string",
points: "[int/string]",
wait: "boolean",
ordering: "string"
)
client.points.scroll(
collection_name: "string",
limit: "int",
filter: {},
offset: "string",
with_payload: "boolean",
with_vector: "boolean",
consistency: "int/string"
)
client.points.search(
collection_name: "string",
limit: "int",
vector: "[int]",
filter: {},
params: {},
offset: "int",
with_payload: "boolean",
with_vector: "boolean",
score_threshold: "float"
)
client.points.batch_search(
collection_name: "string",
searches: [{}],
consistency: "int/string"
)
client.points.recommend(
collection_name: "string",
positive: "[int/string]",
limit: "int",
negative: "[int/string]",
filter: {},
params: {},
offset: "int",
with_payload: "boolean",
with_vector: "boolean",
score_threshold: "float"
using: "string",
lookup_from: {},
)
client.points.batch_recommend(
collection_name: "string",
searches: [{}],
consistency: "string"
)
client.points.count(
collection_name: "string",
filter: {},
exact: "boolean"
)
Snapshots
client.snapshots.list(
collection_name: "string"
)
client.snapshots.create(
collection_name: "string"
)
client.snapshots.delete(
collection_name: "string",
snapshot_name: "string"
)
client.snapshots.download(
collection_name: "string",
snapshot_name: "string"
filepath: "~/Downloads/backup.txt"
)
client.backups.get(
backend: "filesystem",
id: "my-first-backup"
)
client.backups.restore(
backend: "filesystem",
id: "my-first-backup"
)
client.backups.restore_status(
backend: "filesystem",
id: "my-first-backup"
)
Cluster
client.cluster.info
client.cluster.recover
client.cluster.remove_peer(
peer_id: "int",
force: "boolean"
)
Service
client.telemetry(
anonymize: "boolean"
)
client.metrics(
anonymize: "boolean"
)
client.locks
client.set_lock(
write: "boolean"
error_message: "string"
)
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/andreibondarev/qdrant.
License
qdrant-ruby is licensed under the Apache License, Version 2.0. View a copy of the License file.