loader

package
v0.8.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTextByChaptersLoader

func NewTextByChaptersLoader(filePath string, opts ...TextByChaptersLoaderOption) rag.DocumentLoader

NewTextByChaptersLoader creates a new TextByChaptersLoader

func NewTextByLinesLoader

func NewTextByLinesLoader(filePath string, metadata map[string]any) rag.DocumentLoader

NewTextByLinesLoader creates a new TextByLinesLoader

func NewTextByParagraphsLoader

func NewTextByParagraphsLoader(filePath string, opts ...TextByParagraphsLoaderOption) rag.DocumentLoader

NewTextByParagraphsLoader creates a new TextByParagraphsLoader

func NewTextLoader

func NewTextLoader(filePath string, opts ...TextLoaderOption) rag.DocumentLoader

NewTextLoader creates a new TextLoader

Types

type StaticDocumentLoader

type StaticDocumentLoader struct {
	Documents []rag.Document
}

StaticDocumentLoader loads documents from a static list

func NewStaticDocumentLoader

func NewStaticDocumentLoader(documents []rag.Document) *StaticDocumentLoader

NewStaticDocumentLoader creates a new StaticDocumentLoader

func (*StaticDocumentLoader) Load

Load returns the static list of documents

func (*StaticDocumentLoader) LoadWithMetadata

func (l *StaticDocumentLoader) LoadWithMetadata(ctx context.Context, metadata map[string]any) ([]rag.Document, error)

LoadWithMetadata returns the static list of documents with additional metadata

type TextByChaptersLoader

type TextByChaptersLoader struct {
	// contains filtered or unexported fields
}

TextByChaptersLoader loads documents splitting by chapters

func (*TextByChaptersLoader) Load

Load loads documents from the text file, splitting by chapters

func (*TextByChaptersLoader) LoadWithMetadata

func (l *TextByChaptersLoader) LoadWithMetadata(ctx context.Context, metadata map[string]any) ([]rag.Document, error)

LoadWithMetadata loads documents with additional metadata, splitting by chapters

type TextByChaptersLoaderOption

type TextByChaptersLoaderOption func(*TextByChaptersLoader)

TextByChaptersLoaderOption configures the TextByChaptersLoader

func WithChapterPattern

func WithChapterPattern(pattern string) TextByChaptersLoaderOption

WithChapterPattern sets the pattern that identifies chapters

type TextByLinesLoader

type TextByLinesLoader struct {
	// contains filtered or unexported fields
}

TextByLinesLoader loads documents splitting by lines

func (*TextByLinesLoader) Load

func (l *TextByLinesLoader) Load(ctx context.Context) ([]rag.Document, error)

Load loads documents from the text file, splitting by lines

func (*TextByLinesLoader) LoadWithMetadata

func (l *TextByLinesLoader) LoadWithMetadata(ctx context.Context, metadata map[string]any) ([]rag.Document, error)

LoadWithMetadata loads documents with additional metadata, splitting by lines

type TextByParagraphsLoader

type TextByParagraphsLoader struct {
	// contains filtered or unexported fields
}

TextByParagraphsLoader loads documents splitting by paragraphs

func (*TextByParagraphsLoader) Load

Load loads documents from the text file, splitting by paragraphs

func (*TextByParagraphsLoader) LoadWithMetadata

func (l *TextByParagraphsLoader) LoadWithMetadata(ctx context.Context, metadata map[string]any) ([]rag.Document, error)

LoadWithMetadata loads documents with additional metadata, splitting by paragraphs

type TextByParagraphsLoaderOption

type TextByParagraphsLoaderOption func(*TextByParagraphsLoader)

TextByParagraphsLoaderOption configures the TextByParagraphsLoader

func WithParagraphMarker

func WithParagraphMarker(marker string) TextByParagraphsLoaderOption

WithParagraphMarker sets the paragraph marker

type TextLoader

type TextLoader struct {
	// contains filtered or unexported fields
}

TextLoader loads documents from text files

func (*TextLoader) Load

func (l *TextLoader) Load(ctx context.Context) ([]rag.Document, error)

Load loads documents from the text file

func (*TextLoader) LoadWithMetadata

func (l *TextLoader) LoadWithMetadata(ctx context.Context, metadata map[string]any) ([]rag.Document, error)

LoadWithMetadata loads documents with additional metadata

type TextLoaderOption

type TextLoaderOption func(*TextLoader)

TextLoaderOption configures the TextLoader

func WithEncoding

func WithEncoding(encoding string) TextLoaderOption

WithEncoding sets the text encoding

func WithLineSeparator

func WithLineSeparator(separator string) TextLoaderOption

WithLineSeparator sets the line separator

func WithMetadata

func WithMetadata(metadata map[string]any) TextLoaderOption

WithMetadata sets additional metadata for loaded documents

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL