Documentation
¶
Index ¶
Constants ¶
const MemorySystemPrefix = "[mem0-memory-context]"
Variables ¶
This section is empty.
Functions ¶
func FormatMemoryContext ¶
func FormatMemoryContext(items []SearchItem, limit int) string
FormatMemoryContext turns search results into a system message payload.
Types ¶
type AddRequest ¶
type AddRequest struct {
Messages []ClientMessage
UserID string
RunID string
AgentID string
AppID string
OrgID string
ProjectID string
Metadata map[string]any
}
AddRequest is the normalized input for storing one memory turn.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a small HTTP client for mem0-compatible APIs.
func NewClient ¶
func NewClient(config *ProviderConfig) *Client
NewClient creates a client from a normalized provider config.
func (*Client) Add ¶
func (c *Client) Add(ctx context.Context, req AddRequest) error
Add stores one memory turn in the configured backend.
func (*Client) Search ¶
func (c *Client) Search(ctx context.Context, req SearchRequest) ([]SearchItem, error)
Search retrieves relevant memories from the configured backend.
type ClientMessage ¶
ClientMessage is the message format accepted by mem0-compatible APIs.
type Mode ¶
type Mode string
Mode identifies which mem0-compatible API surface the provider should target.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements memory.MemoryProvider backed by a mem0-compatible API.
func NewProvider ¶
func NewProvider(config *ProviderConfig) (*Provider, error)
NewProvider creates a mem0 provider with normalized config defaults.
func (*Provider) Retrieve ¶
func (p *Provider) Retrieve(ctx context.Context, req *memory.RetrieveRequest) (*memory.RetrieveResult, error)
Retrieve fetches relevant mem0 context before a model call.
type ProviderConfig ¶
type ProviderConfig struct {
BaseURL string
Mode Mode
APIKey string
AuthHeader string
AuthScheme string
AddPath string
SearchPath string
Version string
HTTPClient *http.Client
Timeout time.Duration
SearchMsgLimit int
SearchResultLimit int
OutputMemoryLimit int
QueryCharLimit int
UseSessionAsRunID bool
SearchBySession bool
SessionMetadataKey string
AgentID string
AppID string
OrgID string
ProjectID string
ExtraHeaders map[string]string
Metadata map[string]any
}
ProviderConfig configures the mem0 provider and client behavior.