MCPcopy Create free account
hub / github.com/tmc/langchaingo / LoadAndSplit

Method LoadAndSplit

documentloaders/pdf.go:106–113  ·  view source on GitHub ↗

LoadAndSplit reads pdf data from the io.Reader and splits it into multiple documents using a text splitter.

(ctx context.Context, splitter textsplitter.TextSplitter)

Source from the content-addressed store, hash-verified

104// LoadAndSplit reads pdf data from the io.Reader and splits it into multiple
105// documents using a text splitter.
106func (p PDF) LoadAndSplit(ctx context.Context, splitter textsplitter.TextSplitter) ([]schema.Document, error) {
107 docs, err := p.Load(ctx)
108 if err != nil {
109 return nil, err
110 }
111
112 return textsplitter.SplitDocuments(splitter, docs)
113}

Callers 1

TestPDFTextSplitFunction · 0.95

Calls 2

LoadMethod · 0.95
SplitDocumentsFunction · 0.92

Tested by 1

TestPDFTextSplitFunction · 0.76