Skip to main content

bedrock-s3-vectors

Embed text with AWS Bedrock and read/write AWS S3 Vectors — a small, retry-aware, batched wrapper around the two AWS APIs.

Defaults to Cohere embed-v4 (1536-dimension output), since that's the Bedrock embedding model this package was built against, but both the model ID and output dimension are configurable per instance. Any Bedrock model that accepts Cohere-shaped input (texts / input_type / embedding_types / output_dimension) works out of the box; for a different request/response shape, subclass VectorUtility and override get_embeddings.

Install

pip install bedrock-s3-vectors

Usage

from bedrock_s3_vectors import VectorUtility

vectors = VectorUtility(
    vector_bucket="my-vectors",
    vector_index="my-vectors-index",
    # Optional — both default to Cohere embed-v4 / 1536 dimensions.
    model="cohere.embed-v4:0",
    dimension=1536,
)

# Embed and upload
vectors.put_vectors([{"key": "doc-1", "text": "..."}])

# Similarity search
results = vectors.query_vectors("some search query", topK=10)

# Fetch / delete by key
vectors.get_vectors(["doc-1"])
vectors.delete_vectors(["doc-1"])

Pass your own boto3.Session (e.g. to use a named profile locally) via the session kwarg; it defaults to boto3.Session().

Requirements

Your AWS credentials need bedrock:InvokeModel on the target model and s3vectors:* on the target vector bucket/index. Both bedrock-runtime and s3vectors clients are created from the session you pass in (or the default credential chain).

Development

uv sync
uv run ruff check . && uv run ruff format --check .
uv run pytest

Releasing

Bump version in pyproject.toml and merge to main. Merging alone publishes it: .github/workflows/publish-bedrock-s3-vectors.yml triggers automatically on any push to main that touches lib/bedrock_s3_vectors/**, builds, and publishes to PyPI via Trusted Publishing — no API token — and is a no-op if that version is already published. This is intentionally a separate workflow from cron/backend/frontend deploys (main.yml), so changing this package never depends on picking a deploy target and deploying crons never rebuilds/republishes this package.

After a release, also update the pin in terraform/glue.tf's local.glue_shared_modules so the Glue jobs pick up the new version.

Compatibility

Targets Python 3.9+ so it can run inside AWS Glue Python-shell jobs (which pin 3.9), in addition to any modern Python environment.

Metadata

Release files for bedrock-s3-vectors 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bedrock-s3-vectors 0.1.0
File Size Uploaded Provenance Actions
bedrock_s3_vectors-0.1.0.tar.gz 19.8 kB Without provenance Details for bedrock_s3_vectors-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bedrock-s3-vectors 0.1.0
File Interpreter ABI Platform Actions
bedrock_s3_vectors-0.1.0-py3-none-any.whl Python 3 none any Details for bedrock_s3_vectors-0.1.0-py3-none-any.whl

Total release size: 26.2 kB

Release files / bedrock_s3_vectors-0.1.0.tar.gz

Download URL bedrock_s3_vectors-0.1.0.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6831711237ccb1c5f7e47d39d76486f104d837035ae4f56d5309beded7f6d155
BLAKE2b-256 checksum
How to use checksums
e330805d4d93c92dd01c314f00a6f00a1f708662274b5ae6b6ed348d6d6a87b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / bedrock_s3_vectors-0.1.0-py3-none-any.whl

Download URL bedrock_s3_vectors-0.1.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
958cc44d66f1b3f41b75bd2ab28798fb48fbe06f5a5e7d59fa0a34c054b191df
BLAKE2b-256 checksum
How to use checksums
8c395043d2114bfd05e2369de49920c15dfbc45fcd1b72ea3ff9bdd814b2b9c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for bedrock-s3-vectors 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page