memory

package
v0.0.0-...-756b1a4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

type Memory struct {
	ConversationHistory []Message `json:"conversation_history"`
	ProviderName        string    `json:"provider_name"`
	Model               string    `json:"model"`
	// contains filtered or unexported fields
}

func NewMemory

func NewMemory(providerName string, model string, memoryFile string) (*Memory, error)

func (*Memory) AddMessage

func (m *Memory) AddMessage(msg Message)

func (*Memory) GetConversationHistory

func (m *Memory) GetConversationHistory() []Message

func (*Memory) GetModel

func (m *Memory) GetModel() string

func (*Memory) GetProviderName

func (m *Memory) GetProviderName() string

func (*Memory) Load

func (m *Memory) Load() error

func (*Memory) Save

func (m *Memory) Save() error

func (*Memory) SetConversationHistory

func (m *Memory) SetConversationHistory(history []Message)

func (*Memory) SetModel

func (m *Memory) SetModel(model string)

func (*Memory) SetProviderName

func (m *Memory) SetProviderName(name string)

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
	Tokens  int    `json:"tokens"`
	Md5     string `json:"md5"`
}

Jump to

Keyboard shortcuts

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