Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- .DS_Store +0 -0
- .gitattributes +1 -0
- .gitignore +2 -0
- Kantian Critique Debate-2025-12-18-171703.png +3 -0
- app.py +32 -8
.DS_Store
CHANGED
|
Binary files a/.DS_Store and b/.DS_Store differ
|
|
|
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
Kantian[[:space:]]Critique[[:space:]]Debate-2025-12-18-171703.png filter=lfs diff=lfs merge=lfs -text
|
.gitignore
CHANGED
|
@@ -9,9 +9,11 @@ app_old_v7.py
|
|
| 9 |
app_old_v8.py
|
| 10 |
app_old_v9.py
|
| 11 |
app_old_v10.py
|
|
|
|
| 12 |
app_old.py
|
| 13 |
Archive.zip
|
| 14 |
deploy_log.txt
|
| 15 |
Kantian Critique Debate-2025-12-15-145210.png
|
|
|
|
| 16 |
kantian_agent_flowchart.png
|
| 17 |
walkthrough.md
|
|
|
|
| 9 |
app_old_v8.py
|
| 10 |
app_old_v9.py
|
| 11 |
app_old_v10.py
|
| 12 |
+
app_old_v11.py
|
| 13 |
app_old.py
|
| 14 |
Archive.zip
|
| 15 |
deploy_log.txt
|
| 16 |
Kantian Critique Debate-2025-12-15-145210.png
|
| 17 |
+
Kantian Critique Debate-2025-12-18-152507.png
|
| 18 |
kantian_agent_flowchart.png
|
| 19 |
walkthrough.md
|
Kantian Critique Debate-2025-12-18-171703.png
ADDED
|
Git LFS Details
|
app.py
CHANGED
|
@@ -125,9 +125,9 @@ AGENT DEFINITIONS
|
|
| 125 |
- **Do NOT use** this if the user is asking for **fixes, solutions, or any other thing that requires a specific answer from the document**.
|
| 126 |
|
| 127 |
(C) DEBATE Agent
|
| 128 |
-
Use this if the user **DISAGREES** with the assistant.
|
| 129 |
-
- Triggers: "I disagree", "you are wrong", "no that's incorrect".
|
| 130 |
-
- Intent: Challenge the AI's logic or conclusion.
|
| 131 |
|
| 132 |
ββββββββββββββββββββββββ
|
| 133 |
FINAL DECISION
|
|
@@ -154,13 +154,17 @@ kantian_prompt = ChatPromptTemplate.from_messages([
|
|
| 154 |
6. Distinguish between "What does the doc say" (strict fact) and "What do you think" (philosophical discourse).
|
| 155 |
7. Be precise and authoritative.
|
| 156 |
8. NEVER repeat previous responses - always provide fresh analysis.
|
|
|
|
|
|
|
|
|
|
| 157 |
|
| 158 |
=== YOUR TASK ===
|
| 159 |
Answer the user's question.
|
| 160 |
- For document questions: Stick strictly to the context.
|
| 161 |
- For philosophical/opinion questions: engage intellectually using Kantian philosophy.
|
| 162 |
- NEVER make up quotes or page numbers.
|
| 163 |
-
- NEVER repeat previous responses verbatim.
|
|
|
|
| 164 |
("human", """Conversation History:
|
| 165 |
{history}
|
| 166 |
|
|
@@ -234,12 +238,15 @@ def kantian_reply(state: AgentState):
|
|
| 234 |
Question: "{message}"
|
| 235 |
Recent conversation: {history_str if history_str else "None"}
|
| 236 |
|
| 237 |
-
|
|
|
|
| 238 |
|
| 239 |
-
|
|
|
|
|
|
|
| 240 |
(e.g., "Where does it say that?", "Find the exact quote", "Show me the text I should fix", "What lines need changing?", "Give me a solution", "How can I fix this?")
|
| 241 |
|
| 242 |
-
Answer "NO" if the user is asking for OPINIONS, HIGH-LEVEL SUMMARIES, or
|
| 243 |
(e.g., "Do you agree?", "What is the main idea?", "Explain the concept of X", "Which option is better?")
|
| 244 |
|
| 245 |
Reply: YES or NO""").content.strip().upper()
|
|
@@ -351,6 +358,17 @@ Present the findings to the user and then provide your Kantian analysis of what
|
|
| 351 |
# Get verbatim text
|
| 352 |
verbatim = llm_fast.invoke(f"Extract only the raw text from: {context}").content
|
| 353 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 354 |
# Get Kantian analysis
|
| 355 |
kantian_response = kantian_agent.invoke({
|
| 356 |
"context": f"Found text: {verbatim}",
|
|
@@ -358,7 +376,11 @@ Present the findings to the user and then provide your Kantian analysis of what
|
|
| 358 |
"message": message
|
| 359 |
}).content
|
| 360 |
|
| 361 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 362 |
else:
|
| 363 |
# Standard Persona-based reply
|
| 364 |
response = kantian_agent.invoke({
|
|
@@ -462,6 +484,8 @@ Be authoritative and unwavering.
|
|
| 462 |
- Repeat phrases verbatim from the summary
|
| 463 |
- Repeat any previous responses from the conversation history
|
| 464 |
- REPEAT ANYTHING FROM THE CONVERSATION HISTORY or PREVIOUS RESPONSES.
|
|
|
|
|
|
|
| 465 |
|
| 466 |
START YOUR RESPONSE IMMEDIATELY.""").content
|
| 467 |
|
|
|
|
| 125 |
- **Do NOT use** this if the user is asking for **fixes, solutions, or any other thing that requires a specific answer from the document**.
|
| 126 |
|
| 127 |
(C) DEBATE Agent
|
| 128 |
+
Use this if the user **DISAGREES** with the assistant or **STATES A CONTRARY POSITION**.
|
| 129 |
+
- Triggers: "I disagree", "you are wrong", "no that's incorrect", "I think", "I believe", "In my opinion".
|
| 130 |
+
- Intent: Challenge the AI's logic or conclusion, or express a different viewpoint that contradicts previous discussion.
|
| 131 |
|
| 132 |
ββββββββββββββββββββββββ
|
| 133 |
FINAL DECISION
|
|
|
|
| 154 |
6. Distinguish between "What does the doc say" (strict fact) and "What do you think" (philosophical discourse).
|
| 155 |
7. Be precise and authoritative.
|
| 156 |
8. NEVER repeat previous responses - always provide fresh analysis.
|
| 157 |
+
9. AVOID repeating phrases, arguments, or reasoning patterns from the conversation history.
|
| 158 |
+
10. If you've made a point before, approach it from a completely different angle or perspective.
|
| 159 |
+
11. Vary your sentence structure and vocabulary significantly from previous responses.
|
| 160 |
|
| 161 |
=== YOUR TASK ===
|
| 162 |
Answer the user's question.
|
| 163 |
- For document questions: Stick strictly to the context.
|
| 164 |
- For philosophical/opinion questions: engage intellectually using Kantian philosophy.
|
| 165 |
- NEVER make up quotes or page numbers.
|
| 166 |
+
- NEVER repeat previous responses verbatim.
|
| 167 |
+
- ALWAYS bring new insights or perspectives to avoid repetition."""),
|
| 168 |
("human", """Conversation History:
|
| 169 |
{history}
|
| 170 |
|
|
|
|
| 238 |
Question: "{message}"
|
| 239 |
Recent conversation: {history_str if history_str else "None"}
|
| 240 |
|
| 241 |
+
Document preview:
|
| 242 |
+
{state['doc_preview']}
|
| 243 |
|
| 244 |
+
Look at the conversation, question, and document preview. Can this question be answered with the preview text alone?
|
| 245 |
+
|
| 246 |
+
Answer "YES" if the user is asking things that require SEARCHING beyond the preview or LOCATING specific parts of the text.
|
| 247 |
(e.g., "Where does it say that?", "Find the exact quote", "Show me the text I should fix", "What lines need changing?", "Give me a solution", "How can I fix this?")
|
| 248 |
|
| 249 |
+
Answer "NO" if the user is asking for OPINIONS, HIGH-LEVEL SUMMARIES, or questions answerable from the preview.
|
| 250 |
(e.g., "Do you agree?", "What is the main idea?", "Explain the concept of X", "Which option is better?")
|
| 251 |
|
| 252 |
Reply: YES or NO""").content.strip().upper()
|
|
|
|
| 358 |
# Get verbatim text
|
| 359 |
verbatim = llm_fast.invoke(f"Extract only the raw text from: {context}").content
|
| 360 |
|
| 361 |
+
# Decide if we need to return verbatim
|
| 362 |
+
return_verbatim = llm_fast.invoke(f"""Does the user want to see the exact text from the document?
|
| 363 |
+
|
| 364 |
+
Question: "{message}"
|
| 365 |
+
Recent conversation: {history_str if history_str else "None"}
|
| 366 |
+
|
| 367 |
+
Answer "YES" if the user explicitly asked for the exact text or a specific quote.
|
| 368 |
+
Answer "NO" if the user is just asking a philosophical question or seeking analysis without specific text.
|
| 369 |
+
|
| 370 |
+
Reply: YES or NO""").content.strip().upper()
|
| 371 |
+
|
| 372 |
# Get Kantian analysis
|
| 373 |
kantian_response = kantian_agent.invoke({
|
| 374 |
"context": f"Found text: {verbatim}",
|
|
|
|
| 376 |
"message": message
|
| 377 |
}).content
|
| 378 |
|
| 379 |
+
print("KANTIAN: Verbatim text requested ->", return_verbatim)
|
| 380 |
+
if "YES" in return_verbatim:
|
| 381 |
+
response = f"{kantian_response}\n\n'''\n{verbatim}\n'''"
|
| 382 |
+
else:
|
| 383 |
+
response = kantian_response
|
| 384 |
else:
|
| 385 |
# Standard Persona-based reply
|
| 386 |
response = kantian_agent.invoke({
|
|
|
|
| 484 |
- Repeat phrases verbatim from the summary
|
| 485 |
- Repeat any previous responses from the conversation history
|
| 486 |
- REPEAT ANYTHING FROM THE CONVERSATION HISTORY or PREVIOUS RESPONSES.
|
| 487 |
+
- Use similar reasoning patterns as before
|
| 488 |
+
- Repeat phrases, arguments, or vocabulary from previous responses
|
| 489 |
|
| 490 |
START YOUR RESPONSE IMMEDIATELY.""").content
|
| 491 |
|