LanceDB Cloud Quickstart
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.
- Get the
API KeyObtain a LanceDB Cloud API key by clicking on theGENERATE API KEYfrom thetablepage.
π‘ Copy the code block for connecting to LanceDB Cloud that is shown at the last step of API key generation.
- 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.
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.
β οΈ 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.
β³ 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
toyota, profit, carmaker
Let's perform another search to filter by the label column
toyota, profit, carmaker
Step 6: Cleanup
We can now delete the table.
π Congrats! You just built your first semantic search application with LanceDB Cloud!