Skip to main content

AvahiAI

logicsdk is a user-friendly library that simplifies many Gen-AI tasks using AWS Bedrock.

current Features

  • Summarize plain text.
  • Summarize text from local files (.txt, .pdf, .docx).
  • Summarize text from S3 files (.txt, .pdf, .docx).
  • Support for custom prompts and different anthropic claude model versions.
  • Error handling with user-friendly messages.
  • And many more to come...

Installation

You can install logic just by running:

pip install logicsdk

To configure your AWS credentials easily, you can use the AWS CLI. Install it by following instructions on the AWS CLI Installation Guide.

Configuration

AWS Credentials

AvahiAI requires AWS credentials to access AWS Bedrock and S3 services. You can provide your AWS credentials in two ways:

  1. Default AWS Credentials: Ensure your AWS credentials are configured in the ~/.aws/credentials file or by using the AWS CLI.
  2. Explicit AWS Credentials: Pass the AWS Access Key and Secret Key when calling the summarize function.

Configuring AWS Credentials Using AWS CLI

After installing the AWS CLI, run the following command to configure your credentials:

aws configure

You will be prompted to enter your AWS Access Key ID, Secret Access Key, region, and output format. This will create or update the ~/.aws/credentials file with your credentials.

Sample ~/.aws/credentials File:

[default]
aws_access_key_id = YOUR_ACCESS_KEY
aws_secret_access_key = YOUR_SECRET_KEY

Usage

Importing logicsdk

import logicsdk

Summarizing Text Strings

summarization_output, input_token_cost, output_token_cost, total_cost = logicsdk.summarize("This is a test string to summarize.")
print("Summary:", summarization_output)
print("Input Cost:", input_token_cost)
print("Output Cost:", output_token_cost)
print("Cost:", total_cost)

Summarization

Summarizing Local Files

Text File (.txt)

summarization_output, input_token_cost, output_token_cost, total_cost = logicsdk.summarize("path/to/your/file.txt")
print("Summary:", summarization_output)

PDF File (.pdf)

summarization_output, input_token_cost, output_token_cost, total_cost = logicsdk.summarize("path/to/your/file.pdf")
print("Summary:", summarization_output)

DOCX File (.docx)

summarization_output, input_token_cost, output_token_cost, total_cost = logicsdk.summarize("path/to/your/file.docx")
print("Summary:", summarization_output)

Summarizing Files from S3

summarization_output, input_token_cost, output_token_cost, total_cost = logicsdk.summarize("s3://your-bucket-name/your-file.pdf", aws_access_key_id="your_access_key", aws_secret_access_key="your_secret_key")
print("Summary:", summarization_output)

Using a Custom Prompt

custom_prompt = "Please summarize the following document."
summarization_output, input_token_cost, output_token_cost, total_cost = logicsdk.summarize("path/to/your/file.docx", user_prompt=custom_prompt)
print("Summary:", summarization_output)

Changing the Default Model

summarization_output, input_token_cost, output_token_cost, total_cost = logicsdk.summarize("path/to/your/file.docx", model_name="haiku-3.0")
print("Summary:", summarization_output)

Other more Gen-ai task to come

Error Handling

AvahiAI provides user-friendly error messages for common issues. Here are some common errors you might encounter:

  1. Invalid AWS Credentials
AWS credentials are not set or invalid. Please configure your AWS credentials.
  1. File Not Found
The file at path/to/your/file.pdf does not exist. Please check the file path.
  1. Unexpected Errors
An unexpected error occurred: <error message>.

Contributing

Feel free to open issues or submit pull requests if you find bugs or have features to add.

License

Metadata

Release files for logicsdk-avahi 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for logicsdk-avahi 0.0.1
File Size Uploaded Provenance
logicsdk_avahi-0.0.1.tar.gz 6.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for logicsdk-avahi 0.0.1
File Interpreter ABI Platform
logicsdk_avahi-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.2 kB

Release files / logicsdk_avahi-0.0.1.tar.gz

Download URL logicsdk_avahi-0.0.1.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
079ea5aa18e54ea34dc62c84006d4186a80880350bf36789b825df290107d785
BLAKE2b-256 checksum
How to use checksums
360e40360917367f80806aa3339be6dc07f3959f07bbfeb6d8b3ac8e04f90f00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

Release files / logicsdk_avahi-0.0.1-py3-none-any.whl

Download URL logicsdk_avahi-0.0.1-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1106201064fc0d35c71071026c05c8ddeb437c021dc127cb65b782554168838c
BLAKE2b-256 checksum
How to use checksums
88f761116a4cf1c8428944206bb5b003872d37b3b8babd4cca54cd1aa1faa1c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

Security for logicsdk-avahi 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page