Documentation
¶
Overview ¶
Package omnimemory provides a mem0 provider for omnimemory.
This package implements the omnimemory Provider interface using the mem0 API as the backend. It maps omnimemory concepts to mem0:
- TenantID → mem0 app_id (or ignored if single-tenant)
- SubjectID → mem0 user_id
- Memory → mem0 MemoryItem
- Memory.AgentID → mem0 agent_id
- Search/Recall → mem0 Search API
Usage ¶
Import this package to register the mem0 provider:
import (
"github.com/plexusone/omnimemory"
"github.com/plexusone/omnimemory/core"
_ "github.com/plexusone/mem0-go/omnimemory" // Register mem0 provider
)
func main() {
client, err := omnimemory.NewClient(core.ClientConfig{
Providers: []core.ProviderConfig{
{
Name: core.ProviderNameMem0,
APIKey: "your-mem0-api-key",
},
},
})
// ...
}
Configuration ¶
The provider accepts the following options:
- api_key: mem0 API key (required, or use MEM0_API_KEY env)
- base_url: Custom base URL (optional, defaults to api.mem0.ai)
Mapping ¶
mem0 uses a flat structure with user_id for isolation:
- user_id: The subject that owns the memories (maps to SubjectID)
- agent_id: The agent that created the memory (maps to AgentID)
- app_id: Application identifier (maps to TenantID)
The SubjectID in omnimemory is mapped to mem0's user_id. The TenantID is mapped to mem0's app_id for multi-tenant isolation.
Index ¶
- func NewProvider(config core.ProviderConfig, embedder core.Embedder) (core.Provider, error)
- type Provider
- func (p *Provider) Add(ctx context.Context, req *core.AddRequest) (*core.Memory, error)
- func (p *Provider) Close() error
- func (p *Provider) Delete(ctx context.Context, req *core.DeleteRequest) error
- func (p *Provider) Get(ctx context.Context, req *core.GetRequest) (*core.Memory, error)
- func (p *Provider) List(ctx context.Context, req *core.ListRequest) (*core.ListResponse, error)
- func (p *Provider) Name() string
- func (p *Provider) Recall(ctx context.Context, req *core.RecallRequest) (*core.RecallResponse, error)
- func (p *Provider) Search(ctx context.Context, req *core.SearchRequest) (*core.SearchResponse, error)
- func (p *Provider) Update(ctx context.Context, req *core.UpdateRequest) (*core.Memory, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProvider ¶
NewProvider creates a new mem0 Provider.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements core.Provider using mem0 API.
func (*Provider) List ¶
func (p *Provider) List(ctx context.Context, req *core.ListRequest) (*core.ListResponse, error)
List lists memories with optional filters.
func (*Provider) Recall ¶
func (p *Provider) Recall(ctx context.Context, req *core.RecallRequest) (*core.RecallResponse, error)
Recall retrieves relevant memories using mem0 Search API.
func (*Provider) Search ¶
func (p *Provider) Search(ctx context.Context, req *core.SearchRequest) (*core.SearchResponse, error)
Search performs semantic search using mem0 Search API.