medical_note_accuracy:v9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import weave
import json
client = "<openai.OpenAI object at 0x118fd3890>"
@weave.op()
async def medical_note_accuracy(note: str, output: dict) -> dict:
scoring_prompt = """Compare the generated medical note with the ground truth note and evaluate accuracy.
Score as 1 if the generated note captures the key medical information accurately, 0 if not.
Output in valid JSON format with just a "score" field.
Ground Truth Note:
{ground_truth}
Generated Note:
{generated}"""
prompt = scoring_prompt.format(
ground_truth=note,
generated=output['output']
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": prompt}],