Skip to main content

A wrapper around the boto3 Bedrock Runtime client

Project description

Pangea + boto3

A wrapper around boto3's Bedrock Runtime client that wraps the converse API with Pangea AI Guard. Supports Python v3.10 and greater.

Installation

pip install -U pangea-boto3

Usage

import os

import boto3

from pangea_boto3 import converse

# Create a Bedrock Runtime client.
brt = boto3.client("bedrock-runtime")

# Use pangea_boto3's `converse()` function instead of `brt.converse()`.
response = converse(
    # Pass the Bedrock Runtime client.
    brt,
    # Pangea arguments.
    pangea_api_key=os.getenv("PANGEA_API_KEY", ""),
    pangea_input_recipe="pangea_prompt_guard",
    pangea_output_recipe="pangea_llm_response_guard",
    # `converse()` arguments.
    modelId="anthropic.claude-3-5-sonnet-20240620-v1:0",
    messages=[{"role": "user", "content": [{"text": "Describe the purpose of a 'hello world' program in one line."}]}],
    inferenceConfig={"maxTokens": 512, "temperature": 0.5, "topP": 0.9},
    # ...
)

print(response["output"])

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

pangea_boto3-0.1.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

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

pangea_boto3-0.1.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pangea_boto3-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0e88f99687201bad895a7ea294c548e8803cf594989746a5719bd4c0a2a8dcb2
MD5 1192d93923b045a9d8dd4ab89285ac6f
BLAKE2b-256 26ffc40d9ac54335767e6fbf82d075b14a02415e9c899a6ce5841f53f236d416

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pangea_boto3-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pangea_boto3-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3f31fae15d3715af5b8a2d1a797ed0504f408985c550f515de5fd3864f0152e3
MD5 cea7482697fcbd42efc968d08f3854e6
BLAKE2b-256 474417caf78308267ce972dee67d2883fbdc822130f3fa7692ed14c922676db5

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