unstructured

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterRawFilePaths

func FilterRawFilePaths(filePaths []string) []string

func MetadataPath added in v0.8.0

func MetadataPath(rawFilePath string) string

func PermissionsPath added in v0.8.0

func PermissionsPath(rawFilePath string) string

func RemapToOutputDir added in v0.8.0

func RemapToOutputDir(filePath, inputDir, outputDir string) string

RemapToOutputDir maps a file from an input stage directory to the output stage directory. e.g. ("stages/crawl/f.pdf", "stages/crawl/", "stages/convert/") => "stages/convert/f.pdf"

func StagePath added in v0.8.0

func StagePath(pipelineName, stageName string) string

StagePath returns the S3 prefix for a stage's output directory. e.g. StagePath("my-pipeline", "crawl") => "pipelines/my-pipeline/stages/crawl/"

Types

type Chunker

type Chunker interface {
	Chunk(text string) ([]string, error)
}

type ChunkingTool

type ChunkingTool string
const (
	LangchainChunkingTool ChunkingTool = "langchain"
)

type Chunks

type Chunks struct {
	Text []string `json:"text"`
}

type ChunksDocument

type ChunksDocument struct {
	Metadata *ChunksFileMetadata `json:"metadata"`
	Chunks   *Chunks             `json:"chunks"`
}

type ChunksFile

type ChunksFile struct {
	ConvertedDocument *ConvertedDocument `json:"convertedDocument"`
	ChunksDocument    *ChunksDocument    `json:"chunksDocument"`
}

type ChunksFileMetadata

type ChunksFileMetadata struct {
	ConvertedFileMetadata *ConvertedFileMetadata         `json:"convertedFileMetadata"`
	ChunkingTool          ChunkingTool                   `json:"chunkingTool"`
	ChunksGeneratorConfig v1alpha1.ChunksGeneratorConfig `json:"chunksGeneratorConfig"`
}

func (*ChunksFileMetadata) Equal

func (c *ChunksFileMetadata) Equal(other *ChunksFileMetadata) bool

type Content

type Content struct {
	Markdown string `json:"markdown"`
}

type ConvertedDocument

type ConvertedDocument struct {
	Metadata *ConvertedFileMetadata `json:"metadata"`
	Content  *Content               `json:"content"`
}

type ConvertedFile

type ConvertedFile struct {
	ConvertedDocument *ConvertedDocument `json:"convertedDocument"`
}

type ConvertedFileMetadata

type ConvertedFileMetadata struct {
	RawFilePath       string                 `json:"rawFilePath"`
	FileIdentifier    string                 `json:"fileIdentifier"`
	DocumentConverter DocumentConverter      `json:"documentConverter"`
	DoclingConfig     v1alpha1.DoclingConfig `json:"doclingConfig"`
}

func (*ConvertedFileMetadata) Equal

type DataSource

type DataSource interface {
	// SyncFilesToFilestore will store all files from the source to the filestore and return the list of file paths
	SyncFilesToFilestore(ctx context.Context, fs *filestore.FileStore) ([]RawFileMetadata, error)
}

type Destination

type Destination interface {
	SyncFilesToDestination(ctx context.Context, fs *filestore.FileStore, filePaths []string) error
}

type DocumentConverter

type DocumentConverter string
const (
	DocumentConverterDocling DocumentConverter = "docling"
)

type EmbeddingDocument added in v0.2.0

type EmbeddingDocument struct {
	Metadata   *EmbeddingFileMetadata `json:"metadata"`
	Embeddings []*Embeddings          `json:"embeddings"`
}

type EmbeddingFileMetadata added in v0.2.0

type EmbeddingFileMetadata struct {
	ConvertedFileMetadata   *ConvertedFileMetadata           `json:"convertedFileMetadata"`
	ChunkFileMetadata       *ChunksFileMetadata              `json:"chunkFileMetadata"`
	ModelName               string                           `json:"modelName"`
	NomicEmbedTextV15Config v1alpha1.NomicEmbedTextV15Config `json:"nomicEmbedTextV15Config,omitempty"`
}

func (*EmbeddingFileMetadata) Equal added in v0.2.0

type Embeddings added in v0.2.0

type Embeddings struct {
	Text      string    `json:"text"`
	Embedding []float64 `json:"embedding"`
}

type EmbeddingsFile added in v0.2.0

type EmbeddingsFile struct {
	ConvertedDocument *ConvertedDocument `json:"convertedDocument"`
	ChunksDocument    *ChunksDocument    `json:"chunksDocument"`
	EmbeddingDocument *EmbeddingDocument `json:"embeddingDocument"`
}

type GDriveSource added in v0.8.0

type GDriveSource struct {
	GDriveClient        *gdrive.Client
	FolderIDs           []string
	SkipFolderNames     []string
	MaxRetries          int
	ConcurrentFolders   int
	ConcurrentDownloads int
	OutputDir           string
}

GDriveSource implements DataSource for Google Drive folders.

func (*GDriveSource) Close added in v0.8.0

func (g *GDriveSource) Close()

Close releases resources held by the underlying clients.

func (*GDriveSource) SyncFilesToFilestore added in v0.8.0

func (g *GDriveSource) SyncFilesToFilestore(ctx context.Context, fs *filestore.FileStore) ([]RawFileMetadata, error)

type MarkdownSplitter

type MarkdownSplitter struct {
	LangchainClient *langchain.Client
	Config          *textsplitter.Options
}

func (*MarkdownSplitter) Chunk

func (c *MarkdownSplitter) Chunk(text string) ([]string, error)

type RawFileMetadata

type RawFileMetadata struct {
	FilePath string `json:"filePath,omitempty"`
	UID      string `json:"uid,omitempty"`
}

type RecursiveCharacterSplitter

type RecursiveCharacterSplitter struct {
	LangchainClient *langchain.Client
	Config          *textsplitter.Options
}

func (*RecursiveCharacterSplitter) Chunk

func (c *RecursiveCharacterSplitter) Chunk(text string) ([]string, error)

type S3BucketSource

type S3BucketSource struct {
	S3Client  *s3.Client
	Bucket    string
	Prefix    string
	OutputDir string
}

func (*S3BucketSource) SyncFilesToFilestore

func (s *S3BucketSource) SyncFilesToFilestore(ctx context.Context, fs *filestore.FileStore) ([]RawFileMetadata, error)

type S3Destination added in v0.2.0

type S3Destination struct {
	S3Client  *s3.Client
	Bucket    string
	Prefix    string
	StageName string
}

S3Destination syncs files to an S3 bucket at prefix/stages/<stageName>/.

func (*S3Destination) SyncFilesToDestination added in v0.2.0

func (d *S3Destination) SyncFilesToDestination(ctx context.Context, fs *filestore.FileStore,
	chunksFilePaths []string) error

type TokenSplitter

type TokenSplitter struct {
	LangchainClient *langchain.Client
	Config          *textsplitter.Options
}

func (*TokenSplitter) Chunk

func (c *TokenSplitter) Chunk(text string) ([]string, error)

Jump to

Keyboard shortcuts

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