mypy-boto3-s3vectors

1.42.3 · active · verified Sat Apr 11

mypy-boto3-s3vectors provides type annotations for the boto3 S3Vectors 1.42.3 service, enhancing development with static type checking and IDE auto-completion. It is automatically generated by mypy-boto3-builder 8.12.0. The project maintains an active release cadence, aligning with boto3 updates.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the S3Vectors client with type annotations, access a paginator, and use a TypedDict for a hypothetical API request. Replace placeholder values and operations with actual S3Vectors methods as per AWS documentation.

import boto3
from boto3.session import Session
from mypy_boto3_s3vectors import S3VectorsClient
from mypy_boto3_s3vectors.paginator import ListIndexesPaginator
from mypy_boto3_s3vectors.type_defs import CreateIndexRequestRequestTypeDef

def main():
    session = Session(region_name="us-east-1") # Use a specific region
    s3vectors_client: S3VectorsClient = session.client("s3vectors")

    # Example client operation (dummy call for demonstration)
    # Note: S3Vectors service methods should be referenced from AWS S3Vectors documentation
    # This is a placeholder demonstrating type annotation usage.
    try:
        # Assuming 'list_indexes' is an available operation to demonstrate a paginator
        list_indexes_paginator: ListIndexesPaginator = s3vectors_client.get_paginator("list_indexes")
        print(f"Paginator for list_indexes created: {list_indexes_paginator}")

        # Example of using a TypedDict for a request (assuming CreateIndex operation)
        create_index_params: CreateIndexRequestRequestTypeDef = {
            "Name": "my-test-index",
            "VectorBucketName": "my-vector-bucket",
            "VectorIndexConfig": {"VectorDimension": 1536},
            # ... other required parameters for CreateIndex
        }
        # result = s3vectors_client.create_index(**create_index_params)
        print(f"Example TypedDict for CreateIndex: {create_index_params}")

    except Exception as e:
        print(f"An error occurred (this is an example, actual S3Vectors operations may vary): {e}")

if __name__ == "__main__":
    main()

view raw JSON →