The ``BedrockEmbeddingEncoder`` class provides an interface to obtain embeddings for text using the Bedrock embeddings via the langchain integration. It connects to the Bedrock Runtime using AWS's boto3 package.
Key methods and attributes include:
``embed_documents``: This function takes a list of Elements as its input and returns the same list with an updated embeddings attribute for each Element.
``embed_query``: This method takes a query as a string and returns the embedding vector for the given query string.
``num_of_dimensions``: A metadata property that signifies the number of dimensions in any embedding vector obtained via this class.
``is_unit_vector``: A metadata property that checks if embedding vectors obtained via this class are unit vectors.
Initialization:
To create an instance of the `BedrockEmbeddingEncoder`, AWS credentials and the region name are required.
..code:: python
import os
from unstructured.documents.elements import Text
from unstructured.embed.bedrock import BedrockEmbeddingEncoder
This class relies on several dependencies which include boto3, numpy, and langchain. Ensure these are installed and available in the environment where this class is utilized.