100+ AI Agents, Agent Skills and RAG Apps - Free and Open Source.
Store only the candidate's message in Mem0, not the coach's reply
ManpreetLikhariShorthillsAI56fb5ea9c35a
diff --git a/advanced_llm_apps/llm_apps_with_memory_tutorials/adk_career_coach_agent_memory/adk_career_coach_agent_memory.py b/advanced_llm_apps/llm_apps_with_memory_tutorials/adk_career_coach_agent_memory/adk_career_coach_agent_memory.pyindex 76f1d027..3035d166 100644--- a/advanced_llm_apps/llm_apps_with_memory_tutorials/adk_career_coach_agent_memory/adk_career_coach_agent_memory.py+++ b/advanced_llm_apps/llm_apps_with_memory_tutorials/adk_career_coach_agent_memory/adk_career_coach_agent_memory.py@@ -300,8 +300,12 @@ if google_api_key:st.session_state.messages.append({"role": "assistant", "content": answer})# Write this exchange back to long-term memory for future sessions.+ # Only the candidate's own message goes in: one memory.add() call+ # instead of two (half the extraction latency/cost, since infer=True+ # runs an LLM call per add()), and the fact store stays candidate+ # facts only -- the coach's own advice text never gets treated as a+ # fact about the candidate.memory.add(prompt, user_id=user_id, metadata={"role": "user"})- memory.add(answer, user_id=user_id, metadata={"role": "assistant"})elif not user_id:st.error("Please enter your email to start chatting.")else:diff --git a/advanced_llm_apps/llm_apps_with_memory_tutorials/adk_career_coach_agent_memory/idea.md b/advanced_llm_apps/llm_apps_with_memory_tutorials/adk_career_coach_agent_memory/idea.mdindex 970c3466..79b49cdb 100644--- a/advanced_llm_apps/llm_apps_with_memory_tutorials/adk_career_coach_agent_memory/idea.md+++ b/advanced_llm_apps/llm_apps_with_memory_tutorials/adk_career_coach_agent_memory/idea.md@@ -127,8 +127,11 @@ Step by step, in plain terms:tool to look something up (a sample interview question, a salarybenchmark, etc.) before answering.5. The specialist's answer comes back through the orchestrator to the app.-6. The app saves both your message and the answer into Mem0, so this- exchange is available to recall in future conversations.+6. The app saves your message into Mem0 -- just your side of the exchange,+ not the coach's reply. The long-term store is meant to hold facts about+ you (the candidate), not the advice the coach gave, so only your message+ goes in. This also means only one Mem0 write per turn instead of two,+ which matters because each write triggers its own LLM call internally.7. The answer is shown to you in the chat window.## Two very different kinds of "remembering"