Spaces:
Running
Running
TahaFawzyElshrif commited on
Commit ·
774855e
1
Parent(s): 116d809
fixed comments
Browse files
agent/agent_graph/Graph_Nodes.py
CHANGED
|
@@ -42,15 +42,14 @@ def update_context(state:ProblemState):
|
|
| 42 |
|
| 43 |
for i in list(keys):
|
| 44 |
|
| 45 |
-
#
|
| 46 |
if i in ["question", "answer", "node_output_article", "memory"]:
|
| 47 |
continue
|
| 48 |
|
| 49 |
-
# 2️⃣
|
| 50 |
-
# - question_type
|
| 51 |
-
# -
|
| 52 |
-
# if
|
| 53 |
-
|
| 54 |
if i == "question_type":
|
| 55 |
if "question_type" in state.keys():
|
| 56 |
continue
|
|
@@ -62,7 +61,7 @@ def update_context(state:ProblemState):
|
|
| 62 |
_rag_text_if_exist = rag_text # store text to prevent calling twice
|
| 63 |
continue
|
| 64 |
|
| 65 |
-
# 3️⃣
|
| 66 |
keys_modifiable.append(i)
|
| 67 |
|
| 68 |
# Make the prompt
|
|
|
|
| 42 |
|
| 43 |
for i in list(keys):
|
| 44 |
|
| 45 |
+
# 2️⃣ Prevent modifying question_type after chat starts
|
| 46 |
if i in ["question", "answer", "node_output_article", "memory"]:
|
| 47 |
continue
|
| 48 |
|
| 49 |
+
# 2️⃣ Prevent modifying question_type after chat starts
|
| 50 |
+
# - question_type is only allowed at the very start of the chat
|
| 51 |
+
# - If it already exists in state → chat has started → modification not allowed
|
| 52 |
+
# if question exists in rag data skip it
|
|
|
|
| 53 |
if i == "question_type":
|
| 54 |
if "question_type" in state.keys():
|
| 55 |
continue
|
|
|
|
| 61 |
_rag_text_if_exist = rag_text # store text to prevent calling twice
|
| 62 |
continue
|
| 63 |
|
| 64 |
+
# 3️⃣ Any key that reaches here is allowed to be returned by the LLM
|
| 65 |
keys_modifiable.append(i)
|
| 66 |
|
| 67 |
# Make the prompt
|