S3Vectors / Client / put_vectors
put_vectors¶
- S3Vectors.Client.put_vectors(**kwargs)¶
Note
Amazon S3 Vectors is in preview release for Amazon S3 and is subject to change.
Adds one or more vectors to a vector index. To specify the vector index, you can either use both the vector bucket name and the vector index name, or use the vector index Amazon Resource Name (ARN).
For more information about limits, see Limitations and restrictions in the Amazon S3 User Guide.
Note
When inserting vector data into your vector index, you must provide the vector data as
float32
(32-bit floating point) values. If you pass higher-precision values to an Amazon Web Services SDK, S3 Vectors converts the values to 32-bit floating point before storing them, andGetVectors
,ListVectors
, andQueryVectors
operations return the float32 values. Different Amazon Web Services SDKs may have different default numeric types, so ensure your vectors are properly formatted asfloat32
values regardless of which SDK you’re using. For example, in Python, usenumpy.float32
or explicitly cast your values.Permissions
You must have the
s3vectors:PutVectors
permission to use this operation.See also: AWS API Documentation
Request Syntax
response = client.put_vectors( vectorBucketName='string', indexName='string', indexArn='string', vectors=[ { 'key': 'string', 'data': { 'float32': [ ..., ] }, 'metadata': {...}|[...]|123|123.4|'string'|True|None }, ] )
- Parameters:
vectorBucketName (string) – The name of the vector bucket that contains the vector index.
indexName (string) – The name of the vector index where you want to write vectors.
indexArn (string) – The ARN of the vector index where you want to write vectors.
vectors (list) –
[REQUIRED]
The vectors to add to a vector index. The number of vectors in a single request must not exceed the resource capacity, otherwise the request will be rejected with the error
ServiceUnavailableException
with the error message “Currently unable to handle the request”.(dict) –
Note
Amazon S3 Vectors is in preview release for Amazon S3 and is subject to change.
The attributes of a vector to add to a vector index.
key (string) – [REQUIRED]
The name of the vector. The key uniquely identifies the vector in a vector index.
data (dict) – [REQUIRED]
The vector data of the vector.
Vector dimensions must match the dimension count that’s configured for the vector index.
For the
cosine
distance metric, zero vectors (vectors containing all zeros) aren’t allowed.For both
cosine
andeuclidean
distance metrics, vector data must contain only valid floating-point values. Invalid values such as NaN (Not a Number) or Infinity aren’t allowed.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
float32
.float32 (list) –
The vector data as 32-bit floating point numbers. The number of elements in this array must exactly match the dimension of the vector index where the operation is being performed.
(float) –
metadata (document) –
Metadata about the vector. All metadata entries undergo validation to ensure they meet the format requirements for size and data types.
- Return type:
dict
- Returns:
Response Syntax
{}
Response Structure
(dict) –
Exceptions