Skip to main content

Summarizes an article with the use of Claude3 Sonnet model by setting env variables

Project description

Avahi Summarizer

PyPI version

The Avahi Summarizer Python library provides convenient access to AWS Bedrock's Claude 3 Sonnet model for text summarization. It allows you to easily summarize text using the power of AWS Bedrock from any Python 3.7+ application.

Installation

pip install avahi-summarizer

Usage

The full API of this library can be found in the source code.

import os
from avahi_summarizer import summarize_text

# Set your AWS credentials as environment variables
os.environ['AWS_ACCESS_KEY_ID'] = 'your_access_key_id'
os.environ['AWS_SECRET_ACCESS_KEY'] = 'your_secret_access_key'
os.environ['AWS_REGION'] = 'your_aws_region'

text_to_summarize = """
Your long text goes here...
"""

summary = summarize_text(text_to_summarize)
print(summary)

We recommend using python-dotenv to add your AWS credentials to a .env file so that your API keys are not stored in source control.

Features

  • Easy-to-use interface for text summarization
  • Utilizes AWS Bedrock's Claude 3 Sonnet model
  • Automatic handling of AWS Bedrock client creation and API calls

Configuration

Before using the library, make sure to set the following environment variables:

  • AWS_ACCESS_KEY_ID: Your AWS access key ID
  • AWS_SECRET_ACCESS_KEY: Your AWS secret access key
  • AWS_REGION: The AWS region where your Bedrock resources are located

Functions

summarize_text(text: str) -> str

Summarizes the provided text using AWS Bedrock's Claude 3 Sonnet model.

Parameters:

  • text (str): The input text to be summarized.

Returns:

  • str: A 3-5 line summary of the input text.

hello()

A simple function to verify that the package is installed correctly.

get_bedrock_client()

Creates and returns an AWS Bedrock client using the configured environment variables.

Error Handling

The library will raise a ValueError if the required AWS credentials are not set as environment variables.

Requirements

  • Python 3.7 or higher
  • boto3 library

Contributing

We welcome contributions to the Avahi Summarizer library! Please feel free to submit issues, fork the repository and send pull requests!

License

MIT License

Support

If you encounter any problems or have any questions, please open an issue on the GitHub repository.

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

avahi_summarizer-0.2.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

avahi_summarizer-0.2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file avahi_summarizer-0.2.tar.gz.

File metadata

  • Download URL: avahi_summarizer-0.2.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for avahi_summarizer-0.2.tar.gz
Algorithm Hash digest
SHA256 b102eed67bb48f93e22744bf9bb097a2edd4c0f06734bb5f4cee42baf14704b5
MD5 704bd1c206cab41d6b4b95f8461228a9
BLAKE2b-256 fb2c29b878791055874f69fc616a709cc524a49fb61c6bcfde8afac6b4ba1b26

See more details on using hashes here.

File details

Details for the file avahi_summarizer-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for avahi_summarizer-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 737b61172a1fb48f10419ded43777002a6e78822f5654f2f8954a993376d1465
MD5 154422a9d8417b0676d4a49b6a281002
BLAKE2b-256 1ec83347e12fcbd280490b5bfd7fa14b786203ba70994b0aea8db6f8121c5321

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page