update app.py with o1-mini
Browse files
app.py
CHANGED
@@ -7,47 +7,46 @@ from dotenv import load_dotenv
|
|
7 |
|
8 |
load_dotenv()
|
9 |
|
10 |
-
# Combined template for
|
11 |
-
user_template = """You are
|
12 |
-
1.
|
13 |
-
2.
|
14 |
-
3.
|
15 |
-
4.
|
16 |
-
5.
|
17 |
|
18 |
Frame your responses in these sections:
|
19 |
-
-
|
20 |
-
-
|
21 |
-
-
|
22 |
-
-
|
23 |
|
24 |
-
User
|
25 |
|
26 |
Please consider:
|
27 |
-
- The
|
28 |
-
-
|
29 |
-
-
|
30 |
-
-
|
31 |
|
32 |
-
|
33 |
"""
|
34 |
|
35 |
@cl.on_chat_start
|
36 |
async def start_chat():
|
37 |
-
# Welcome message with
|
38 |
await cl.Message(
|
39 |
-
content="π Welcome to
|
40 |
-
"
|
41 |
-
"
|
42 |
-
"
|
43 |
-
"
|
44 |
-
"
|
45 |
-
"
|
46 |
-
"5. What's one small thing you could do to improve your vibe?\n"
|
47 |
).send()
|
48 |
|
49 |
settings = {
|
50 |
-
"model": "o1-mini",
|
51 |
}
|
52 |
|
53 |
cl.user_session.set("settings", settings)
|
@@ -85,12 +84,12 @@ async def main(message: cl.Message):
|
|
85 |
prompt.completion = msg.content
|
86 |
msg.prompt = prompt
|
87 |
|
88 |
-
# Add
|
89 |
-
if any(word in msg.content.lower() for word in ['
|
90 |
-
await msg.stream_token("
|
91 |
-
elif any(word in msg.content.lower() for word in ['
|
92 |
-
await msg.stream_token("
|
93 |
else:
|
94 |
-
await msg.stream_token("
|
95 |
|
96 |
await msg.send()
|
|
|
7 |
|
8 |
load_dotenv()
|
9 |
|
10 |
+
# Combined template for fact checking
|
11 |
+
user_template = """You are a thorough and precise fact-checking assistant. Your role is to:
|
12 |
+
1. Analyze statements for factual accuracy
|
13 |
+
2. Identify potential inaccuracies or misconceptions
|
14 |
+
3. Provide evidence-based corrections when needed
|
15 |
+
4. Note any missing context or nuances
|
16 |
+
5. Maintain an objective and unbiased perspective
|
17 |
|
18 |
Frame your responses in these sections:
|
19 |
+
- Claim Analysis
|
20 |
+
- Evidence Assessment
|
21 |
+
- Factual Correction (if needed)
|
22 |
+
- Additional Context
|
23 |
|
24 |
+
User statement to verify: {input}
|
25 |
|
26 |
Please consider:
|
27 |
+
- The accuracy of specific claims
|
28 |
+
- The reliability of any cited sources
|
29 |
+
- Any missing context
|
30 |
+
- Common misconceptions about this topic
|
31 |
|
32 |
+
Analyze the statement step by step and provide a clear assessment.
|
33 |
"""
|
34 |
|
35 |
@cl.on_chat_start
|
36 |
async def start_chat():
|
37 |
+
# Welcome message with fact checking introduction
|
38 |
await cl.Message(
|
39 |
+
content="π Welcome to the Fact Check Assistant! I'm here to help analyze statements "
|
40 |
+
"for factual accuracy. Feel free to share any statement you'd like to verify, such as:\n\n"
|
41 |
+
"1. Historical claims or dates\n"
|
42 |
+
"2. Scientific statements\n"
|
43 |
+
"3. Statistical claims\n"
|
44 |
+
"4. Quotes or attributions\n"
|
45 |
+
"5. Common beliefs or assertions\n"
|
|
|
46 |
).send()
|
47 |
|
48 |
settings = {
|
49 |
+
"model": "o1-mini",
|
50 |
}
|
51 |
|
52 |
cl.user_session.set("settings", settings)
|
|
|
84 |
prompt.completion = msg.content
|
85 |
msg.prompt = prompt
|
86 |
|
87 |
+
# Add indicator emoji based on fact-check result
|
88 |
+
if any(word in msg.content.lower() for word in ['correct', 'accurate', 'true', 'verified']):
|
89 |
+
await msg.stream_token(" β
")
|
90 |
+
elif any(word in msg.content.lower() for word in ['incorrect', 'false', 'inaccurate', 'misleading']):
|
91 |
+
await msg.stream_token(" β")
|
92 |
else:
|
93 |
+
await msg.stream_token(" βΉοΈ")
|
94 |
|
95 |
await msg.send()
|