r/learnpython • u/Friendly_Rope_5688 • Oct 16 '26
How should I separate LLM interpretation from memory operations in my Python project?
I've been working on a small Python project that uses an LLM to interpret natural language instructions and manage persistent memories. Right now, it supports remembering, retrieving, updating and forgetting information.
I've been trying to improve the separation between model interpretation and memory operations. I'm still new to Python but I'm interested how I could structure the code better. Feedbacks are appreciated and any flaws I might be overlooking.
GitHub repo: https://github.com/Lionshaft-pixel/ennoic
8
Upvotes
View all comments
2
u/sugarw0000kie Oct 16 '26
Already good advice from randomman, I’ll throw in that it could be a bit cleaner/easier to manage if you don’t have your prompts inline. Since it’s a very long promp that looks like it’s a f-string with a couple vars at the end you could have that as a separate .txt or md file and have the script read it and add in the {memories}/{message}.
Doesn’t hurt having it in there but if you were to have multiple prompts it’s pulling from it can be convenient to handle it that way