Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d9d412d
delete ruff_cache. Added to the gitignore
Ar-temis Mar 12, 2026
7337c3d
Adding mem0 to the project toml, added the mem0 collection name to co…
Ar-temis Mar 12, 2026
4048235
Adding the long term user memory tool
Ar-temis Mar 12, 2026
1249b71
Deleted unused dspy modules
Ar-temis Mar 12, 2026
e91e03e
renamed conversation_memory.py to memory.py. added permanent memory to
Ar-temis Mar 12, 2026
73c6552
Solving circulat import problem in planner
Ar-temis Mar 12, 2026
53c4a04
idk what's going on
Ar-temis Mar 12, 2026
62c879b
Refactor database configuration variable names for consistency, confi…
kkwan0 Mar 16, 2026
92e4e10
Added new Phoenix project for #172
kkwan0 Mar 16, 2026
3ceaaa7
Added debug for memory_tool, but main issue is that it's timing out w…
kkwan0 Mar 16, 2026
f63249d
Revert "idk what's going on"
kkwan0 Mar 16, 2026
79c7f20
I accidentally reverted a commit instead of reverting to it
kkwan0 Mar 16, 2026
ad4bc49
Fixed store_memory error on my side
kkwan0 Mar 16, 2026
07ddfcb
Trying to update the mem0 prompt. by adding the specific tools that i…
kkwan0 Mar 17, 2026
64b0bde
Conversation is properly recorded instead of gen.
Ar-temis Mar 17, 2026
a59da31
Permanent memory agent properly receives all the stored memories.
Ar-temis Mar 17, 2026
e0b02e3
Fixing opentelemetry recording in memory.py
Ar-temis Mar 17, 2026
f8eda3a
returns memory_id now
kkwan0 Mar 17, 2026
a404c6c
Merge remote-tracking branch 'refs/remotes/origin/172-long-term-memor…
kkwan0 Mar 17, 2026
eaa8efc
merged commits?
kkwan0 Mar 17, 2026
ed8e0cb
removed debug lines
kkwan0 Mar 17, 2026
c5db21f
used idx -> memory_id mapping
kkwan0 Mar 17, 2026
0a867f9
Agent can now store metadata(I need to refine what it stores). Also f…
kkwan0 Mar 18, 2026
85b8b94
Stores metadata in the memory, as well as returns it when searching
kkwan0 Mar 18, 2026
3e67b4a
Basic metadata filtering implemented. Works on searches
kkwan0 Mar 19, 2026
2a2e2ff
Add custom fact extraction prompt and added start to cleaning memory …
kkwan0 Mar 19, 2026
6b89a1f
When searching memories it includes access count as well as time last…
kkwan0 Mar 23, 2026
8ffb48a
I need to test but I believe that there is periodic memory cleanup
kkwan0 Mar 23, 2026
36e4bd3
Verified that fact extraction is working, as well as implemented a la…
kkwan0 Mar 24, 2026
0a40b79
Refined memory cleanup by seperating memories into short and long ter…
kkwan0 Mar 25, 2026
140334b
Merge branch 'main' into 172-long-term-memory-per-user
Ar-temis Mar 27, 2026
28525c3
Reverted phoenix project name
kkwan0 Mar 27, 2026
292597a
Black reformatting for linter
kkwan0 Mar 27, 2026
567ee3c
Revert "Black reformatting for linter"
kkwan0 Mar 27, 2026
839db49
Only formatted those two files
kkwan0 Mar 27, 2026
5ca48dc
Fixed linter format issues
kkwan0 Mar 27, 2026
cc0400d
final black format i hope
kkwan0 Mar 27, 2026
b229a89
made docstring shorter
kkwan0 Mar 27, 2026
5d3960e
Merge branch 'main' into 172-long-term-memory-per-user
kkwan0 Mar 30, 2026
ba4c5b6
Should pass lint. I merged cuz it had a merge conflict with main
kkwan0 Mar 30, 2026
4cd786c
I hate this thing
kkwan0 Mar 30, 2026
87e45d6
FastAPI endpoints, need to work out some structural things that might…
kkwan0 Apr 13, 2026
e829e1f
Potential fix for pull request finding 'Unused import'
Ar-temis Apr 13, 2026
689d355
coderabbit proposed changes(modified prompt, datetime, as well as oth…
kkwan0 Apr 14, 2026
60c5c38
Merge branch '172-long-term-memory-per-user' of github.com:Edge-Intel…
kkwan0 Apr 14, 2026
5ebaae5
Revert "FastAPI endpoints, need to work out some structural things th…
kkwan0 Apr 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

.harper-dictionary.txt
.ruff_cache

.idea/
.vscode/
Expand Down
4 changes: 3 additions & 1 deletion chatdku/chatdku/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ def _initialize_defaults(self):
"backup_llm": "Qwen/Qwen3-30B-A3B-Instruct-2507",
"backup_llm_url": "http://localhost:18085/v1",
"llm_temperature": 0.7,
"context_window": 32000,
"context_window": 20000,
"output_window": 10000,
"response_type": "Multiple Paragraphs",
# Embedding
"embedding": "BAAI/bge-m3",
Expand Down Expand Up @@ -101,6 +102,7 @@ def _initialize_defaults(self):
"pg_ingest_uri": pg_ingest_uri,
"postgres_maxconn": 20,
# MISC
"memory_collection": "user_memory", # Memory collection name
"docstore_path": "/datapool/docstores/bge_m3_docstore",
"graph_data_dir": "/home/Glitterccc/projects/DKU_LLM/GraphDKU/output/20240715-182239/artifacts",
"graph_root_dir": "/home/Glitterccc/projects/DKU_LLM/GraphDKU",
Expand Down
41 changes: 24 additions & 17 deletions chatdku/chatdku/core/agent.py
Comment thread
Ar-temis marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
from opentelemetry.trace import Status, StatusCode, use_span

from chatdku.config import config
from chatdku.core.dspy_classes.conversation_memory import ConversationMemory
from chatdku.core.dspy_classes.memory import ConversationMemory, PermanentMemory
from chatdku.core.dspy_classes.plan import Planner, format_trajectory
from chatdku.core.dspy_classes.synthesizer import Synthesizer

# from chatdku.core.tools.llama_index import KeywordRetrieverOuter, VectorRetrieverOuter
# from chatdku.core.tools.llama_index import KeywordRetrieverOuter, VectorRetrieverOuter # Import unused
from chatdku.core.tools.memory_tool import MemoryTools

from chatdku.core.tools.llama_index_pg import DocRetrieverOuter
from chatdku.core.tools.syllabi_tool.query_curriculum_db import QueryCurriculumOuter
from chatdku.core.utils import load_conversation, span_start
Expand Down Expand Up @@ -126,7 +128,8 @@ def _forward_gen(

plan = self.planner(
current_user_message=current_user_message,
conversation_memory=self.conversation_memory,
conversation_history=self.conversation_memory.history_str(),
conversation_summary=self.conversation_memory.summary,
)
synthesizer_args = dict(
current_user_message=current_user_message,
Expand Down Expand Up @@ -180,7 +183,7 @@ def main():
api_base=config.backup_llm_url,
api_key=config.llm_api_key,
model_type="chat",
max_tokens=config.context_window,
max_tokens=config.output_window,
temperature=config.llm_temperature,
)
dspy.configure(lm=lm)
Expand All @@ -197,6 +200,7 @@ def main():
access_type = "student" # hard code it for now, need parameter pass from user role
user_id = "Chat_DKU"
search_mode = 0
memory = MemoryTools(user_id)
tools = [
DocRetrieverOuter(
retriever_top_k=25,
Expand All @@ -209,6 +213,8 @@ def main():
files=[],
),
QueryCurriculumOuter(),
memory.search_memories,
memory.get_all_memories,
]

agent = Agent(
Expand All @@ -218,35 +224,36 @@ def main():
tools=tools,
)

permanent_memory = PermanentMemory(user_id=user_id)
conversations = []
while True:
try:
print("*" * 10)
current_user_message = input("Enter your query about DKU: ")
start_time = time.time()
responses_gen = agent(
current_user_message=current_user_message,
)
).response
first_token = True
print("Response:")
for r in responses_gen.response:
for r in responses_gen:
if first_token:
end_time = time.time()
print(f"first token时间:{end_time - start_time}")
first_token = False
print(r, end="")
print()

# for i, r in enumerate(responses_gen):
# print("-" * 10)
# print(f"Round {i} response:")
# for r in r.response:
# if first_token:
# end_time = time.time()
# print(f"first token时间:{end_time-start_time}")
# first_token = False
# print(r, end="")
# print()
# print("-" * 10)
recent_conversation = [
{"role": "user", "content": current_user_message},
{"role": "assistant", "content": responses_gen.get_full_response()},
]
permanent_memory(
session_conversation=conversations,
most_recent_conversation=recent_conversation,
)
conversations.append(recent_conversation)
Comment thread
Ar-temis marked this conversation as resolved.
Comment thread
kkwan0 marked this conversation as resolved.

except EOFError:
break

Expand Down
131 changes: 0 additions & 131 deletions chatdku/chatdku/core/dspy_classes/conversation_memory.py

This file was deleted.

134 changes: 0 additions & 134 deletions chatdku/chatdku/core/dspy_classes/judge.py

This file was deleted.

Loading
Loading