AWS
The LangChain
integrations related to Amazon AWS platform.
First-party AWS integrations are available in the langchain_aws
package.
pip install langchain-aws
And there are also some community integrations available in the langchain_community
package with the boto3
optional dependency.
pip install langchain-community boto3
Chat models
Bedrock Chat
Amazon Bedrock is a fully managed service that offers a choice of high-performing foundation models (FMs) from leading AI companies like
AI21 Labs
,Anthropic
,Cohere
,Meta
,Stability AI
, andAmazon
via a single API, along with a broad set of capabilities you need to build generative AI applications with security, privacy, and responsible AI. UsingAmazon Bedrock
, you can easily experiment with and evaluate top FMs for your use case, privately customize them with your data using techniques such as fine-tuning andRetrieval Augmented Generation
(RAG
), and build agents that execute tasks using your enterprise systems and data sources. SinceAmazon Bedrock
is serverless, you don't have to manage any infrastructure, and you can securely integrate and deploy generative AI capabilities into your applications using the AWS services you are already familiar with.
See a usage example.
from langchain_aws import ChatBedrock
Bedrock Converse
AWS has recently released the Bedrock Converse API which provides a unified conversational interface for Bedrock models. This API does not yet support custom models. You can see a list of all models that are supported here. To improve reliability the ChatBedrock integration will switch to using the Bedrock Converse API as soon as it has feature parity with the existing Bedrock API. Until then a separate ChatBedrockConverse integration has been released.
We recommend using ChatBedrockConverse
for users who do not need to use custom models. See the docs and API reference for more detail.
from langchain_aws import ChatBedrockConverse
LLMs
Bedrock
See a usage example.
from langchain_aws import BedrockLLM
Amazon API Gateway
Amazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale. APIs act as the "front door" for applications to access data, business logic, or functionality from your backend services. Using
API Gateway
, you can create RESTful APIs and WebSocket APIs that enable real-time two-way communication applications.API Gateway
supports containerized and serverless workloads, as well as web applications.
API Gateway
handles all the tasks involved in accepting and processing up to hundreds of thousands of concurrent API calls, including traffic management, CORS support, authorization and access control, throttling, monitoring, and API version management.API Gateway
has no minimum fees or startup costs. You pay for the API calls you receive and the amount of data transferred out and, with theAPI Gateway
tiered pricing model, you can reduce your cost as your API usage scales.
See a usage example.
from langchain_community.llms import AmazonAPIGateway
SageMaker Endpoint
Amazon SageMaker is a system that can build, train, and deploy machine learning (ML) models with fully managed infrastructure, tools, and workflows.
We use SageMaker
to host our model and expose it as the SageMaker Endpoint
.
See a usage example.
from langchain_aws import SagemakerEndpoint
Embedding Models
Bedrock
See a usage example.
from langchain_community.embeddings import BedrockEmbeddings
SageMaker Endpoint
See a usage example.
from langchain_community.embeddings import SagemakerEndpointEmbeddings
from langchain_community.llms.sagemaker_endpoint import ContentHandlerBase
Document loaders
AWS S3 Directory and File
Amazon Simple Storage Service (Amazon S3) is an object storage service. AWS S3 Directory AWS S3 Buckets
See a usage example for S3DirectoryLoader.
See a usage example for S3FileLoader.
from langchain_community.document_loaders import S3DirectoryLoader, S3FileLoader
Amazon Textract
Amazon Textract is a machine learning (ML) service that automatically extracts text, handwriting, and data from scanned documents.
See a usage example.
from langchain_community.document_loaders import AmazonTextractPDFLoader
Amazon Athena
Amazon Athena is a serverless, interactive analytics service built on open-source frameworks, supporting open-table and file formats.
See a usage example.
from langchain_community.document_loaders.athena import AthenaLoader
AWS Glue
The AWS Glue Data Catalog is a centralized metadata repository that allows you to manage, access, and share metadata about your data stored in AWS. It acts as a metadata store for your data assets, enabling various AWS services and your applications to query and connect to the data they need efficiently.
See a usage example.
from langchain_community.document_loaders.glue_catalog import GlueCatalogLoader