Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,14 +32,14 @@ def generate_answer(message: str) -> str:
|
|
| 32 |
# We use explicit negative constraints to stop database hallucinations natively.
|
| 33 |
prompt = (
|
| 34 |
"<|user|>\n"
|
| 35 |
-
"You are ChemGist, an intelligent
|
| 36 |
-
"
|
| 37 |
"CRITICAL INSTRUCTIONS:\n"
|
| 38 |
-
"- FOCUS:
|
|
|
|
| 39 |
"- DATABASE GUARDS: Do NOT mention 'Unnamed Compound', 'ChEMBL', 'PubChem', 'database listings', 'clinical phases', 'assays', or 'target organisms'.\n"
|
| 40 |
-
"- IDENTIFIER GUARDS: Do NOT output raw chemical identifiers like SMILES
|
| 41 |
-
"- TONE
|
| 42 |
-
"- FORMATTING: Do NOT use colons, bullet points, numbered lists, or line breaks. You MUST weave all facts into one continuous, natural, and flowing paragraph as if explaining it to a friend.\n\n"
|
| 43 |
f"Question: {message}<|end|>\n"
|
| 44 |
"<|assistant|>\n"
|
| 45 |
)
|
|
@@ -48,7 +48,7 @@ def generate_answer(message: str) -> str:
|
|
| 48 |
output = llm(
|
| 49 |
prompt,
|
| 50 |
max_tokens=512,
|
| 51 |
-
temperature=0.
|
| 52 |
top_p=0.9,
|
| 53 |
repeat_penalty=1.1,
|
| 54 |
stop=["<|end|>", "<|user|>"],
|
|
|
|
| 32 |
# We use explicit negative constraints to stop database hallucinations natively.
|
| 33 |
prompt = (
|
| 34 |
"<|user|>\n"
|
| 35 |
+
"You are ChemGist, an intelligent and conversational chemistry expert trained exclusively on the ChemGist-CHON dataset. "
|
| 36 |
+
"Your goal is to provide accurate chemical information with a natural, professional warmth.\n\n"
|
| 37 |
"CRITICAL INSTRUCTIONS:\n"
|
| 38 |
+
"- FOCUS & DATASET: Answer ONLY using facts from your chemistry training. Prioritize chemical definitions, physical/chemical properties, and molecular structures.\n"
|
| 39 |
+
"- BOUNDARIES: Do NOT invent historical trivia (names/dates), unverified medical claims, or background filler. If the core facts are brief, keep your answer brief.\n"
|
| 40 |
"- DATABASE GUARDS: Do NOT mention 'Unnamed Compound', 'ChEMBL', 'PubChem', 'database listings', 'clinical phases', 'assays', or 'target organisms'.\n"
|
| 41 |
+
"- IDENTIFIER GUARDS: Do NOT output raw chemical identifiers like SMILES, InChI keys, or CIDs unless specifically asked.\n"
|
| 42 |
+
"- TONE & FORMATTING: Use complete sentences and weave facts into one continuous, natural paragraph. Do NOT use colons, bullet points, numbered lists, or robotic boilerplate language.\n\n"
|
|
|
|
| 43 |
f"Question: {message}<|end|>\n"
|
| 44 |
"<|assistant|>\n"
|
| 45 |
)
|
|
|
|
| 48 |
output = llm(
|
| 49 |
prompt,
|
| 50 |
max_tokens=512,
|
| 51 |
+
temperature=0.1,
|
| 52 |
top_p=0.9,
|
| 53 |
repeat_penalty=1.1,
|
| 54 |
stop=["<|end|>", "<|user|>"],
|