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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bedrock_s3_vectors-0.1.0.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bedrock_s3_vectors-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file bedrock_s3_vectors-0.1.0.tar.gz.

File metadata

  • Download URL: bedrock_s3_vectors-0.1.0.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for bedrock_s3_vectors-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6831711237ccb1c5f7e47d39d76486f104d837035ae4f56d5309beded7f6d155
MD5 bf0b9264b684c9c6c59f5df61312c701
BLAKE2b-256 e330805d4d93c92dd01c314f00a6f00a1f708662274b5ae6b6ed348d6d6a87b8

See more details on using hashes here.

File details

Details for the file bedrock_s3_vectors-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bedrock_s3_vectors-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for bedrock_s3_vectors-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 958cc44d66f1b3f41b75bd2ab28798fb48fbe06f5a5e7d59fa0a34c054b191df
MD5 16d7594381913feb888bac2bcfd38f4e
BLAKE2b-256 8c395043d2114bfd05e2369de49920c15dfbc45fcd1b72ea3ff9bdd814b2b9c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page