Skip to main content
Use bedrock-text to embed text or bedrock-image to search images by text or image.

Prerequisites

Install boto3 for either embedding function. Install pillow as well for image embeddings.
Configure AWS credentials with permission to invoke your model in the AWS Region where it is available. Use the AWS CLI to configure credentials and set the session token if you use temporary credentials.
Verify the active credentials with the AWS CLI.

Text embeddings

The bedrock-text registry entry supports these model IDs. For Cohere text models, set source_input_type or query_input_type in create() to override search_document or search_query. You can also pass profile_name, assumed_role, and role_session_name to bedrock-text.

Image embeddings

LanceDB embeds images when you add them to a table. You can search the table with text or a Pillow image. bedrock-image uses boto3’s default credential chain. Select a profile with AWS_PROFILE in the application’s environment or run the application with an IAM role. Choose a binary source column (bytes) for encoded image bytes or a string source column (str) for file paths readable by the process that adds rows. Pillow detects the source format from the file contents. If your table has nullable images and vectors, pass on_bad_vectors="null" to keep rows without an image. To use Cohere Embed v4, pass name="cohere.embed-v4:0" to create().
A query string is embedded as text. To search asynchronously with a Pillow image, pass query_type="vector". Run the following code in an async context with the db_path and query_image from the example.

AWS settings

Pass these options to create() with either registry entry.