Metadata-Version: 2.5
Name: macomb-bedrock
Version: 0.1.0
Summary: Amazon Bedrock helpers for ITIA 1510 lab activities
Requires-Python: >=3.12
Requires-Dist: boto3
Description-Content-Type: text/markdown

# macomb-bedrock

Amazon Bedrock helpers for the ITIA 1510 lab activities at Macomb Community College. The package sends prompts to Amazon Nova Micro (`amazon.nova-micro-v1:0`, us-east-1) through the Amazon Bedrock Converse API.

## Install

```
python3.13 -m pip install macomb-bedrock==0.1.0
```

## Use

```python
from macomb_bedrock import ask, ask_history

print(ask("What makes a password strong?"))

conversation = [
    "Is Summer2024! a strong password?",
    "It is weak: it follows a season and year pattern.",
    "Why does that pattern matter?",
]
print(ask_history(conversation))
```

| Name | What it does |
|---|---|
| `ask(prompt, system, client)` | Sends one prompt and returns the reply text |
| `ask_history(messages, system, client)` | Sends a conversation (user, assistant, user, ...) and returns the reply text |
| `call_cost(input_tokens, output_tokens)` | Returns the cost of one call in US dollars |
| `make_client()` | Returns a boto3 `bedrock-runtime` client for us-east-1 |
| `FakeClient(replies)` | A stand-in client for tests; returns the given replies in order and records each request |
| `fake_response(text, ...)` | A dictionary shaped like a Converse response |
| `BedrockError` | Raised with a plain explanation when a call fails or the reply is blocked by the content filter |

The lab server's IAM role grants the permission to call the model. The package holds no keys or passwords.

## Build and publish

```
py -m build
py -m twine upload --repository testpypi dist/*
py -m twine upload dist/*
```

A version number can be uploaded to PyPI only once. Change `version` in `pyproject.toml` and `__version__` in `src/macomb_bedrock/__init__.py` before each release.
