from_texts(
cls: type[AmazonS3Vectors],
texts: list[str| Name | Type | Description |
|---|---|---|
texts* | list[str] | Texts to add to the |
embedding* | Embeddings | Embedding function to use. |
metadatas | Optional[list[dict]] | Default: None |
ids | Optional[list[str]] | Default: None |
vector_bucket_name* | str | |
index_name* | str | |
data_type | Literal['float32'] | Default: 'float32' |
distance_metric | Literal['euclidean', 'cosine'] | Default: 'cosine' |
non_filterable_metadata_keys | list[str] | None | Default: None |
page_content_metadata_key | Optional[str] | Default: '_page_content' |
create_index_if_not_exist | bool | Default: True |
relevance_score_fn | Optional[Callable[[float], float]] | Default: None |
region_name | Optional[str] | Default: None |
credentials_profile_name | Optional[str] | Default: None |
aws_access_key_id | Optional[str] | Default: None |
aws_secret_access_key | Optional[str] | Default: None |
aws_session_token | Optional[str] | Default: None |
endpoint_url | Optional[str] | Default: None |
config | Any | Default: None |
client | Any | Default: None |
kwargs | Any | Default: {} |
Return AmazonS3Vectors initialized from texts and embeddings.
Optional list of metadatas associated with the texts. Default is None.
Optional list of IDs associated with the texts.
The name of an existing S3 vector bucket
The name of the S3 vector index. The index names must be 3 to 63 characters long, start and end with a letter or number, and contain only lowercase letters, numbers, hyphens and dots.
The data type of the vectors to be inserted into the vector index. Default is "float32".
The distance metric to be used for similarity search. Default is "cosine".
Non-filterable metadata keys
Key of metadata to store page_content in Document. If None, embedding page_content but stored as an empty string. Default is "_page_content".
Automatically create vector index if it does not exist. Default is True.
The 'correct' relevance function.
The aws region where the Sagemaker model is
deployed, eg. us-west-2.
The name of the profile in the ~/.aws/credentials or ~/.aws/config files, which has either access keys or role information specified. If not specified, the default credential profile or, if on an EC2 instance, credentials from IMDS will be used. See: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
AWS access key id.
If provided, aws_secret_access_key must also be provided.
If not specified, the default credential profile or,
if on an EC2 instance, credentials from IMDS will be used.
See: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
If not provided, will be read from AWS_ACCESS_KEY_ID
environment variable.
AWS secret_access_key.
If provided, aws_access_key_id must also be provided.
If not specified, the default credential profile or,
if on an EC2 instance, credentials from IMDS will be used.
See: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
If not provided, will be read from AWS_SECRET_ACCESS_KEY
environment variable.
AWS session token.
If provided, aws_access_key_id and
aws_secret_access_key must also be provided.
Not required unless using temporary credentials.
See: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
If not provided, will be read from AWS_SESSION_TOKEN
environment variable.
Needed if you don't want to default to us-east-1 endpoint
An optional botocore.config.Config instance to pass to
the client.
Boto3 client for s3vectors
Arguments to pass to AmazonS3Vectors.