AnnDB
Search…
Quickstart

Create a Dataset

The first step is to create a dataset for your data. AnnDB provides multiple dataset types which provide out-of-the-box solutions for image similarity search, text semantic search, question answering, or raw approximate nearest neighbours search in case you want to use your own vector embeddings.

Create an API Key

Next, you will need to create an API key to authenticate your client application with the AnnDB API. You can either a universal API key for all datasets, or you can create a dataset-specific API key to limit the access scope.

Install AnnDB

AnnDB provides client implementations in the following languages: Python, Ruby. Clients allow you to modify and search the data stored in your datasets.
Python
Ruby
1
pip install anndb-api
Copied!
1
gem install anndb_api
Copied!

Hello, world!

This example application shows, how easy it is to build an image similarity search service with AnnDB in just a few lines of code.
Python
Ruby
1
import anndb_api
2
3
# Create a client instance
4
client = anndb_api.Client('<YOUR_API_KEY')
5
6
# Load the dataset
7
dataset = client.images('<DATASET_NAME>')
8
9
# Insert the data
10
for url in img_urls:
11
id = dataset.insert(url, metadata={'src_url': url})
12
13
# Delete some of it
14
dataset.delete(id)
15
16
# Query top 5 similar images
17
items = dataset.search_image(img_urls[-1], 5)
18
19
# Query top 5 similar images using textual query
20
items = dataset.search_text('cute puppy', 5)
Copied!
1
require 'anndb_api'
2
3
# Create a client instance
4
client = AnndbApi::Client.new("<YOUR_API_KEY")
5
6
# Load the dataset
7
dataset = client.images("<DATASET_NAME>")
8
9
img_urls.each do |url|
10
id = dataset.insert(url, metadata={ "src_url": url })
11
end
12
13
# Delete some of it
14
dataset.delete(id)
15
16
# Query top 5 similar images
17
items = dataset.search_image(img_urls.last, 5)
18
19
# Query top 5 similar images using textual query
20
items = dataset.search_text("cute puppy", 5)
Copied!
Last modified 7mo ago