Notebooks
L
LanceDB
LanceDB Cloud Quickstart

LanceDB Cloud Quickstart

agentsllmsvector-databaselancedbgptopenaiAImultimodal-aimachine-learningembeddingssaas_examplesfine-tuningexamplesdeep-learningpython_notebookgpt-4-visionllama-indexragmultimodallangchainlancedb-recipes

Quickstart with LanceDB Cloud

πŸš€ If you haven’t signed up for LanceDB Cloud yet, click here to get started!

Welcome to LanceDB Cloud!

In this notebook, we show how to implement efficient semantic search using LanceDB Cloud. You'll learn how to:

πŸ“₯ Connect with LanceDB Cloud

πŸ”§ Ingest a dataset into LanceDB

πŸš€ Build a vector index and perform semantic searches

Step 1: Install LanceDB

[ ]

Step 2: Obtain the API key from the dashboard and Connect to LanceDB Cloud

  • Get the db uri

db uri starts with db://, which can be obtained from the project page on the dashboard. In the following example, db uri is db://test-sfifxz.

db-uri.png

  • Get the API Key Obtain a LanceDB Cloud API key by clicking on the GENERATE API KEY from the table page.

πŸ’‘ Copy the code block for connecting to LanceDB Cloud that is shown at the last step of API key generation. image.png

  • Connect to LanceDB Cloud

Copy and paste the db uri and the api key from the previous steps, or directly paste the code block for LanceDB Cloud connection.

[2]
[3]
[4]

Step 3: Ingest Data

We use the ag_news dataset from HuggingFace, which includes 768-dimensional precomputed embeddings. To optimize performance, we extract the first 3,000 rows from the test split for this example.

[ ]

ℹ️ There are various ways to specify the table schema. More details can be found in our documentation.

Step 4: Create a vector index

We will create a vector index on the keywords_embeddings column.

[6]

⚠️ WARNING: create_index is asynchonous so it returns when indexing is in progress. We provide the list_indices and index_stats APIs to check index status. The index name is formed by appending β€œ_idx” to the column name. Note that list_indices will not return any information until the index has fully ingested and indexed all available data.

[7]
⏳ Waiting for keywords_embeddings_idx to be ready...
⏳ Waiting for keywords_embeddings_idx to be ready...
⏳ Waiting for keywords_embeddings_idx to be ready...
βœ… keywords_embeddings_idx is ready!
IndexStatistics(num_indexed_rows=3000, num_unindexed_rows=0, index_type='IVF_PQ', distance_type='cosine', num_indices=None)

Step 5: Query

Let's perform a search. Note here that only the text, keywords and label columns will be returned

[8]
toyota, profit, carmaker

Let's perform another search to filter by the label column

[9]
toyota, profit, carmaker

Step 6: Cleanup

We can now delete the table.

[10]

πŸŽ‰ Congrats! You just built your first semantic search application with LanceDB Cloud!