-
Notifications
You must be signed in to change notification settings - Fork 52
feat: Add Memory Import/Export Functionality (JSON/CSV) #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
There are merge conflicts in this pull request. Please resolve them before we can proceed with the review. |
|
Hi @Teingi, I have resolved the merge conflicts by merging the latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is recommended to remove it from the formal PR.
- Keep PR oceanbase#213 import/export features - Keep upstream/main set_timezone import Conflict resolved in src/powermem/core/memory.py
|
Hi @Teingi! I've resolved the merge conflicts with the latest upstream/main branch. Conflict resolved:
Please re-trigger CI to verify. Thanks! |
Were the changes not committed? |
|
|
||
| self.agent_id = agent_id | ||
|
|
||
| # Set timezone from config if provided (priority: config > env) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've modified some code that isn't related to this feature.
| # Merge custom_importance_evaluation_prompt from top level if present | ||
| if self.memory_config.custom_importance_evaluation_prompt: | ||
| cfg["custom_importance_evaluation_prompt"] = self.memory_config.custom_importance_evaluation_prompt | ||
| # Merge memory_decay config if present (for Ebbinghaus algorithm parameters) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM on the main logic, but these extra changes might belong elsewhere.
| - "relations" (List, optional): Graph relations if graph store is enabled | ||
| """ | ||
| try: | ||
| if not query or not query.strip(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above.
| filters=filters, | ||
| limit=limit, | ||
| query=query, # Pass query text for hybrid search (vector + full-text + sparse vector) | ||
| threshold=threshold, # Pass threshold to storage for native hybrid search condition check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above.
| for mem_id, upd in updates: | ||
| _BACKGROUND_EXECUTOR.submit(self.storage.update_memory,mem_id,{**upd},user_id,agent_id) | ||
| logger.info(f"Submitted {len(updates)} update operations to background executor") | ||
| if deletes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above.
| for mem_id, upd in updates: | ||
| try: | ||
| self.storage.update_memory(mem_id, {**upd}, user_id, agent_id) | ||
| except Exception: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above.
| strategy: "deduplicate" or "compress" | ||
| **kwargs: Additional args like threshold, user_id, dedup_strategy | ||
|
|
||
| Returns: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above.
|
Replaced with clean PR to fix unrelated code changes |


This PR adds full support for importing and exporting memories, addressing Issue #137.
This contribution is part of the OceanBase AI Coding Event.
🚀 Features
GET /v1/memories/exportandPOST /v1/memories/import.🛠 Implementation
src/powermem/utils/io.pyfor robust serialization logic.Memoryclass withexport_memoriesandimport_memoriesmethods.✅ AI Contribution Details