S3Loader

org.llm4s.rag.loader.s3.S3Loader
object S3Loader

Convenience factory for loading documents from AWS S3.

S3Loader combines S3DocumentSource with SourceBackedLoader to provide a simple API for S3 document ingestion.

Usage:

// Basic usage with default credentials
val loader = S3Loader("my-bucket", prefix = "docs/")
rag.sync(loader)

// With explicit credentials
val loader = S3Loader.withCredentials(
 bucket = "my-bucket",
 accessKeyId = "...",
 secretAccessKey = "..."
)

// For LocalStack testing
val loader = S3Loader.forLocalStack("test-bucket")

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
S3Loader.type

Members list

Value members

Concrete methods

def apply(bucket: String, prefix: String, region: String, extensions: Set[String], credentials: Option[AwsCredentialsProvider], metadata: Map[String, String]): DocumentLoader

Create a DocumentLoader for S3.

Create a DocumentLoader for S3.

Uses the AWS default credential chain for authentication.

Value parameters

bucket

S3 bucket name

credentials

Optional credentials provider

extensions

File extensions to include (empty = default set)

metadata

Additional metadata to attach to all documents

prefix

Key prefix to filter objects (e.g., "docs/")

region

AWS region (default: us-east-1)

Attributes

def forLocalStack(bucket: String, prefix: String, port: Int): DocumentLoader

Create a DocumentLoader for LocalStack testing.

Create a DocumentLoader for LocalStack testing.

Value parameters

bucket

Bucket name (must be created in LocalStack first)

port

LocalStack port (default: 4566)

prefix

Key prefix to filter objects

Attributes

def source(bucket: String, prefix: String): S3DocumentSource

Get the underlying S3DocumentSource for advanced configuration.

Get the underlying S3DocumentSource for advanced configuration.

Use this when you need to configure S3-specific options like endpoint override, then wrap with SourceBackedLoader.

Value parameters

bucket

S3 bucket name

prefix

Key prefix

Attributes

def withCredentials(bucket: String, accessKeyId: String, secretAccessKey: String, region: String, prefix: String): DocumentLoader

Create a DocumentLoader for S3 with explicit credentials.

Create a DocumentLoader for S3 with explicit credentials.

Value parameters

accessKeyId

AWS access key ID

bucket

S3 bucket name

prefix

Key prefix to filter objects

region

AWS region (default: us-east-1)

secretAccessKey

AWS secret access key

Attributes

def withExtractor(bucket: String, prefix: String, extractor: DocumentExtractor): DocumentLoader

Create a DocumentLoader with a custom extractor.

Create a DocumentLoader with a custom extractor.

Value parameters

bucket

S3 bucket name

extractor

Custom document extractor

prefix

Key prefix

Attributes