pgmemory

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HistoryTableQuery = `` /* 182-byte string literal not displayed */

	HistorySourceIndexQuery = `CREATE INDEX IF NOT EXISTS idx_history_conversation_id ON history(conversation_id)`

	HistoryTimeIndexQuery = `CREATE INDEX IF NOT EXISTS idx_history_created_at ON history(created_at ASC)`

	RetrieveHistory = `SELECT id, message
    FROM history
    WHERE conversation_id = $1
    ORDER BY created_at ASC`

	DeleteHistory = `DELETE FROM history WHERE conversation_id = $1`

	HistoryTrigger = `` /* 182-byte string literal not displayed */

	HistoryTriggerFunctionFormat = `` /* 880-byte string literal not displayed */

)

Variables

View Source
var ErrDBNotInitialized = errors.New("database connection not initialized")

Functions

This section is empty.

Types

type HistoryMemory

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

func NewHistoryMemory

func NewHistoryMemory(ctx context.Context, db *sql.DB) (*HistoryMemory, error)

func (*HistoryMemory) Close

func (m *HistoryMemory) Close() error

func (*HistoryMemory) DeleteHistory

func (m *HistoryMemory) DeleteHistory(ctx context.Context, conversationID string) error

func (*HistoryMemory) Init

func (m *HistoryMemory) Init(ctx context.Context) error

func (*HistoryMemory) RetrieveHistory

func (m *HistoryMemory) RetrieveHistory(ctx context.Context, conversationID string) ([]*ai.Message, error)

func (*HistoryMemory) SetMaxMessagesPerConversation

func (m *HistoryMemory) SetMaxMessagesPerConversation(ctx context.Context, max int) error

func (*HistoryMemory) StoreHistory

func (m *HistoryMemory) StoreHistory(ctx context.Context, conversationID string, history []*ai.Message) error