weaviate

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package weaviate provides a interfaces.Memory implementation backed by Weaviate.

Expected class schema (vectorizer should target the text field):

{
  "class": "AgentMemory",
  "vectorizer": "text2vec-...",
  "properties": [
    {"name": "text", "dataType": ["text"]},
    {"name": "kind", "dataType": ["text"]},
    {"name": "user_id", "dataType": ["text"]},
    {"name": "tenant_id", "dataType": ["text"]},
    {"name": "agent_id", "dataType": ["text"]},
    {"name": "scope_tags", "dataType": ["text[]"]},
    {"name": "metadata", "dataType": ["text"]},
    {"name": "expires_at", "dataType": ["date"]},
    {"name": "created_at", "dataType": ["date"]},
    {"name": "updated_at", "dataType": ["date"]}
  ]
}

Index

Constants

View Source
const (
	DefaultClassName = "AgentMemory"
	DefaultTextField = "text"

	PropKind      = "kind"
	PropMetadata  = "metadata"
	PropScopeTags = "scope_tags"
	PropExpiresAt = "expires_at"
	PropCreatedAt = "created_at"
	PropUpdatedAt = "updated_at"
	PropUserID    = memory.ScopeKeyUserID
	PropTenantID  = memory.ScopeKeyTenantID
	PropAgentID   = memory.ScopeKeyAgentID
)

Default Weaviate class and property names for Memory.

View Source
const DefaultLoadLimit = 10

DefaultLoadLimit is the maximum memories returned when interfaces.WithLoadLimit is zero or negative.

View Source
const DefaultMinScore float32 = 0.35

DefaultMinScore is the default nearText certainty when interfaces.WithMinScore is zero.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

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

Memory stores and recalls agent memories in a Weaviate class.

func NewMemory

func NewMemory(opts ...Option) (*Memory, error)

NewMemory builds a Weaviate-backed interfaces.Memory. When WithClient is omitted, host is required.

func (*Memory) Clear

func (m *Memory) Clear(ctx context.Context, scope interfaces.MemoryScope) error

Clear removes all memories matching scope.

func (*Memory) Load

Load recalls memories within scope. Non-empty query uses nearText; empty query lists by updated_at.

func (*Memory) Store

Store persists a memory in scope and returns its ID.

type Option

type Option func(*Memory)

Option configures Memory.

func WithClassName

func WithClassName(className string) Option

WithClassName sets the Weaviate class name. Defaults to DefaultClassName.

func WithClient

func WithClient(c *client.Client) Option

WithClient sets the Weaviate client.

func WithDefaultLimit

func WithDefaultLimit(limit int) Option

WithDefaultLimit sets the load limit when callers omit interfaces.WithLoadLimit.

func WithDefaultMinScore

func WithDefaultMinScore(minScore float32) Option

WithDefaultMinScore sets the nearText certainty when callers omit interfaces.WithMinScore.

func WithHost

func WithHost(host string) Option

WithHost sets the Weaviate host (required when WithClient is omitted).

func WithLogLevel

func WithLogLevel(logLevel string) Option

WithLogLevel sets the log level when no logger is provided.

func WithLogger

func WithLogger(l logger.Logger) Option

WithLogger sets the logger.

func WithScheme

func WithScheme(scheme string) Option

WithScheme sets the Weaviate scheme. Defaults to types.DefaultScheme.

func WithTenant

func WithTenant(tenant string) Option

WithTenant sets the Weaviate multi-tenancy tenant for all operations.

func WithTextField

func WithTextField(textField string) Option

WithTextField sets the property used for memory text and vectorization. Defaults to DefaultTextField.

Jump to

Keyboard shortcuts

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