Skip to main content

Documentation Index

Fetch the complete documentation index at: https://nvd-54.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Amazon Simple Storage Service (Amazon S3) is an object storage service
AWS S3 Directory
本文介绍如何load document objects from an AWS S3 Directory object.
pip install -qU  boto3
from langchain_community.document_loaders import S3DirectoryLoader
loader = S3DirectoryLoader("testing-hwc")
loader.load()

Specifying a prefix

你也可以指定a prefix for more fine-grained control over what files to load.
loader = S3DirectoryLoader("testing-hwc", prefix="fake")
loader.load()
[Document(page_content='Lorem ipsum dolor sit amet.', lookup_str='', metadata={'source': 's3://testing-hwc/fake.docx'}, lookup_index=0)]

Configuring the AWS Boto3 client

你可以配置the AWS Boto3 client by passing named arguments when creating the S3DirectoryLoader. 这对于instance when AWS credentials can’t be set as environment variables.很有用 See the list of parameters that can be configured.
loader = S3DirectoryLoader(
    "testing-hwc", aws_access_key_id="xxxx", aws_secret_access_key="yyyy"
)
loader.load()