memory

package
v2.22.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 5 Imported by: 2 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package memory provides in-memory implementations of persistence repositories.

This package is primarily for testing and SDK use, allowing prompts and tools to be registered programmatically without file system dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PromptRepository

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

PromptRepository stores prompts in memory (for testing/SDK)

func NewPromptRepository

func NewPromptRepository() *PromptRepository

NewPromptRepository creates a new in-memory prompt repository

func (*PromptRepository) ListPrompts

func (r *PromptRepository) ListPrompts() ([]string, error)

ListPrompts returns all available prompt task types

func (*PromptRepository) LoadFragment

func (r *PromptRepository) LoadFragment(name, relativePath, _ string) (*prompt.Fragment, error)

LoadFragment loads a fragment registered under name. The repository holds fragments by name only, so a reference with a path is refused with persistence.ErrFragmentPathUnsupported rather than answered by name: the name alone does not say which file the path meant. A name that is not registered is an error satisfying errors.Is(err, fs.ErrNotExist).

func (*PromptRepository) LoadPrompt

func (r *PromptRepository) LoadPrompt(taskType string) (*prompt.Config, error)

LoadPrompt loads a prompt configuration by task type

func (*PromptRepository) RegisterFragment

func (r *PromptRepository) RegisterFragment(name string, fragment *prompt.Fragment)

RegisterFragment adds a fragment to the in-memory store

func (*PromptRepository) RegisterPrompt

func (r *PromptRepository) RegisterPrompt(taskType string, config *prompt.Config)

RegisterPrompt adds a prompt to the in-memory store

func (*PromptRepository) SavePrompt

func (r *PromptRepository) SavePrompt(config *prompt.Config) error

SavePrompt saves a prompt configuration

type ToolRepository

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

ToolRepository stores tools in memory (for testing/SDK)

func NewToolRepository

func NewToolRepository() *ToolRepository

NewToolRepository creates a new in-memory tool repository

func (*ToolRepository) ListTools

func (r *ToolRepository) ListTools() ([]string, error)

ListTools returns all available tool names

func (*ToolRepository) LoadTool

func (r *ToolRepository) LoadTool(name string) (*tools.ToolDescriptor, error)

LoadTool loads a tool descriptor by name

func (*ToolRepository) RegisterTool

func (r *ToolRepository) RegisterTool(name string, descriptor *tools.ToolDescriptor)

RegisterTool adds a tool to the in-memory store

func (*ToolRepository) SaveTool

func (r *ToolRepository) SaveTool(descriptor *tools.ToolDescriptor) error

SaveTool saves a tool descriptor

Jump to

Keyboard shortcuts

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