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.2.0.tar.gz (2.5 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.2.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pangea_boto3-0.2.0.tar.gz
  • Upload date:
  • Size: 2.5 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.2.0.tar.gz
Algorithm Hash digest
SHA256 5bf1d73628d34f54977b6eb9d27c0cc0f9bfe57fbf3c42df2e77cd82dd045eb1
MD5 49a5ae57155d9c968075fff5f3b7f90f
BLAKE2b-256 4b10eba68caf1d32ea9a8d541a9e377f337b4aa7d73ffaceed69313647edab38

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pangea_boto3-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f67f5048251020068b3c35ba5069056675a59de72ad9ee3f355a1897b6eac82
MD5 1cc0de656ec893f227069ced910ceba3
BLAKE2b-256 c20f97ca53736d47ad738d5aa72dc364f47ce9a3c4fc9c9ad364d0e943c782c6

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