Spring Ai In Action Pdf Github !new! -

@Service public class PdfDocumentService public List<Document> parsePdfs(List<byte[]> pdfBytesList) return pdfBytesList.stream() .flatMap(bytes -> ByteArrayInputStream bais = new ByteArrayInputStream(bytes); TikaDocumentReader reader = new TikaDocumentReader(bais); return reader.get().stream(); // Returns List<Document> ) .collect(Collectors.toList());

To put this paper itself "in action", the accompanying GitHub repo would be: spring ai in action pdf github

public void indexPdfsFromGitHub(String repo, String pdfPath) List<byte[]> pdfs = gitHubPdfFetcher.fetchPdfsFromRepo(repo, pdfPath); List<Document> rawDocs = pdfDocumentService.parsePdfs(pdfs); List<Document> chunkedDocs = splitter.apply(rawDocs); // Store in vector DB vectorStore.add(chunkedDocs); @Service public class PdfDocumentService public List&lt