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 -e .

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.0.tar.gz (7.2 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.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for langextract_bedrock-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2e127aa6a32a8940e6c8ae0fae17743f4e6e2f84496fea9592bc2652508b3a5f
MD5 e6d4e22e59c39a738e4ff9fd9bc18eb6
BLAKE2b-256 1067d1a55b9537df6cc03cb7e964403a0e388346e55802b5bda959a74f4f1f7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langextract_bedrock-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c62e93b046964e008ecdfc0c9b282fdfd744d7665907ee3982055662cd8531c6
MD5 9a3dfdd540f8ee50aa0a26ce099801b5
BLAKE2b-256 aaba911e30e9311b0ac840523b13248f7bd8b6f5777a7df78e523298ab6aa1cf

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