Haystack

is a truly serverless vector DB that prioritizes speed and simplicity.

It's powered by the open source project FFVec

Our embeddings are binary quantized so they only take up 48 bytes each, and we embed things for you with this model

There's also an advanced query based upon the method described here that should perform much better than vanilla similarity search


Benchmarks

Coming soon

Get started

Haystack is designed to be simple to use. Here's a full example of getting from 0 to querying your documents.

import requests

org = requests.post(
      'https://api.haystack.zip/api/v1/orgs', json={'email': 'example@example.com', 'name': 'Example Org'}
  ).json()

my_org_id = org['id'] # save this somewhere

namespaces = requests.get(
      f'https://api.haystack.zip/api/v1/orgs/{my_org_id}/namespaces'
  ).json() # you'll have a `default` namespace already

# but if you want to make one yourself

ns = requests.post(
      f'https://api.haystack.zip/api/v1/orgs/{my_org_id}/namespaces', json={'name': 'my_cool_namespace'}
  ).json()

my_namespace_id = ns['id'] # or namespaces[0]['id'] if you want the default namespace

# now you can add vectors to your namespace

# you can provide an optional id for the vector, or we'll generate one for you

res = requests.post(
      f'https://api.haystack.zip/api/v1/orgs/{my_org_id}/namespaces/{my_namespace_id}/vectors',
      json={'text': 'a long time ago in a galaxy', 'vectorId': 'unique_id'}
  ).json()

# if you want to insert multiple texts at once, you can use the batch endpoint (max 32 at a time for now)

res = requests.post(
      f'https://api.haystack.zip/api/v1/orgs/{my_org_id}/namespaces/{my_namespace_id}/vectors/batch',
      json={'texts': ['a long time ago in a galaxy', 'far far away']}
  ).json()

# now you can query your vectors

query = requests.post(
      f'https://api.haystack.zip/api/v1/orgs/{my_org_id}/namespaces/{my_namespace_id}/query',
      json={'text': 'my favorite movie is star wars', 'top_k': 4}
  ).json()

# you can also pass filters (only equality support for now)

query = requests.post(
      f'https://api.haystack.zip/api/v1/orgs/{my_org_id}/namespaces/{my_namespace_id}/query',
      json={'text': 'my favorite movie is star wars', 'top_k': 4, 'filters': {'genre': 'sci-fi'}}
  ).json()

# and if you want to do an advanced query (with the logistic regression model mentioned above)

query = requests.post(
      f'https://api.haystack.zip/api/v1/orgs/{my_org_id}/namespaces/{my_namespace_id}/query/advanced',
      json={'text': 'my favorite movie is star wars', 'top_k': 4, 'filters': {'genre': 'sci-fi'}}
  ).json()

# and now you have all you need to get started with Haystack!