-
-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
83 additions
and
25 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
tutorials/llm_clinical_trials/configs/fewshot_drugs_dose.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
[ | ||
{ | ||
"text": "The patient was given 1mg of paracetamol.", | ||
"spans": [ | ||
{ | ||
"text": "paracetamol", | ||
"is_entity": true, | ||
"label": "Drug", | ||
"reason": "is a drug name, used as medication" | ||
}, | ||
{ | ||
"text": "1mg", | ||
"is_entity": true, | ||
"label": "Dose", | ||
"reason": "is the quantity or dose of the given medication" | ||
}, | ||
{ | ||
"text": "patient", | ||
"is_entity": false, | ||
"label": "==NONE==", | ||
"reason": "is a person, not a drug or dose" | ||
} | ||
] | ||
}, | ||
{ | ||
"text": "Throughout the treatment, they received Aspirin 1mg/kg.", | ||
"spans": [ | ||
{ | ||
"text": "Aspirin", | ||
"is_entity": true, | ||
"label": "Drug", | ||
"reason": "is a drug brand, used as medication" | ||
}, | ||
{ | ||
"text": "1mg/kg", | ||
"is_entity": true, | ||
"label": "Dose", | ||
"reason": "is the quantity or dose of the given drug" | ||
}, | ||
{ | ||
"text": "Aspirin 1mg/kg", | ||
"is_entity": false, | ||
"label": "==NONE==", | ||
"reason": "contains both the drug and the dose - these should be two entities instead" | ||
} | ||
] | ||
} | ||
] |
27 changes: 27 additions & 0 deletions
27
tutorials/llm_clinical_trials/configs/ner_fewshot_openai.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[nlp] | ||
lang = "en" | ||
pipeline = ["llm"] | ||
batch_size = 128 | ||
|
||
[components] | ||
|
||
[components.llm] | ||
factory = "llm" | ||
|
||
[components.llm.model] | ||
@llm_models = "spacy.GPT-4.v2" | ||
config = {"seed": 342, "temperature": 0.0} | ||
|
||
[components.llm.task] | ||
@llm_tasks = "spacy.NER.v3" | ||
labels = ["Drug", "Dose"] | ||
description = Entities are drugs or their doses. They can be uppercased, title-cased, or lowercased. | ||
Each occurrence of an entity in the text should be extracted. | ||
|
||
[components.llm.task.label_definitions] | ||
Drug = "A medicine or drug given to a patient as a treatment. Can be a generic name or brand name, e.g. paracetamol, Aspirin" | ||
Dose = "The measured quantity (dose) of a certain medicine given to patients, e.g. 1mg. This should exclude the drug name." | ||
|
||
[components.llm.task.examples] | ||
@misc = "spacy.FewShotReader.v1" | ||
path = "configs/fewshot_drugs_dose.json" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters