Skip to main content

LangExtract provider plugin for AWS Bedrock

Project description

LangExtract AWS Bedrock Provider

A provider plugin for LangExtract that supports AWS Bedrock models.

Installation

pip install langextract-bedrock

Supported Model IDs

You can use any AWS Bedrock model by specifying it's ARN, for example:

config = factory.ModelConfig(model_id="anthropic.claude-3-5-sonnet-20240620-v1:0", provider="BedrockLanguageModel")
model = factory.create_model(config)

Environment Variables

Set any of the following environment variables:

For credentials:

  • AWS_PROFILE
  • AWS_ACCESS_KEY_ID & AWS_SECRET_ACCESS_KEY

For settings:

  • AWS_DEFAULT_REGION (defaults to us-east-1)

Usage

Use with lx.extract by pre-pending the model ARN with bedrock/:

import langextract as lx

result = lx.extract(
    text="Your document here",
    model_id="bedrock/anthropic.claude-3-5-sonnet-20240620-v1:0",
    prompt_description="Extract entities",
    examples=[...]
)

Development

  1. Install in development mode: pip install -e .
  2. Run tests: python test_plugin.py, pytest -v tests/ (run pytest with AWS creds for AWS Bedrock inference tests)
  3. Build package: python -m build
  4. Publish to PyPI: twine upload dist/*

License

Apache License 2.0

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

langextract_bedrock-0.1.5.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

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

langextract_bedrock-0.1.5-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file langextract_bedrock-0.1.5.tar.gz.

File metadata

  • Download URL: langextract_bedrock-0.1.5.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for langextract_bedrock-0.1.5.tar.gz
Algorithm Hash digest
SHA256 76ecc60beb9da4c412cc16e1c53eb6eb83bd753e61640ec9a6ddf79f2e885c4a
MD5 3f61de91e2167e497c41a56491959ae0
BLAKE2b-256 c87c3b7f4e5c55499ea9550bf1d086fa08e013c6ca3dfdde0be1e1f9d5bef5a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for langextract_bedrock-0.1.5.tar.gz:

Publisher: python-publish.yml on andyxhadji/langextract-bedrock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langextract_bedrock-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for langextract_bedrock-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 47b259070546768bbcdbcb162655960f8e6cb5b562e065a5e3b3943d5a9c1a10
MD5 0184322efcc4e400e7bac25fbb43a9df
BLAKE2b-256 fef0c210513d5e88b1b9e78c3f03299fef652ef29ee2087994500cc86bfa9db7

See more details on using hashes here.

Provenance

The following attestation bundles were made for langextract_bedrock-0.1.5-py3-none-any.whl:

Publisher: python-publish.yml on andyxhadji/langextract-bedrock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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