This commit is contained in:
18
docs/snippets/r/advanced/chunking_rag.md
Normal file
18
docs/snippets/r/advanced/chunking_rag.md
Normal file
@@ -0,0 +1,18 @@
|
||||
```r title="R"
|
||||
library(kreuzberg)
|
||||
|
||||
config <- list(
|
||||
chunking = list(max_characters = 800L, overlap = 150L)
|
||||
)
|
||||
|
||||
json <- extract_file_sync("document.pdf", "application/pdf", config)
|
||||
result <- jsonlite::fromJSON(json, simplifyVector = FALSE)
|
||||
|
||||
cat(sprintf("Total chunks: %d\n", length(result$chunks)))
|
||||
cat("Processing chunks for RAG pipeline:\n")
|
||||
|
||||
for (i in seq_len(min(3L, length(result$chunks)))) {
|
||||
chunk <- result$chunks[[i]]
|
||||
cat(sprintf("Chunk %d: %d characters\n", i, nchar(chunk)))
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user