extractors

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const SummaryMaxOutputTokens = 512

Variables

This section is empty.

Functions

func Initialize

func Initialize(appState *models.AppState)

Types

type BaseExtractor

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

BaseExtractor is the base implementation of an Extractor

type EmbeddingExtractor

type EmbeddingExtractor struct {
	BaseExtractor
}

func NewEmbeddingExtractor

func NewEmbeddingExtractor() *EmbeddingExtractor

func (*EmbeddingExtractor) Extract

func (ee *EmbeddingExtractor) Extract(
	ctx context.Context,
	appState *models.AppState,
	messageEvent *models.MessageEvent,
) error

func (*EmbeddingExtractor) Notify

func (ee *EmbeddingExtractor) Notify(
	ctx context.Context,
	appState *models.AppState,
	messageEvents *models.MessageEvent,
) error

type EntityExtractor added in v0.5.0

type EntityExtractor struct {
	BaseExtractor
}

func NewEntityExtractor added in v0.5.0

func NewEntityExtractor() *EntityExtractor

func (*EntityExtractor) Extract added in v0.5.0

func (ee *EntityExtractor) Extract(
	ctx context.Context,
	appState *models.AppState,
	messageEvent *models.MessageEvent,
) error

func (*EntityExtractor) Notify added in v0.5.0

func (ee *EntityExtractor) Notify(
	ctx context.Context,
	appState *models.AppState,
	messageEvents *models.MessageEvent,
) error

type EntityExtractorPromptTemplateData

type EntityExtractorPromptTemplateData struct {
	History string
	Entity  string
	Summary string
	Input   string
}

type ExtractorError

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

func NewExtractorError

func NewExtractorError(message string, originalError error) *ExtractorError

func (*ExtractorError) Error

func (e *ExtractorError) Error() string

type IntentExtractor added in v0.7.0

type IntentExtractor struct {
	BaseExtractor
}

func NewIntentExtractor added in v0.7.0

func NewIntentExtractor() *IntentExtractor

func (*IntentExtractor) Extract added in v0.7.0

func (ee *IntentExtractor) Extract(
	ctx context.Context,
	appState *models.AppState,
	messageEvent *models.MessageEvent,
) error

func (*IntentExtractor) Notify added in v0.7.0

func (ee *IntentExtractor) Notify(
	ctx context.Context,
	appState *models.AppState,
	messageEvent *models.MessageEvent,
) error

type IntentPromptTemplateData added in v0.7.0

type IntentPromptTemplateData struct {
	Input string
}

type SummaryExtractor

type SummaryExtractor struct {
	BaseExtractor
}

func NewSummaryExtractor

func NewSummaryExtractor() *SummaryExtractor

func (*SummaryExtractor) Extract

func (se *SummaryExtractor) Extract(
	ctx context.Context,
	appState *models.AppState,
	messageEvent *models.MessageEvent,
) error

Extract gets a list of messages created since the last SummaryPoint, determines if the message count exceeds the configured message window, and if so: - determines the new SummaryPoint index, which will one message older than message_window / 2 - summarizes the messages from this new SummaryPoint to the oldest message not yet Summarized.

When summarizing, it adds context from these messages to an existing summary if there is one.

func (*SummaryExtractor) Notify

func (se *SummaryExtractor) Notify(
	ctx context.Context,
	appState *models.AppState,
	messageEvents *models.MessageEvent,
) error

type SummaryPromptTemplateData

type SummaryPromptTemplateData struct {
	PrevSummary    string
	MessagesJoined string
}

type TokenCountExtractor

type TokenCountExtractor struct {
	BaseExtractor
}

func NewTokenCountExtractor

func NewTokenCountExtractor() *TokenCountExtractor

func (*TokenCountExtractor) Extract

func (ee *TokenCountExtractor) Extract(
	ctx context.Context,
	appState *models.AppState,
	messageEvents *models.MessageEvent,
) error

func (*TokenCountExtractor) Notify

func (ee *TokenCountExtractor) Notify(
	ctx context.Context,
	appState *models.AppState,
	messageEvents *models.MessageEvent,
) error

Jump to

Keyboard shortcuts

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