Tpayne101 commited on
Commit
98323d5
·
verified ·
1 Parent(s): 3450238

Create context_graph.py

Browse files
Files changed (1) hide show
  1. context_graph.py +6 -0
context_graph.py CHANGED
@@ -2,6 +2,11 @@ import json
2
  import os
3
 
4
  class ContextGraph:
 
 
 
 
 
5
  def __init__(self, file_path="context_graph.json"):
6
  self.file_path = file_path
7
  self._init_graph()
@@ -19,6 +24,7 @@ class ContextGraph:
19
  graph["links"][agent_id][key] = value
20
  with open(self.file_path, "w") as f:
21
  json.dump(graph, f, indent=2)
 
22
 
23
  def get_context(self, agent_id):
24
  with open(self.file_path, "r") as f:
 
2
  import os
3
 
4
  class ContextGraph:
5
+ """
6
+ Stores relationships between prompts and responses.
7
+ Think of it as a 'map' of what the agent has learned.
8
+ """
9
+
10
  def __init__(self, file_path="context_graph.json"):
11
  self.file_path = file_path
12
  self._init_graph()
 
24
  graph["links"][agent_id][key] = value
25
  with open(self.file_path, "w") as f:
26
  json.dump(graph, f, indent=2)
27
+ print(f"[ContextGraph] Linked ({key} → {value}) for {agent_id}")
28
 
29
  def get_context(self, agent_id):
30
  with open(self.file_path, "r") as f: