Gaykar commited on
Commit
471c5c3
·
1 Parent(s): 873e08b
app/persistance/memory_store_checkpointer_config.py CHANGED
@@ -3,11 +3,23 @@ from langgraph.checkpoint.postgres import PostgresSaver
3
  from langgraph.store.postgres import PostgresStore
4
  from app.utils.embeddings import remote_embeddings
5
 
 
6
 
7
 
8
-
9
- checkpointer = PostgresSaver(pool)
10
- memory_store = PostgresStore(pool, index={"dims": 384, "embed": remote_embeddings,"fields":["user_email_id","receiver_email_id","summary"]})
 
 
 
 
 
 
 
 
 
 
 
11
 
12
 
13
 
 
3
  from langgraph.store.postgres import PostgresStore
4
  from app.utils.embeddings import remote_embeddings
5
 
6
+ checkpointer = PostgresSaver(pool)
7
 
8
 
9
+ memory_store = PostgresStore(
10
+ pool,
11
+ index={
12
+ "dims": 384,
13
+ "embed": remote_embeddings,
14
+
15
+ # FIX: Point exactly to the nested keys inside the stored JSON structure
16
+ "fields": [
17
+ "content.summary",
18
+ "content.user_email_id",
19
+ "content.receiver_email_id"
20
+ ]
21
+ }
22
+ )
23
 
24
 
25
 
app/tools/context_agent_tools.py CHANGED
@@ -10,10 +10,10 @@ from langgraph.store.base import BaseStore
10
  def search_sender_memory_tool(
11
  query: str,
12
  limit: int = 3,
13
- # 1. Inject the entire Graph state at runtime (Corrected ✅)
14
  state: Annotated[Dict[str, Any], InjectedState] = InjectedState,
15
 
16
- # 2. Inject the compiled graph storage layer (Fixed line below 👇)
17
  store: Annotated[BaseStore, InjectedState("store")] = InjectedState("store")
18
  ) -> str:
19
  """Search long-term memory for specific historical email contexts.
@@ -28,7 +28,7 @@ def search_sender_memory_tool(
28
  return "Error: Cannot isolate history. Active sender_email_id is missing from state context."
29
 
30
  metadata_filter = {
31
- "receiver_email_id": sender_email
32
  }
33
 
34
  results = store.search(
 
10
  def search_sender_memory_tool(
11
  query: str,
12
  limit: int = 3,
13
+ # 1. Inject the entire Graph state at runtime
14
  state: Annotated[Dict[str, Any], InjectedState] = InjectedState,
15
 
16
+ # 2. Inject the compiled graph storage layer
17
  store: Annotated[BaseStore, InjectedState("store")] = InjectedState("store")
18
  ) -> str:
19
  """Search long-term memory for specific historical email contexts.
 
28
  return "Error: Cannot isolate history. Active sender_email_id is missing from state context."
29
 
30
  metadata_filter = {
31
+ "content.receiver_email_id": sender_email
32
  }
33
 
34
  results = store.search(