memory

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMemoryTool

func NewMemoryTool(store MemoryStore) (tools.Tool, error)

NewMemoryTool creates a new memory tool with the given memory store.

Types

type InMemoryStore

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

InMemoryStore is an in-memory implementation of MemoryStore.

func NewInMemoryStore

func NewInMemoryStore() *InMemoryStore

NewInMemoryStore creates a new instance of InMemoryStore.

func (*InMemoryStore) AddMemory

func (s *InMemoryStore) AddMemory(ctx context.Context, m *Memory) error

AddMemory adds a new memory to the in-memory store.

func (*InMemoryStore) SearchMemory

func (s *InMemoryStore) SearchMemory(ctx context.Context, query string) ([]*Memory, error)

SearchMemory searches for memories containing the given query string.

type Memory

type Memory struct {
	Content  *blades.Message `json:"content"`
	Metadata map[string]any  `json:"metadata,omitempty"`
}

Memory represents a piece of information stored in the memory system.

type MemoryStore

type MemoryStore interface {
	AddMemory(context.Context, *Memory) error
	SearchMemory(context.Context, string) ([]*Memory, error)
}

MemoryStore defines the interface for storing and retrieving memories.

type Request

type Request struct {
	Query string `json:"query" jsonschema:"The query to search the memory."`
}

Request is the request for the memory tool.

type Response

type Response struct {
	Memories []*Memory `json:"memories" jsonschema:"The memories found for the query."`
}

Response is the response for the memory tool.

Jump to

Keyboard shortcuts

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