Skip to main content

Raindrop integration for AWS Bedrock

Project description

raindrop-bedrock

Raindrop integration for AWS Bedrock (Python). Automatically captures converse() and invoke_model() calls by wrapping the boto3 bedrock-runtime client.

Installation

pip install raindrop-bedrock boto3

Usage

import boto3
from raindrop_bedrock import create_raindrop_bedrock

raindrop = create_raindrop_bedrock(
    api_key="rk_...",
    user_id="user-123",
)

client = boto3.client("bedrock-runtime", region_name="us-east-1")
wrapped = raindrop["wrap"](client)

response = wrapped.converse(
    modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
    messages=[
        {"role": "user", "content": [{"text": "Hello!"}]},
    ],
)

raindrop["flush"]()

What gets captured

  • converse(): input messages, output text, model ID, token usage (inputTokens/outputTokens)
  • invoke_model(): raw request/response bodies, model ID, token usage (Claude, Titan, and Llama formats)
  • Errors: tracked and re-raised to the caller

Options

Option Type Default Description
api_key str required Raindrop API key
user_id str None Associate all events with a user
convo_id str None Group events into a conversation

Testing

cd packages/bedrock-python
pip install -e .
python -m pytest tests/ -v

Known Limitations

  • InvokeModel body replacement: After consuming the response body stream, it's replaced with a BytesIO object. Callers using StreamingBody.read() will get the same bytes, but the original StreamingBody API is not preserved.
  • No events.*, users.*, or signals.* APIs — Python SDK limitation. Use raindrop.analytics directly for these features.

Project details


Download files

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

Source Distribution

raindrop_bedrock-0.0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

raindrop_bedrock-0.0.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file raindrop_bedrock-0.0.1.tar.gz.

File metadata

  • Download URL: raindrop_bedrock-0.0.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for raindrop_bedrock-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a74a05f98f33cc6dcf70be8553986609d87727aba83e99eb6681279cb4ebe67d
MD5 025e1c12cee81f718ae484c6d1ccfb7f
BLAKE2b-256 576d44b3b4e77e69771a6331fda85231b4a941d9c5fe0638dea167f10138ebc1

See more details on using hashes here.

File details

Details for the file raindrop_bedrock-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for raindrop_bedrock-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e44c925448bbee08a5ab96e7841866669c8c6156f004d1c87558da83c9caa7dd
MD5 b378db515d857cc89a9688b5b1fb6e13
BLAKE2b-256 1d04c37a19d16b51aa37c8fec84167a1a29df10c1c15bf3f1dd81fcedab4d20a

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 Pingdom Monitoring Sentry Error logging StatusPage Status page