BedrockEncoder Objects
__init__
name(str): The name of the pre-trained model to use for embedding. If not provided, the default model specified in EncoderDefault will be used.input_type(str): The type of input to use for the embedding. If not provided, the default input type specified in EncoderDefault will be used.score_threshold(float): The threshold for similarity scores.access_key_id(str): The AWS access key id for an IAM principle. If not provided, it will be retrieved from the access_key_id environment variable.secret_access_key(str): The secret access key for an IAM principle. If not provided, it will be retrieved from the AWS_SECRET_KEY environment variable.str0: The session token for an IAM principle. If not provided, it will be retrieved from the AWS_SESSION_TOKEN environment variable.str1 (str): The location of the Bedrock resources. If not provided, it will be retrieved from the AWS_REGION environment variable, defaulting to “us-west-1”
str3: If the Bedrock Platform client fails to initialize.
__call__
docs(list[str]): A list of strings representing the documents to embed.model_kwargs(dict): A dictionary of model-specific inference parameters.
ValueError: If the Bedrock Platform client is not initialized or if the API call fails.
list[list[float]]: A list of lists, where each inner list contains the embedding values for a
document.
chunk_strings
strings(list): A list of strings to be chunked.max_chunk_size(int): The maximum size of each chunk. Default is 20.
list[list[str]]: A list of lists, where each inner list contains a chunk of strings.
get_env_variable
var_name(str): The name of the environment variable.provided_value(Optional[str]): The provided value to use if not None.default(Optional[str]): The default value if the environment variable is not set.
ValueError: If no value is provided and the environment variable is not set.
str: The value of the environment variable or the provided/default value.
