8000 Nathan's branch by CodCodingCode · Pull Request #24 · CodCodingCode/AMIE-app · GitHub
[go: up one dir, main page]

Skip to content

Nathan's branch #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
39b65e7
Fixed diagnostic logic
CodCodingCode Jun 3, 2025
e87067f
added thinking and answer into json outputs
CodCodingCode Jun 7, 2025
3263a55
Update gen_convo.py
CodCodingCode Jun 7, 2025
24c54e5
testing prompt using specific vignette (there is a vignette issue wit…
CodCodingCode Jun 7, 2025
7acd9d2
fixed globalization issue
CodCodingCode Jun 7, 2025
7d12874
fixed defining function because of Extraction error
CodCodingCode Jun 7, 2025
da45f59
started new dataset generation
CodCodingCode Jun 7, 2025
b7d0088
generated new dataset
CodCodingCode Jun 8, 2025
7480df6
added deployment code to finally deploy model to website
CodCodingCode Jun 8, 2025
75e4726
Added print and break statements
CodCodingCode Jun 8, 2025
618a240
set up endpoint for the model - ALSMOT ABLE TO CONNECT TO FRONTEND
CodCodingCode Jun 8, 2025
71237bc
fixed major model thinking issue - tested model once again
CodCodingCode Jun 9, 2025
d1410fd
fixed prompting of the model. added openai caching
CodCodingCode Jun 9, 2025
1b3ada4
fixed prompting so that model would not hallucinate + changed summari…
CodCodingCode Jun 10, 2025
015032a
added new files
CodCodingCode Jun 10, 2025
9f58f7d
generated new interesting dataset
CodCodingCode Jun 11, 2025
9b07483
added reward for hallucination
CodCodingCode Jun 11, 2025
d8414af
Edited hallucination file - added patient training
CodCodingCode Jun 12, 2025
8ac87f5
fixed hallucination code fully.
CodCodingCode Jun 12, 2025
faebffa
created new endpoint to test full loop
CodCodingCode Jun 12, 2025
c2564aa
created code for trainin model to not hallucinate. Added multiple hal…
CodCodingCode Jun 12, 2025
222fa15
got rid of api keys lol
CodCodingCode Jun 12, 2025
2fca862
Changed prompting
CodCodingCode Jun 12, 2025
617ecfc
switched Diagnoer - changed patietn and summarizer logic
CodCodingCode Jun 12, 2025
dea890f
added further prompt enginerring to make model better
CodCodingCode Jun 12, 2025
3d89e46
added an evaluatoin meter than can easily evaluate the quality of the…
CodCodingCode Jun 12, 2025
a427988
debugging codebase for errors. added stirctness to evaluator. Made ev…
CodCodingCode Jun 13, 2025
0dea88b
Fixed file pathing for eval_data
CodCodingCode Jun 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
testing prompt using specific vignette (there is a vignette issue wit…
…hin current code)
  • Loading branch information
CodCodingCode committed Jun 7, 2025
commit 24c54e5d2b78fe0983bca2bb4344e3bd2a723cef
16 changes: 13 additions & 3 deletions new_data_gen/actual_data_gen/gen_convo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import random

# Initialize OpenAI client
client = OpenAI(api_key="api")
client = OpenAI(api_key="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")
model = "gpt-4.1-nano"

treatment_plans = []
Expand Down Expand Up @@ -499,7 +499,7 @@ def generate_unbiased_vignette(

# === Diagnosis Logic with Cleaning ===
def get_diagnosis_response(
turn_count, gold_label, vignette_summary, previous_questions, diagnoser
turn_count, vignette_summary, previous_questions, diagnoser
):
"""Get diagnosis with proper stage-based prompting"""
if turn_count < 6: # First 2 turns (0, 2)
Expand Down Expand Up @@ -682,7 +682,17 @@ def process_vignette(idx, vignette_text, gold_label):
elif "symptom_minimization" in behavior_config.get("modifiers", []):
response_length = "in one to two brief sentences"

prompt = f"""{patient_instructions}
prompt = f"""

Maria Lopez, 12-year-old middle school student. She lives with her parents and two younger siblings in a crowded apartment in an urban neighborhood. She has a history of mild seasonal allergies but no chronic eye issues. She spends a lot of time in school and participating in after-school activities.
**SCENARIO:**
Acute epidemic haemorrhagic conjunctivitis – typical presentation with red, swollen, and painful eyes.
**CHARACTER BACKGROUND:**
Maria is in 7th grade and is generally healthy, aside from occasional allergy symptoms. Her family has been experiencing a recent outbreak of conjunctivitis among her classmates, which is common during the current school term. She recently shared tissues and games with friends who had pink eye. She has no significant prior eye problems or other serious illnesses. She attends school daily and lives in a densely populated urban area where close contact with others is frequent.
**CURRENT MEDICAL SITUATION:**
Maria reports, “My eyes are really red and swollen now, and it hurts when I blink or try to open them in the morning. There’s a lot of thick mucus coming out of my eyes, especially when I wake up. Sometimes I see tiny blood spots under the conjunctiva, and my eyes feel gritty and irritated.” She says her symptoms started about two days ago, initially just redness and mild discomfort, but now her eyes are very red, swollen, and painful. She feels like her eyes are “bursting” and has trouble keeping them open because of the mucus and swelling. She was prompted to come today because she’s worried about her vision and can’t sleep well due to the discomfort. She’s also concerned because her eyes are so red that her classmates noticed, and she’s worried about missing school or spreading it.
**ROLEPLAY INSTRUCTIONS:**
You are a 12-year-old girl experiencing the typical symptoms of acute epidemic haemorrhagic conjunctivitis. Speak naturally, as a school-aged child might, using simple but descriptive language. Express discomfort clearly, emphasizing the redness, swelling, mucus discharge, and pain. Show concern for your eyes and awareness of the contagious nature of your illness but avoid overly technical explanations. Your tone should be somewhat worried but not panicked, reflecting a realistic child’s response. Use behaviors such as blinking frequently, rubbing your eyes gently (but be advised not to actually rub in real life), and expressing frustration or tiredness from the discomfort. Remember, your main goal is to communicate your symptoms and concerns convincingly and naturally.

NEVER hallucinate past medical evaluations, tests, or diagnoses.
Do NOT give clear medical names unless the doctor already told you.
Expand Down
Loading
0