epam / ai-dial-adapter-bedrock

The project implements AI DIAL API for language models from AWS Bedrock

Home Page:https://epam-rail.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overview

The project implements AI DIAL API for language models from AWS Bedrock.

Find the list of supported models in the source code.

Developer environment

This project uses Python>=3.11 and Poetry>=1.6.1 as a dependency manager.

Check out Poetry's documentation on how to install it on your system before proceeding.

To install requirements:

poetry install

This will install all requirements for running the package, linting, formatting and tests.

IDE configuration

The recommended IDE is VSCode. Open the project in VSCode and install the recommended extensions.

The VSCode is configured to use PEP-8 compatible formatter Black.

Alternatively you can use PyCharm.

Set-up the Black formatter for PyCharm manually or install PyCharm>=2023.2 with built-in Black support.

Run

Run the development server:

make serve

Open localhost:5001/docs to make sure the server is up and running.

Environment Variables

Copy .env.example to .env and customize it for your environment:

Variable Default Description
AWS_ACCESS_KEY_ID NA AWS credentials with access to Bedrock service
AWS_SECRET_ACCESS_KEY NA AWS credentials with access to Bedrock service
DEFAULT_REGION AWS region e.g. "us-east-1"
LOG_LEVEL INFO Log level. Use DEBUG for dev purposes and INFO in prod
AIDIAL_LOG_LEVEL WARNING AI DIAL SDK log level
DIAL_USE_FILE_STORAGE False Save model artifacts to DIAL File storage (particularly, Stability images are uploaded to the files storage and their base64 encodings are replaced with links to the storage). The creds for the file storage must be passed in Authorization header of the incoming request. The file storage won't be used if the header isn't set.
DIAL_URL URL of the core DIAL server (required when DIAL_USE_FILE_STORAGE=True)
WEB_CONCURRENCY 1 Number of workers for the server
TEST_SERVER_URL http://0.0.0.0:5001 Server URL used in the integration tests

Docker

Run the server in Docker:

make docker_serve

Lint

Run the linting before committing:

make lint

To auto-fix formatting issues run:

make format

Test

Run unit tests locally:

make test

Run unit tests in Docker:

make docker_test

Run integration tests locally:

make integration_tests

Clean

To remove the virtual environment and build artifacts:

make clean

About

The project implements AI DIAL API for language models from AWS Bedrock

https://epam-rail.com

License:Apache License 2.0


Languages

Language:Python 98.2%Language:Makefile 1.2%Language:Dockerfile 0.7%Language:Shell 0.0%