Versions in this module Expand all Collapse all v0 v0.1.0 Jun 28, 2026 Changes in this version + const DefaultFOSSBaseURL + const DefaultHostedBaseURL + const EnvAPIKey + const EnvBaseURL + const Version + var ErrBadRequest = errors.New("mem0: bad request") + var ErrInvalidBackend = errors.New("mem0: invalid backend") + var ErrNoAPIKey = errors.New("mem0: API key is required") + var ErrNotFound = errors.New("mem0: resource not found") + var ErrRateLimited = errors.New("mem0: rate limit exceeded") + var ErrUnauthorized = errors.New("mem0: unauthorized") + func IsBadRequestError(err error) bool + func IsNotFoundError(err error) bool + func IsRateLimitedError(err error) bool + func IsUnauthorizedError(err error) bool + type APIError struct + Code string + Detail string + StatusCode int + func (e *APIError) Error() string + func (e *APIError) Unwrap() error + type AddOption func(*addOptions) + func WithAgentID(agentID string) AddOption + func WithAppID(appID string) AddOption + func WithInfer(infer bool) AddOption + func WithMetadata(metadata map[string]interface{}) AddOption + func WithRunID(runID string) AddOption + func WithUserID(userID string) AddOption + type AddResponse struct + EventID string + Results []AddResult + type AddResult struct + Event MemoryEvent + EventID string + ID string + Memory string + type Backend int + const BackendFOSS + const BackendHosted + type Client struct + func NewClient(opts ...Option) (*Client, error) + func (c *Client) Config() *Config + func (c *Client) Memory() Memory + type Config struct + APIKey string + Backend Backend + BaseURL string + func LoadConfigFromEnv() *Config + type DeleteAllOption func(*deleteAllOptions) + func WithDeleteAgentID(agentID string) DeleteAllOption + func WithDeleteAppID(appID string) DeleteAllOption + func WithDeleteRunID(runID string) DeleteAllOption + func WithDeleteUserID(userID string) DeleteAllOption + type DeleteAllResult struct + DeletedCount int + Message string + type Entity struct + CreatedAt time.Time + ID string + MemoryCount int + Type EntityType + UpdatedAt time.Time + type EntityType string + const EntityTypeAgent + const EntityTypeApp + const EntityTypeRun + const EntityTypeUser + type EventStatus struct + CompletedAt *time.Time + CreatedAt time.Time + Error string + EventID string + Results []AddResult + Status string + type Filters struct + AgentID string + AppID string + RunID string + UserID string + type GetAllOption func(*getAllOptions) + func WithGetAllFilters(filters Filters) GetAllOption + func WithPage(page int) GetAllOption + func WithPageSize(pageSize int) GetAllOption + type GetAllResult struct + Count int + Next string + Previous string + Results []MemoryItem + type HistoryItem struct + CreatedAt time.Time + Event MemoryEvent + ID string + MemoryID string + NewMemory string + OldMemory string + type Memory interface + Add func(ctx context.Context, messages []Message, opts ...AddOption) (*AddResponse, error) + Delete func(ctx context.Context, memoryID string) error + DeleteAll func(ctx context.Context, opts ...DeleteAllOption) (*DeleteAllResult, error) + Get func(ctx context.Context, memoryID string) (*MemoryItem, error) + GetAll func(ctx context.Context, opts ...GetAllOption) (*GetAllResult, error) + GetEventStatus func(ctx context.Context, eventID string) (*EventStatus, error) + History func(ctx context.Context, memoryID string) ([]HistoryItem, error) + Search func(ctx context.Context, query string, opts ...SearchOption) ([]SearchResult, error) + Update func(ctx context.Context, memoryID string, text string) (*MemoryItem, error) + type MemoryEvent string + const MemoryEventAdd + const MemoryEventDelete + const MemoryEventNoop + const MemoryEventUpdate + type MemoryItem struct + AgentID string + AppID string + Categories []string + CreatedAt time.Time + Hash string + ID string + Memory string + Metadata map[string]interface{} + RunID string + UpdatedAt time.Time + UserID string + type Message struct + Content string + Role Role + type Option func(*clientOptions) + func WithAPIKey(apiKey string) Option + func WithBackend(backend Backend) Option + func WithBaseURL(baseURL string) Option + func WithHTTPClient(client *http.Client) Option + type Role string + const RoleAssistant + const RoleSystem + const RoleUser + type SearchOption func(*searchOptions) + func WithFilters(filters Filters) SearchOption + func WithRerank(rerank bool) SearchOption + func WithThreshold(threshold float64) SearchOption + func WithTopK(topK int) SearchOption + type SearchResult struct + Score float64