chatmessagehistory

package
v0.0.108 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamoDB

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

func NewDynamoDB

func NewDynamoDB(client DynamoDBClient, tableName, sessionID string) *DynamoDB

func (*DynamoDB) AddAIMessage

func (mh *DynamoDB) AddAIMessage(ctx context.Context, text string) error

func (*DynamoDB) AddMessage

func (mh *DynamoDB) AddMessage(ctx context.Context, message schema.ChatMessage) error

func (*DynamoDB) AddUserMessage

func (mh *DynamoDB) AddUserMessage(ctx context.Context, text string) error

func (*DynamoDB) Clear

func (mh *DynamoDB) Clear(ctx context.Context) error

func (*DynamoDB) Messages

func (mh *DynamoDB) Messages(ctx context.Context) (schema.ChatMessages, error)

type DynamoDBClient

type DynamoDBClient interface {
	GetItem(ctx context.Context, params *dynamodb.GetItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.GetItemOutput, error)
	PutItem(ctx context.Context, params *dynamodb.PutItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.PutItemOutput, error)
	DeleteItem(ctx context.Context, params *dynamodb.DeleteItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.DeleteItemOutput, error)
}

type InMemory

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

func NewInMemory

func NewInMemory() *InMemory

func NewInMemoryWithMessages

func NewInMemoryWithMessages(messages schema.ChatMessages) *InMemory

func (*InMemory) AddAIMessage

func (mh *InMemory) AddAIMessage(ctx context.Context, text string) error

func (*InMemory) AddMessage

func (mh *InMemory) AddMessage(ctx context.Context, message schema.ChatMessage) error

func (*InMemory) AddUserMessage

func (mh *InMemory) AddUserMessage(ctx context.Context, text string) error

func (*InMemory) Clear

func (mh *InMemory) Clear(ctx context.Context) error

func (*InMemory) Messages

func (mh *InMemory) Messages(ctx context.Context) (schema.ChatMessages, error)

type Redis

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

func NewRedis

func NewRedis(redisClient RedisClient, sessionID string) *Redis

func (*Redis) AddAIMessage

func (mh *Redis) AddAIMessage(ctx context.Context, text string) error

func (*Redis) AddMessage

func (mh *Redis) AddMessage(ctx context.Context, message schema.ChatMessage) error

func (*Redis) AddUserMessage

func (mh *Redis) AddUserMessage(ctx context.Context, text string) error

func (*Redis) Clear

func (mh *Redis) Clear(ctx context.Context) error

func (*Redis) Messages

func (mh *Redis) Messages(ctx context.Context) (schema.ChatMessages, error)

type RedisClient

type RedisClient interface {
	LRange(ctx context.Context, key string, start, stop int64) *redis.StringSliceCmd
	LPush(ctx context.Context, key string, values ...interface{}) *redis.IntCmd
	Del(ctx context.Context, keys ...string) *redis.IntCmd
	Expire(ctx context.Context, key string, expiration time.Duration) *redis.BoolCmd
}

type RedisOptions

type RedisOptions struct {
	KeyPrefix string
	TTL       *time.Duration
}

Jump to

Keyboard shortcuts

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