Optimize all memories for a given user using the default summarize strategy. This operation combines all memories into a single comprehensive summary, achieving maximum token reduction while preserving all key information. To use a custom model, specify the model parameter in ‘provider:model_id’ format (e.g., ‘openai:gpt-4o-mini’, ‘anthropic:claude-3-5-sonnet-20241022’). If not specified, uses MemoryManager’s default model (gpt-4o). Set apply=false to preview optimization results without saving to database.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Database ID to use for optimization
Table to use for optimization
Schema for memory optimization request
User ID to optimize memories for
Model to use for optimization in format 'provider:model_id' (e.g., 'openai:gpt-4o-mini', 'anthropic:claude-3-5-sonnet-20241022', 'google:gemini-2.0-flash-exp'). If not specified, uses MemoryManager's default model (gpt-4o).
If True, apply optimization changes to database. If False, return preview only without saving.
Memories optimized successfully
Schema for memory optimization response
List of optimized memory objects
Number of memories before optimization
x >= 0Number of memories after optimization
x >= 0Token count before optimization
x >= 0Token count after optimization
x >= 0Number of tokens saved through optimization
x >= 0Percentage of token reduction achieved
0 <= x <= 100