-
-
Notifications
You must be signed in to change notification settings - Fork 8
Test episodic memory #26
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
Test episodic memory #26
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Hey, thanks a lot for your contribution, I'm going to fully review this asap ! Meanwhile, can you make sure all tests correctly pass (such as style, lint, etc.) ? If you don't have it already, you can install pre-commit (we built a hook for it) to help you with these :)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #26 +/- ##
==========================================
- Coverage 86.30% 86.17% -0.14%
==========================================
Files 17 18 +1
Lines 1234 1273 +39
==========================================
+ Hits 1065 1097 +32
- Misses 169 176 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Done. |
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.
Tests are passing and it looks good to me, thanks for your work !
Summary
This PR adds a comprehensive test suite for the EpisodicMemory class. The tests verify that initialization, memory insertion, LLM-based importance grading, and top-K retrieval logic behave as expected. This improves reliability and helps catch regressions as the memory module evolves.
Motive
EpisodicMemory is a core component of Mesa-LLM, enabling agents to store, grade, and retrieve memories using LLM-based scoring.
However, there were no dedicated unit tests ensuring these behaviors work consistently.
Implementation
Correct initialization of capacity, system prompt, and deque structure
Proper storage of observation/planning/action memory entries
Importance grading through llm.generate, parsing JSON, and applying prompts
Sorting logic for retrieving top-K entries using
importance - recency_penalty
Usage Examples
The tests ensure:
Entries are stored in a bounded deque
LLM grading returns correct numeric scores
Top-K retrieval returns the highest-ranked memories by importance and recency
If you're modifying the visualisation, add before/after screenshots. -->