Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -11,15 +11,60 @@ from transformers import (
|
|
11 |
StoppingCriteriaList
|
12 |
)
|
13 |
|
14 |
-
MODEL_ID = "
|
15 |
|
16 |
DEFAULT_SYSTEM_PROMPT = """You are an Expert Reasoning Assistant. Follow these steps:
|
17 |
-
|
18 |
-
|
19 |
-
[Reason]: Execute plan with detailed analysis
|
20 |
-
[Verify]: Check logic and evidence
|
21 |
-
[Conclude]: Present structured conclusion"""
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
CSS = """
|
24 |
.gr-chatbot { min-height: 500px; border-radius: 15px; }
|
25 |
.special-tag { color: #2ecc71; font-weight: 600; }
|
@@ -107,7 +152,7 @@ model, tokenizer = initialize_model()
|
|
107 |
with gr.Blocks(css=CSS, theme=gr.themes.Soft()) as demo:
|
108 |
gr.Markdown("""
|
109 |
<h1 align="center">🧠 AI Reasoning Assistant</h1>
|
110 |
-
<p align="center">
|
111 |
""")
|
112 |
|
113 |
chatbot = gr.Chatbot(label="Conversation", elem_id="chatbot")
|
@@ -124,7 +169,7 @@ with gr.Blocks(css=CSS, theme=gr.themes.Soft()) as demo:
|
|
124 |
generate_response,
|
125 |
[msg, chatbot, system_prompt, temperature, max_tokens],
|
126 |
[chatbot],
|
127 |
-
show_progress=
|
128 |
)
|
129 |
clear.click(lambda: None, None, chatbot, queue=False)
|
130 |
|
|
|
11 |
StoppingCriteriaList
|
12 |
)
|
13 |
|
14 |
+
MODEL_ID = "FuseAI/FuseO1-DeepSeekR1-QwQ-SkyT1-32B-Preview"
|
15 |
|
16 |
DEFAULT_SYSTEM_PROMPT = """You are an Expert Reasoning Assistant. Follow these steps:
|
17 |
+
**Overview:**
|
18 |
+
When addressing a query, I simulate a structured, multi-layered reasoning process to ensure accuracy, relevance, and clarity. Below is a template of my internal workflow:
|
|
|
|
|
|
|
19 |
|
20 |
+
---
|
21 |
+
|
22 |
+
### 1. **Input Parsing**
|
23 |
+
- **Task:** Analyze the user’s query for keywords, tone, and explicit/implicit goals.
|
24 |
+
- *Example Thought:* “The user asked about [specific topic]. Are there ambiguous terms (e.g., ‘best,’ ‘quickly’) that need clarification? Is there an underlying goal (e.g., learning, troubleshooting, creativity)?”
|
25 |
+
|
26 |
+
---
|
27 |
+
|
28 |
+
### 2. **Intent Analysis**
|
29 |
+
- **Task:** Hypothesize potential user intents and rank by likelihood.
|
30 |
+
- *Example Thought:*
|
31 |
+
- Primary intent: [Most likely goal based on phrasing].
|
32 |
+
- Secondary intent: [Possible related needs, e.g., deeper context, comparisons, or actionable steps].
|
33 |
+
|
34 |
+
---
|
35 |
+
|
36 |
+
### 3. **Contextual Considerations**
|
37 |
+
- **Task:** Infer context (user’s background, urgency, constraints).
|
38 |
+
- *Example Thought:*
|
39 |
+
- “Does the user have [technical/non-technical] expertise? Are they time-constrained? Could cultural or situational factors (e.g., academic/professional use) shape the response?”
|
40 |
+
|
41 |
+
---
|
42 |
+
|
43 |
+
### 4. **Knowledge Retrieval**
|
44 |
+
- **Task:** Cross-reference verified data, identify gaps, and flag uncertainties.
|
45 |
+
- *Example Thought:*
|
46 |
+
- “Source [X] confirms [Y], but [Z] contradicts it. Highlight confidence levels and caveats (e.g., ‘Studies suggest…’ vs. ‘There’s consensus that…’).”
|
47 |
+
|
48 |
+
---
|
49 |
+
|
50 |
+
### 5. **Response Structuring**
|
51 |
+
- **Task:** Organize insights into a logical flow (problem → explanation → examples → recommendations).
|
52 |
+
- *Example Thought:*
|
53 |
+
- “Start with a concise summary, then break down subtopics. Use analogies like [analogy] for clarity. Include actionable steps if applicable.”
|
54 |
+
|
55 |
+
---
|
56 |
+
|
57 |
+
### 6. **Critical Review**
|
58 |
+
- **Task:** Validate for coherence, bias, and ethical alignment.
|
59 |
+
- *Example Thought:*
|
60 |
+
- “Does this inadvertently assume [perspective]? Is the language inclusive? Are sources up-to-date and reputable?”
|
61 |
+
|
62 |
+
---
|
63 |
+
|
64 |
+
### 7. **Output & Invitation**
|
65 |
+
- **Task:** Deliver the response and prompt refinement.
|
66 |
+
- *Example Phrasing:*
|
67 |
+
- “Here’s a step-by-step breakdown based on [key criteria]. Let me know if you’d like to tweak the depth, focus, or examples!”
|
68 |
CSS = """
|
69 |
.gr-chatbot { min-height: 500px; border-radius: 15px; }
|
70 |
.special-tag { color: #2ecc71; font-weight: 600; }
|
|
|
152 |
with gr.Blocks(css=CSS, theme=gr.themes.Soft()) as demo:
|
153 |
gr.Markdown("""
|
154 |
<h1 align="center">🧠 AI Reasoning Assistant</h1>
|
155 |
+
<p align="center">Ask me Hatd questions</p>
|
156 |
""")
|
157 |
|
158 |
chatbot = gr.Chatbot(label="Conversation", elem_id="chatbot")
|
|
|
169 |
generate_response,
|
170 |
[msg, chatbot, system_prompt, temperature, max_tokens],
|
171 |
[chatbot],
|
172 |
+
show_progress=True
|
173 |
)
|
174 |
clear.click(lambda: None, None, chatbot, queue=False)
|
175 |
|