documenttransformer

package
v0.0.110 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmazonTranslate added in v0.0.100

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

AmazonTranslate is a transformer that uses Amazon Translate to translate text in documents to a target language.

func NewAmazonTranslate added in v0.0.100

func NewAmazonTranslate(client AmazonTranslateClient, targetLanguageCode string, optFns ...func(o *AmazonTranslateOptions)) *AmazonTranslate

NewAmazonTranslate creates a new instance of the AmazonTranslate transformer.

func (*AmazonTranslate) Transform added in v0.0.100

func (t *AmazonTranslate) Transform(ctx context.Context, docs []schema.Document) ([]schema.Document, error)

Transform translates the text in a slice of documents to the target language using Amazon Translate.

type AmazonTranslateClient added in v0.0.100

type AmazonTranslateClient interface {
	TranslateText(ctx context.Context, params *translate.TranslateTextInput, optFns ...func(*translate.Options)) (*translate.TranslateTextOutput, error)
}

AmazonTranslateClient is an interface for the Amazon Translate client.

type AmazonTranslateOptions added in v0.0.100

type AmazonTranslateOptions struct {
	// MaxConcurrency sets the maximum number of concurrent translation requests.
	MaxConcurrency int
	// SourceLanguageCode sets the source language code for translation. Default is "auto".
	SourceLanguageCode string
	// IncludeSourceText indicates whether to include the source text in document metadata.
	IncludeSourceText bool
}

AmazonTranslateOptions contains options for configuring the AmazonTranslate transformer.

type MetaDataTagger

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

MetaDataTagger is a document transformer that adds metadata to documents using a tagging chain.

func NewMetaDataTagger

func NewMetaDataTagger(chatModel schema.ChatModel, tags any, optFns ...func(o *MetaDataTaggerOptions)) (*MetaDataTagger, error)

NewMetaDataTagger creates a new MetaDataTagger instance.

func (*MetaDataTagger) Transform

func (t *MetaDataTagger) Transform(ctx context.Context, docs []schema.Document) ([]schema.Document, error)

Transform transforms a slice of documents by adding metadata using the tagging chain.

type MetaDataTaggerOptions

type MetaDataTaggerOptions struct {
	MaxConcurrency int
}

MetaDataTaggerOptions represents the options for the MetaDataTagger.

Jump to

Keyboard shortcuts

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