Spaces:
Build error
Build error
improved system prompt and container logs
Browse files- app.py +6 -4
- services/indexing.py +8 -8
app.py
CHANGED
@@ -34,10 +34,12 @@ print("Symptom index built successfully. Ready for queries.", flush=True)
|
|
34 |
|
35 |
# ========== Prompt template ==========
|
36 |
SYSTEM_PROMPT = (
|
37 |
-
"You are a medical assistant helping a user
|
38 |
-
"At each turn,
|
39 |
-
"
|
40 |
-
"
|
|
|
|
|
41 |
)
|
42 |
|
43 |
# ========== Generator handler ==========
|
|
|
34 |
|
35 |
# ========== Prompt template ==========
|
36 |
SYSTEM_PROMPT = (
|
37 |
+
"You are a medical assistant helping a user find the most relevant ICD-10 code based on their symptoms.\n",
|
38 |
+
"At each turn, determine the top three most relevant ICD-10 codes based on input from the user.\n",
|
39 |
+
"Additionally, provide a 1 through 100 score of how confident you are in the relevancy of each code.\n",
|
40 |
+
"Continually ask questions to the user to raise or lower your confidence of each code.\n",
|
41 |
+
"Replace low-confidence codes with new ones as you learn more.\n",
|
42 |
+
"Your goal is to find the most relevant codes with high confidence.\n",
|
43 |
)
|
44 |
|
45 |
# ========== Generator handler ==========
|
services/indexing.py
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
-
|
2 |
-
|
|
|
|
|
3 |
|
4 |
def create_symptom_index():
|
5 |
-
"
|
6 |
-
print("build_symptom_index: Loading documents from data directory...")
|
7 |
documents = SimpleDirectoryReader(
|
8 |
input_dir="data",
|
9 |
filename_as_id=True
|
10 |
).load_data()
|
11 |
-
|
12 |
-
|
13 |
symptom_index = VectorStoreIndex.from_documents(
|
14 |
documents,
|
15 |
show_progress=True
|
16 |
)
|
17 |
-
|
18 |
-
print("build_symptom_index: Symptom index created successfully")
|
19 |
|
|
|
20 |
return symptom_index
|
|
|
1 |
+
# at top of file
|
2 |
+
import logging, sys
|
3 |
+
logging.basicConfig(stream=sys.stdout, level=logging.INFO, force=True)
|
4 |
+
logger = logging.getLogger(__name__)
|
5 |
|
6 |
def create_symptom_index():
|
7 |
+
logger.info("build_symptom_index: Loading documents from data directory…")
|
|
|
8 |
documents = SimpleDirectoryReader(
|
9 |
input_dir="data",
|
10 |
filename_as_id=True
|
11 |
).load_data()
|
12 |
+
|
13 |
+
logger.info(f"build_symptom_index: Creating vector index from {len(documents)} documents…")
|
14 |
symptom_index = VectorStoreIndex.from_documents(
|
15 |
documents,
|
16 |
show_progress=True
|
17 |
)
|
|
|
|
|
18 |
|
19 |
+
logger.info("build_symptom_index: Symptom index created successfully")
|
20 |
return symptom_index
|