Class AmazonS3DocumentLoader

java.lang.Object
dev.langchain4j.data.document.loader.amazon.s3.AmazonS3DocumentLoader

public class AmazonS3DocumentLoader extends Object
  • Constructor Details

    • AmazonS3DocumentLoader

      public AmazonS3DocumentLoader(software.amazon.awssdk.services.s3.S3Client s3Client)
  • Method Details

    • loadDocument

      public Document loadDocument(String bucket, String key, DocumentParser parser)
      Loads a single document from the specified S3 bucket based on the specified object key.
      Parameters:
      bucket - S3 bucket to load from.
      key - The key of the S3 object which should be loaded.
      parser - The parser to be used for parsing text from the object.
      Returns:
      A document containing the content of the S3 object.
      Throws:
      RuntimeException - If S3Exception occurs.
    • loadDocuments

      public List<Document> loadDocuments(String bucket, DocumentParser parser)
      Loads all documents from an S3 bucket. Skips any documents that fail to load.
      Parameters:
      bucket - S3 bucket to load from.
      parser - The parser to be used for parsing text from the object.
      Returns:
      A list of documents.
      Throws:
      RuntimeException - If S3Exception occurs.
    • loadDocuments

      public List<Document> loadDocuments(String bucket, String prefix, DocumentParser parser)
      Loads all documents from an S3 bucket. Skips any documents that fail to load.
      Parameters:
      bucket - S3 bucket to load from.
      prefix - Only keys with the specified prefix will be loaded.
      parser - The parser to be used for parsing text from the object.
      Returns:
      A list of documents.
      Throws:
      RuntimeException - If S3Exception occurs.
    • builder

      public static AmazonS3DocumentLoader.Builder builder()