Relevance AI

Start experimenting faster with Relevance AI in 5 minutes!

Relevance AI's ultimate goal is to assist developers to experiment, build and share the best vectors to solve similarity and relevance based problems across teams.

Relevance AI DS WorkflowRelevance AI DS Workflow
How Relevance AI helps with the data science workflow

In 5 lines of code, get a shareable dashboard for experiments insight!

Run this Quickstart in Colab: Open In ColabOpen In Colab

1. Set up Relevance AI

!pip install -U RelevanceAI
from relevanceai import Client 

"""
You can sign up/login and find your credentials here: https://cloud.relevance.ai/sdk/api
Once you have signed up, click on the value under `Authorization token` and paste it here
"""
client = Client()

2. Create a dataset with vectors and inserting it

!pip install -U RelevanceAI
documents = [
    {"_id": "1", "example_vector_": [0.1, 0.1, 0.1], "data": "Documentation"},
    {"_id": "2", "example_vector_": [0.2, 0.2, 0.2], "data": "Best document!"},
    {"_id": "3", "example_vector_": [0.3, 0.3, 0.3], "data": "Document example"},
    {"_id": "5", "example_vector_": [0.4, 0.4, 0.4], "data": "This is a doc"},
    {"_id": "4", "example_vector_": [0.5, 0.5, 0.5], "data": "This is another doc"},
]

client.insert_documents(dataset_id="quickstart", docs=documents)

3. Clustering

centroids = client.vector_tools.cluster.kmeans_cluster(
    "quickstart", 
    vector_fields = ["example_vector_"],
    k = 2,
    overwrite = True
)

client.services.cluster.centroids.list_closest_to_center(
  dataset_id = "quickstart", 
  vector_fields = ["example_vector_"], 
  cluster_ids = [],             # Leave this as an empty list if you want all of the clusters.
  alias = "kmeans_2"
)

4. Vector Search

client.services.search.vector(
    dataset_id="quickstart", 
    multivector_query=[
        {"vector": [0.2, 0.2, 0.2], "fields": ["example_vector_"]},
    ],
    page_size = 3,
    query = "sample search"     # Stored on the dashboard but not required
)

5. Projector

Coming Soon!

6. Comparator

Coming Soon!

What Next?

This is just the start. Relevance AI comes out of the box with support for more advanced features such as multi-vector search, filters, facets and traditional keyword matching to combine with your vector search. You can read more about how to construct a multi-vector query with those features here.

Get started with some example applications you can build with Relevance AI. Check out some other guides below!


Did this page help you?