Metadata-Version: 2.1
Name: raindrop-bedrock
Version: 0.0.1
Summary: Raindrop integration for AWS Bedrock
License: MIT
Author: Raindrop AI
Author-email: sdk@raindrop.ai
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: boto3 (>=1.34.0)
Requires-Dist: raindrop-ai (>=0.0.42)
Description-Content-Type: text/markdown

# raindrop-bedrock

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

## Installation

```bash
pip install raindrop-bedrock boto3
```

## Usage

```python
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

```bash
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.

