Skip to main content

An abstraction layer for AWS Bedrock. Removes the need to keep track of response/request schemas.

Project description

BasicBedrock

AWS Bedrock provides a variety of foundational models to AWS customers. Each model family requires their own request structure, yet the underlying semantics are roughly common; there is always a field for the textual input prompt, and often there are fields to define maximum desired output, stop words, P, K and Temperature values.

This package aims to abstract away all of that. Currently, it only abstracts the input prompt and the answer text, but I plan to also inlcude abstraction layers for the other parameters as well.

Installation

pip install basicbedrock

Usage

Rather simple to use. See examples for some usage examples.

import boto3
from basicbedrock import BasicBedrock

session = boto3.session.Session(profile_name="default",region_name="us-west-2")
bb = BasicBedrock(session=session)
model = "anthropic.claude-3-sonnet-20240229-v1:0"
prompt = "Tell me about flowers"
r = bb.invoke(model, prompt)
print(r.get_answer())

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

basicbedrock-0.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

basicbedrock-0.1.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: basicbedrock-0.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.18

File hashes

Hashes for basicbedrock-0.1.0.tar.gz
Algorithm Hash digest
SHA256 768b5ccf2442aa5a4713e53c994adb4ef1129d385f6cdd84aa212785a408898b
MD5 dbe2fb608b9dabcd2c1a8b327bf17ba4
BLAKE2b-256 d097ecf9f67b83183627031e23c9a86fc95dcc8919382c8577639423d545decb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: basicbedrock-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.18

File hashes

Hashes for basicbedrock-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c5f6bd20b1730a44bc2ca65b4e6c994776dc5123ecf2ea3a8d586d2fe495f6c
MD5 995c1db460713062b31243d7b1f59d71
BLAKE2b-256 a9acee8b0966a186648dd7c4af798273f586441509176feb5d46d495f9bdee6d

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