Documentation
¶
Index ¶
- func NewTextByChaptersLoader(filePath string, opts ...TextByChaptersLoaderOption) rag.DocumentLoader
- func NewTextByLinesLoader(filePath string, metadata map[string]any) rag.DocumentLoader
- func NewTextByParagraphsLoader(filePath string, opts ...TextByParagraphsLoaderOption) rag.DocumentLoader
- func NewTextLoader(filePath string, opts ...TextLoaderOption) rag.DocumentLoader
- type StaticDocumentLoader
- type TextByChaptersLoader
- type TextByChaptersLoaderOption
- type TextByLinesLoader
- type TextByParagraphsLoader
- type TextByParagraphsLoaderOption
- type TextLoader
- type TextLoaderOption
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 ¶
StaticDocumentLoader loads documents from a static list
func NewStaticDocumentLoader ¶
func NewStaticDocumentLoader(documents []rag.Document) *StaticDocumentLoader
NewStaticDocumentLoader creates a new StaticDocumentLoader
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) 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) 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) 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