1334 lines (1333 with data), 53.8 kB
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "3e433e60-1bee-40b9-bc8a-57524a8a7329",
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/hpc/group/aipi591-f23/ak704/miniconda3/envs/new/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
}
],
"source": [
"import json\n",
"import sys\n",
"import time\n",
"from pathlib import Path\n",
"from typing import Literal, Optional\n",
"\n",
"import lightning as L\n",
"import torch\n",
"from lightning.fabric.plugins import BitsandbytesPrecision\n",
"from lightning.fabric.strategies import FSDPStrategy\n",
"\n",
"import os\n",
"## Add the lit_gpt folder to the path\n",
"sys.path.insert(0, os.path.abspath('../'))\n",
"\n",
"from generate.base import generate\n",
"from lit_gpt import Tokenizer\n",
"from lit_gpt.adapter_v2 import GPT, Block, Config\n",
"from lit_gpt.utils import check_valid_checkpoint_dir, get_default_supported_precision, gptq_quantization, lazy_load\n",
"from scripts.prepare_entity_extraction_data import generate_prompt"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "7ac87e9a-6846-4f84-9c02-27f46fa417ce",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"torch.set_float32_matmul_precision(\"high\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "e6eec0b2-81d9-4a88-b20c-0be57ec6b2a2",
"metadata": {},
"outputs": [],
"source": [
"with open('..data/entity_extraction/entity-extraction-test-data.json', 'r') as file:\n",
" test_data = json.load(file)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "4d92ad07",
"metadata": {},
"outputs": [],
"source": [
"sample = {\n",
" \"input\": \"Natalie Cooper,\\nncooper@example.com\\n6789 Birch Street, Denver, CO 80203,\\n303-555-6543, United States\\n\\nRelationship to XYZ Pharma Inc.: Patient\\nReason for contacting: Adverse Event\\n\\nMessage: Hi, after starting Abilify for bipolar I disorder, I've noticed that I am experiencing nausea and vomiting. Are these typical reactions? Best, Natalie Cooper\",\n",
" \"output\": \"{\\\"drug_name\\\": \\\"Abilify\\\", \\\"adverse_events\\\": [\\\"nausea\\\", \\\"vomiting\\\"]}\"\n",
" }"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "c7e65d14-07f2-4889-849f-277df3887c76",
"metadata": {},
"outputs": [],
"source": [
"## Choose one\n",
"model_type = 'stablelm'\n",
"#model_type = 'llama2'"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "e3c30b09-e631-44b8-a45b-ac79dbbab52f",
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"StableLM 3B\n"
]
}
],
"source": [
"input: str = sample[\"input\"]\n",
"if model_type == \"stablelm\":\n",
" print(\"[INFO] Using StableLM-3B Adapter Fine-tuned\")\n",
" adapter_path: Path = Path(\"../out/adapter_v2/Stable-LM/entity_extraction/lit_model_adapter_finetuned.pth\")\n",
" checkpoint_dir: Path = Path(\"../checkpoints/stabilityai/stablelm-base-alpha-3b\")\n",
" predictions_file_name = '../data/predictions-stablelm-adapter.json'\n",
"\n",
"if model_type == \"llama2\":\n",
" print(\"[INFO] Using LLaMa-2-7B Adapter Fine-tuned\")\n",
" adapter_path: Path = Path(\"../out/adapter_v2/Llama-2/entity_extraction/lit_model_adapter_finetuned.pth\")\n",
" checkpoint_dir: Path = Path(\"../checkpoints/meta-llama/Llama-2-7b-hf\")\n",
" predictions_file_name = '../data/predictions-llama2-adapter.json'\n",
"\n",
"quantize: Optional[Literal[\"bnb.nf4\", \"bnb.nf4-dq\", \"bnb.fp4\", \"bnb.fp4-dq\", \"bnb.int8\", \"gptq.int4\"]] = None\n",
"max_new_tokens: int = 100\n",
"top_k: int = 200\n",
"temperature: float = 0.1\n",
"strategy: str = \"auto\"\n",
"devices: int = 1\n",
"precision: Optional[str] = None"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "b842b257-2c9c-4c64-b011-f97e215c3794",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Loading model 'checkpoints/stabilityai/stablelm-base-alpha-3b/lit_model.pth' with {'name': 'stablelm-base-alpha-3b', 'hf_config': {'org': 'stabilityai', 'name': 'stablelm-base-alpha-3b'}, 'block_size': 4096, 'vocab_size': 50254, 'padding_multiple': 512, 'padded_vocab_size': 50688, 'n_layer': 16, 'n_head': 32, 'n_embd': 4096, 'rotary_percentage': 0.25, 'parallel_residual': True, 'bias': True, 'lm_head_bias': False, 'n_query_groups': 32, 'shared_attention_norm': False, '_norm_class': 'LayerNorm', 'norm_eps': 1e-05, '_mlp_class': 'GptNeoxMLP', 'gelu_approximate': 'none', 'intermediate_size': 16384, 'rope_condense_ratio': 1, 'rope_base': 10000, 'adapter_prompt_length': 10, 'adapter_start_layer': 2, 'head_size': 128, 'rope_n_elem': 32}\n",
"Time to instantiate model: 0.07 seconds.\n",
"Time to load the model weights: 47.84 seconds.\n"
]
}
],
"source": [
"if strategy == \"fsdp\":\n",
" strategy = FSDPStrategy(auto_wrap_policy={Block}, cpu_offload=False)\n",
"fabric = L.Fabric(devices=devices, precision=precision, strategy=strategy)\n",
"fabric.launch()\n",
"\n",
"check_valid_checkpoint_dir(checkpoint_dir)\n",
"\n",
"config = Config.from_json(checkpoint_dir / \"lit_config.json\")\n",
"\n",
"if quantize is not None and devices > 1:\n",
" raise NotImplementedError\n",
"if quantize == \"gptq.int4\":\n",
" model_file = \"lit_model_gptq.4bit.pth\"\n",
" if not (checkpoint_dir / model_file).is_file():\n",
" raise ValueError(\"Please run `python quantize/gptq.py` first\")\n",
"else:\n",
" model_file = \"lit_model.pth\"\n",
"checkpoint_path = checkpoint_dir / model_file\n",
"\n",
"tokenizer = Tokenizer(checkpoint_dir)\n",
"prompt = generate_prompt(sample)\n",
"encoded = tokenizer.encode(prompt, device=fabric.device)\n",
"prompt_length = encoded.size(0)\n",
"max_returned_tokens = prompt_length + max_new_tokens\n",
"\n",
"fabric.print(f\"Loading model {str(checkpoint_path)!r} with {config.__dict__}\", file=sys.stderr)\n",
"t0 = time.perf_counter()\n",
"with fabric.init_module(empty_init=True), gptq_quantization(quantize == \"gptq.int4\"):\n",
" model = GPT(config)\n",
"fabric.print(f\"Time to instantiate model: {time.perf_counter() - t0:.02f} seconds.\", file=sys.stderr)\n",
"with fabric.init_tensor():\n",
" # set the max_seq_length to limit the memory usage to what we need\n",
" model.max_seq_length = max_returned_tokens\n",
" # enable the kv cache\n",
" model.set_kv_cache(batch_size=1)\n",
"model.eval()\n",
"\n",
"t0 = time.perf_counter()\n",
"checkpoint = lazy_load(checkpoint_path)\n",
"adapter_checkpoint = lazy_load(adapter_path)\n",
"checkpoint.update(adapter_checkpoint.get(\"model\", adapter_checkpoint))\n",
"model.load_state_dict(checkpoint)\n",
"fabric.print(f\"Time to load the model weights: {time.perf_counter() - t0:.02f} seconds.\", file=sys.stderr)\n",
"\n",
"model = fabric.setup(model)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "59e00f69-d9fd-4cf5-a4ed-f142991b870f",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"\"### Input:\\nNatalie Cooper,\\nncooper@example.com\\n6789 Birch Street, Denver, CO 80203,\\n303-555-6543, United States\\n\\nRelationship to XYZ Pharma Inc.: Patient\\nReason for contacting: Adverse Event\\n\\nMessage: Hi, after starting Abilify for bipolar I disorder, I've noticed that I am experiencing nausea and vomiting. Are these typical reactions? Best, Natalie Cooper\\n\\n### Response:\""
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"prompt"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "3eeaa237-7a95-4c9d-aeda-8a3c246d02fe",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[rank: 0] Seed set to 1234\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\"drug_name\": \"Abilify\", \"adverse_events\": [\"nausea\", \"vomiting\"]}\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"\n",
"Time for inference: 1.49 sec total, 18.77 tokens/sec\n",
"Memory used: 14.72 GB\n"
]
}
],
"source": [
"L.seed_everything(1234)\n",
"t0 = time.perf_counter()\n",
"\n",
"y = generate(model, encoded, max_returned_tokens, temperature=temperature, top_k=top_k, eos_id=tokenizer.eos_id)\n",
"t = time.perf_counter() - t0\n",
"\n",
"output = tokenizer.decode(y)\n",
"output = output.split(\"### Response:\")[1].strip()\n",
"fabric.print(output)\n",
"\n",
"tokens_generated = y.size(0) - prompt_length\n",
"fabric.print(f\"\\n\\nTime for inference: {t:.02f} sec total, {tokens_generated / t:.02f} tokens/sec\", file=sys.stderr)\n",
"if fabric.device.type == \"cuda\":\n",
" fabric.print(f\"Memory used: {torch.cuda.max_memory_allocated() / 1e9:.02f} GB\", file=sys.stderr)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "69075dce-b170-43f6-8db5-22367ab073e4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'{\"drug_name\": \"Abilify\", \"adverse_events\": [\"nausea\", \"vomiting\"]}'"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"output"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "09d286fb-d595-4d8c-94a1-06ec7357722f",
"metadata": {},
"outputs": [],
"source": [
"def parse_model_response(response):\n",
" \"\"\"\n",
" Parse the model response to extract entities.\n",
"\n",
" Args:\n",
" - response: A string representing the model's response.\n",
"\n",
" Returns:\n",
" - A dictionary containing the extracted entities.\n",
" \"\"\"\n",
" return json.loads(response)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "faee8a5e-9e3c-4d95-b351-d19a46c3f0a2",
"metadata": {
"scrolled": true,
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"### Input:\n",
"Natalie Cooper,\n",
"ncooper@example.com\n",
"6789 Birch Street, Denver, CO 80203,\n",
"303-555-6543, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Hi, after starting Abilify for bipolar I disorder, I've noticed that I am experiencing nausea and vomiting. Are these typical reactions? Best, Natalie Cooper\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Abilify\", \"adverse_events\": [\"nausea\", \"vomiting\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Mia Garcia\n",
"mia.garcia@email.com\n",
"321 Magnolia Drive, Dallas, TX 75201\n",
"555-890-1234, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I experienced a feeling of light-headedness and near-fainting after taking Staxyn for my erectile dysfunction. Is this a common side effect, and should I be worried?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Staxyn\", \"adverse_events\": [\"feeling light-headed\", \"near-fainting\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Brandon Lee,\n",
"blee@example.com\n",
"3333 Pine Road, Hilltown, MA 02108,\n",
"617-555-3333, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Since I started on Byetta, I've noticed an increase in thirst and dry mouth. Is this related to the medication? Best, Brandon Lee\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Byetta\", \"adverse_events\": [\"increase in thirst\", \"dry mouth\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"William Brown\n",
"william.brown@example.com\n",
"444 Oakwood Lane, Phoenix, AZ 85001\n",
"6025559090, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been taking Lipitor, and I've noticed that I'm experiencing frequent nosebleeds. They are quite sudden and inconvenient. I'm wondering if this is a known side effect and if there's anything I can do to prevent it.\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Lipitor\", \"adverse_events\": [\"frequent nosebleeds\", \"unconventional side effects\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Diane Wilson,\n",
"dwilson@example.com\n",
"10101 Birch Street, Hillside, IL 60010,\n",
"847-555-1010, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: After using Cialis, I've begun experiencing upset stomach and flushing. Are these common reactions to the medication? Thanks, Diane Wilson\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Cialis\", \"adverse_events\": [\"upset stomach\", \"flushing\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Emily Clark,\n",
"eclark@example.com\n",
"151617 Elm Street, Rivertown, FL 33101,\n",
"305-555-7890, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Hi, I've been on Cialis for a few months and have recently had an erection that is painful and lasts longer than 4 hours. Could this be related to the medication? Regards, Emily Clark\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Cialis\", \"adverse_events\": [\"painful erection\", \"longer erection\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Emily Smith,\n",
"emily.smith@example.com\n",
"456 Oak Lane, Springfield, IL 62704,\n",
"987-654-3210, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Hello, after taking Viagra, I have noticed that I am experiencing some muscle pain and back pain. These symptoms started soon after I began the medication. Can you advise? Best, Emily Smith\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Viagra\", \"adverse_events\": [\"muscle pain\", \"back pain\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Ella Anderson\n",
"ella.anderson@email.com\n",
"345 Willow Lane, Miami, FL 33101\n",
"555-789-0123, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I'm using Vytorin, and I've noticed that I'm feeling extremely tired. Is this a side effect of the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Vytorin\", \"adverse_events\": [\"feeling extremely tired\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Isabella Clark\n",
"isabella.clark@email.com\n",
"123 Oakwood Drive, Atlanta, GA 30301\n",
"555-901-2345, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been taking Prozac for my major depressive disorder, and I've had an increase in heart rate and chest pain. Is this a known side effect of the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Prozac\", \"adverse_events\": [\"increase in heart rate\", \"chest pain\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Emily Wilson\n",
"emily.wilson@example.com\n",
"45 Maple Street, Los Angeles, CA 90001\n",
"2135557890, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been taking Nexium for my acid reflux, and I recently experienced severe stomach pain and watery diarrhea. Is this a side effect of Nexium?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Nexium\", \"adverse_events\": [\"severe stomach pain\", \"severe watery diarrhea\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"William Harris\n",
"william.harris@example.com\n",
"890 Oak Road, San Francisco, CA 94101\n",
"4155558765, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I received Neupogen and had trouble breathing and fever. Are these common side effects of the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Neupogen\", \"adverse_events\": [\"trouble breathing\", \"fever\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Alex Martinez\n",
"alexm@example.com\n",
"234 River Road, Austin, TX 78701\n",
"5121234567, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been taking Cymbalta for chronic back pain. I've started experiencing severe constipation and occasional vision changes. Are these known side effects?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Cymbalta\", \"adverse_events\": [\"severe constipation\", \"occasional vision changes\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Daniel Wilson\n",
"daniel.wilson@example.com\n",
"112 Pine Avenue, Atlanta, GA 30301\n",
"4045554321, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I took Nexium for acid reflux, and I had a headache and stomach pain. Could this be due to the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Nexium\", \"adverse_events\": [\"headache\", \"stomach pain\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Sebastian Cooper\n",
"sebastian.cooper@email.com\n",
"567 Maple Road, Austin, TX 78701\n",
"555-567-8901, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: After receiving a Remicade infusion for my plaque psoriasis, I've experienced blurred vision and severe headaches. Are these symptoms related to the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Remicade\", \"adverse_events\": [\"blurred vision\", \"severe headaches\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"James Garcia,\n",
"james.garcia@example.com\n",
"121314 Maple Lane, Boston, MA 02108,\n",
"617-555-4568, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Hi, I'm on Advair for emphysema and have started experiencing fever and chills, along with a cough with mucus. Are these effects related to Advair? Thanks, James Garcia\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Advair\", \"adverse_events\": [\"fever\", \"chills\", \"cough with mucus\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Ethan Clark\n",
"e.clark@example.com\n",
"456 Pine Lane, Dallas, TX 75201\n",
"2141234567, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I started Doxycycline as a treatment for chlamydia, and I've noticed darkening of my skin color. Is this related to the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Doxycycline\", \"adverse_events\": [\"darkening of skin color\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Sophie Turner\n",
"sophie.turner@email.com\n",
"654 Oak Avenue, San Diego, CA 92101\n",
"555-345-6789, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Since taking Victoza, I've been experiencing a persistent cough and wheezing. Is this a known side effect?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Victoza\", \"adverse_events\": [\"persistent cough\", \"wheezing\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Michael Johnson,\n",
"michael.johnson@example.com\n",
"789 Pine Road, Metropolis, NY 10001,\n",
"456-123-7890, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been prescribed Viagra and have been using it for a few weeks. Recently, I've started to experience a stuffy nose and some nosebleeds. Is this a common side effect? Thanks, Michael Johnson\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Viagra\", \"adverse_events\": [\"stuffy nose\", \"nosebleeds\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"William Turner\n",
"william.turner@email.com\n",
"890 Cedar Lane, Houston, TX 77001\n",
"555-456-7890, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Since taking Provigil, I've developed a persistent headache and hallucinations. Could this be a side effect of the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Provigil\", \"adverse_events\": [\"persistent headache\", \"hallucinations\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Liam Davis\n",
"liam.davis@email.com\n",
"234 Cedar Road, Miami, FL 33101\n",
"555-678-9012, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Since I started Protonix, I've noticed swelling in my face and hands along with a rapid heart rate. Is this a known side effect of the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Protonix\", \"adverse_events\": [\"swelling in face\", \"rapid heart rate\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Sophia Turner\n",
"sophia.turner@email.com\n",
"567 Elm Road, Seattle, WA 98101\n",
"555-890-1234, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Since starting Prilosec, I've had a persistent cough and vomiting. Is this a common side effect of the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Prilosec\", \"adverse_events\": [\"persistent cough\", \"vomiting\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Ava Johnson\n",
"ava.johnson@email.com\n",
"456 Maple Avenue, Los Angeles, CA 90001\n",
"555-234-5678, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I have been taking Symbicort, and it caused me to have white patches in my mouth and throat, along with pain when swallowing. What should I do about these symptoms?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Symbicort\", \"adverse_events\": [\"white patches in mouth\", \"pain when swallowing\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Claire Brown,\n",
"cbrown@example.com\n",
"91011 Pine Avenue, Metropolis, NY 10001,\n",
"212-555-2468, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been treated with Byetta for diabetes and recently started experiencing symptoms of low blood sugar like dizziness and sweating. Is this a side effect of the drug? Sincerely, Claire Brown\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Byetta\", \"adverse_events\": [\"symptoms of low blood sugar\", \"dizziness\", \"sweating\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Thomas Brown,\n",
"tbrown@example.com\n",
"7890 Spruce Street, Portland, OR 97201,\n",
"503-555-1122, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Hi, I started taking Abilify for schizophrenia and I've noticed some problems with speech and a mask-like appearance of my face. Is this a known side effect? Thanks, Thomas Brown\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Abilify\", \"adverse_events\": [\"speech problems\", \"mask-like face\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Maria Rodriguez\n",
"maria.rodriguez@example.com\n",
"999 Walnut Street, Philadelphia, PA 19101\n",
"2155551414, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been on Lipitor for a while, and I've developed a persistent cough. It's quite bothersome, and I'm wondering if this could be related to the medication. What should I do about it?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Lipitor\", \"adverse_events\": [\"persistent cough\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"David Martinez\n",
"david.martinez@email.com\n",
"567 Cedar Road, Miami, FL 33101\n",
"555-765-4321, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I received Rituximab along with methotrexate for rheumatoid arthritis, and I've been experiencing painful urination and muscle spasms. Could this be related to the treatment?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Rituximab\", \"adverse_events\": [\"painful urination\", \"muscle spasms\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Grace Lee,\n",
"glee@example.com\n",
"3030 Maple Drive, Smallville, KS 66002,\n",
"785-555-3030, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been using Byetta for my diabetes management and recently started experiencing rapid heartbeats and difficulty breathing. Should I seek medical attention? Best, Grace Lee\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Byetta\", \"adverse_events\": [\"rapid heartbeats\", \"rapid breathing\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"David Clark\n",
"david.clark@email.com\n",
"567 Cedar Road, New York, NY 10001\n",
"555-345-6789, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I'm using Prevacid for Zollinger-Ellison syndrome, and I've noticed new and unusual pain in my hip. Could this be a side effect of the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Prevacid\", \"adverse_events\": [\"new and unusual pain in my hip\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Samantha Green,\n",
"sgreen@example.com\n",
"1818 Cedar St, Hillside, NJ 07205,\n",
"908-555-1818, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Since I began taking Celexa, I've experienced sudden changes in mood and increased anxiety. Are these known side effects? Regards, Samantha Green\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Celexa\", \"adverse_events\": [\"sudden mood changes\", \"increased anxiety\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Liam Johnson\n",
"liam.johnson@example.com\n",
"101 Oak Street, Boston, MA 02101\n",
"6175551234, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I received Neupogen during chemotherapy and had a sudden and severe pain in my chest. Is this a known side effect of the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Neupogen\", \"adverse_events\": [\"sudden and severe pain in chest\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"David Clark\n",
"david.clark@email.com\n",
"234 Redwood Drive, Boston, MA 02101\n",
"555-678-9012, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been taking Onglyza, and I've been experiencing shortness of breath, especially when lying down. Could this be related to the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Onglyza\", \"adverse_events\": [\"shortness of breath\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"James Turner\n",
"james.turner@example.com\n",
"666 Willow Lane, Seattle, WA 98101\n",
"2065559876, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I started using Lunesta, and I've been experiencing hallucinations and confusion. It's quite distressing. Is this a known side effect of the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Lunesta\", \"adverse_events\": [\"hallucinations\", \"confusion\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"John Smith\n",
"john.smith@email.com\n",
"234 Birch Avenue, Miami, FL 33101\n",
"555-567-8901, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been using Prevacid OTC, and I've been feeling a rapid heart rate and a jittery sensation. Is this a known side effect?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Prevacid\", \"adverse_events\": [\"rapid heart rate\", \"jittery sensation\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Henry Adams\n",
"henry.adams@email.com\n",
"876 Birch Street, Atlanta, GA 30301\n",
"555-234-5678, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Symbicort is giving me leg cramps and irregular heartbeats. I'm concerned about these symptoms.\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Symbicort\", \"adverse_events\": [\"leg cramps\", \"irregular heartbeats\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Isabella Rodriguez\n",
"isabella.rodriguez@email.com\n",
"901 Pine Street, Chicago, IL 60601\n",
"555-456-7890, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been using Prezista for my HIV treatment, and I've developed swelling in my neck and throat. Is this a known side effect?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Prezista\", \"adverse_events\": [\"swelling in neck\", \"swelling in throat\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Ethan Turner\n",
"ethan.turner@email.com\n",
"123 Cedar Road, Denver, CO 80123\n",
"555-543-7890, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been taking Singulair for allergy management, and I've experienced flu-like symptoms and a sore throat. Is this a common reaction to the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Singulair\", \"adverse_events\": [\"flu-like symptoms\", \"sore throat\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Andrew Brown\n",
"andrew.brown@email.com\n",
"789 Oakwood Drive, Boston, MA 02101\n",
"555-345-6789, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Since starting Prezista for my HIV treatment, I've had trouble with balance and eye movement, and I feel weak. Could this be related to the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Prezista\", \"adverse_events\": [\"trouble with balance\", \"eye movement\", \"weakness\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Zoe Wilson\n",
"zoe.wilson@example.com\n",
"567 Elm Road, Chicago, IL 60601\n",
"3125550101, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I received Infliximab for my ankylosing spondylitis, and I'm having trouble swallowing and pain in my throat. Is this a known side effect?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Infliximab\", \"adverse_events\": [\"trouble swallowing\", \"pain in throat\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"James White\n",
"james.white@example.com\n",
"123 Oak Road, Seattle, WA 98101\n",
"2065550101, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I received an Infliximab infusion for my Crohn's disease, and I've been experiencing severe diarrhea and abdominal pain. Is this expected with the treatment?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Infliximab\", \"adverse_events\": [\"severe diarrhea\", \"abdominal pain\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Liam Thomas\n",
"liam.thomas@email.com\n",
"567 Pine Street, Philadelphia, PA 19101\n",
"555-012-3456, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been using Provigil for my narcolepsy, and I'm experiencing a severe headache and dizziness. Is this a known side effect of the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Provigil\", \"adverse_events\": [\"severe headache\", \"dizziness\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"William Turner\n",
"william.turner@example.com\n",
"101 Pine Lane, Philadelphia, PA 19101\n",
"2155551234, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I started Metoprolol, and I'm feeling depressed and confused. Could these be side effects of the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Metoprolol\", \"adverse_events\": [\"depressed\", \"confused\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Emma Thompson,\n",
"ethompson@example.com\n",
"3690 Elm Road, Coastville, FL 33101,\n",
"305-555-3690, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Since being prescribed Atripla, I've had episodes of severe dizziness and feeling cold. Are these typical reactions to the medication? Regards, Emma Thompson\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Atripla\", \"adverse_events\": [\"severe dizziness\", \"feeling cold\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Ava Wilson\n",
"ava.wilson@example.com\n",
"999 Willow Road, Seattle, WA 98101\n",
"2065555432, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I'm using Metoprolol for angina, and I've been feeling anxious and agitated. Is this expected with the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Metoprolol\", \"adverse_events\": [\"feeling anxious\", \"agitated\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Henry Taylor\n",
"henry.taylor@email.com\n",
"890 Pine Road, Phoenix, AZ 85001\n",
"555-901-2345, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been using Protonix for my GERD, and I've experienced persistent diarrhea and joint pain. Is this a known side effect of the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Protonix\", \"adverse_events\": [\"persistent diarrhea\", \"joint pain\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Richard Turner,\n",
"richard.turner@email.com\n",
"987 Pine Street, Boston, MA 02101,\n",
"555-987-6543, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been using Enbrel for polyarticular juvenile idiopathic arthritis in my child, and they have developed skin sores and redness. Could this be related to Enbrel? Regards, Richard Turner\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Enbrel\", \"adverse_events\": [\"skin sores\", \"redness\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"John Smith\n",
"john.smith@example.com\n",
"789 Elm Avenue, Los Angeles, CA 90001\n",
"2135550101, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been using Januvia, and I'm experiencing severe pain in my joints. Could this be related to the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Januvia\", \"adverse_events\": [\"severe pain in joints\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Sophia Martinez\n",
"sophia.martinez@email.com\n",
"901 Cedar Road, Chicago, IL 60601\n",
"555-345-6789, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Since I began taking Prilosec, I've been experiencing new and unusual pain in my wrist. Could this be related to the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Prilosec\", \"adverse_events\": [\"new and unusual wrist pain\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Ava Martin\n",
"ava.martin@example.com\n",
"567 Maple Street, New York, NY 10002\n",
"2129876543, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been taking Doxycycline for acne, and I've noticed a significant loss of appetite and nausea. Could this be related to the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Doxycycline\", \"adverse_events\": [\"significant loss of appetite\", \"nausea\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Mia Johnson,\n",
"mia.johnson@example.com\n",
"789 Park Ave, Chicago, IL 60601,\n",
"312-555-5678, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Since starting on Amlodipine, I've had instances of severe drowsiness and weakness. Are these common side effects? Sincerely, Mia Johnson\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Amlodipine\", \"adverse_events\": [\"severe drowsiness\", \"weakness\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Samantha Davis,\n",
"sdavis@example.com\n",
"6565 Pine Road, Miami, FL 33101,\n",
"305-555-6565, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Hi, I've been prescribed Atorvastatin for lowering cholesterol and recently noticed nausea and upset stomach. Are these reactions to the medication? Thanks, Samantha Davis\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Atorvastatin\", \"adverse_events\": [\"nausea\", \"upset stomach\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Liam Smith\n",
"l.smith@example.com\n",
"789 Oak Road, Phoenix, AZ 85001\n",
"6021234567, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I'm taking Doxycycline for gonorrhea, and I've developed a fever, swollen glands, and body aches. Is this a possible reaction to the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Doxycycline\", \"adverse_events\": [\"fever\", \"swollen glands\", \"body aches\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"John Davis,\n",
"john.davis@email.com\n",
"123 Maple Lane, San Francisco, CA 94101,\n",
"555-123-9876, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I have been on Enbrel for ankylosing spondylitis and noticed pain, redness, and swelling at the injection site. Is this something I should be concerned about? Thank you, John Davis\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Enbrel\", \"adverse_events\": [\"pain at injection site\", \"redness at injection site\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Ethan White\n",
"ethan.white@email.com\n",
"456 Elm Avenue, New York, NY 10001\n",
"555-234-5678, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: Since starting Protonix, I've experienced persistent diarrhea and joint pain. Is this a known side effect of the medication?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Protonix\", \"adverse_events\": [\"persistent diarrhea\", \"joint pain\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Karen Green\n",
"karen.green@email.com\n",
"789 Oakwood Road, Houston, TX 77001\n",
"555-678-9012, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been taking Prezista for my HIV, and I've been experiencing upper stomach pain that may spread to my back and nausea. Is this a known side effect?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Prezista\", \"adverse_events\": [\"upper stomach pain\", \"nausea\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Emily Anderson,\n",
"emily.anderson@email.com\n",
"123 Elm Street, Springfield, IL 62701,\n",
"555-123-4567, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I have been using Enbrel for my rheumatoid arthritis, and recently, I've developed a severe skin rash with redness and itching. Is this a common side effect of Enbrel? Regards, Emily Anderson\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Enbrel\", \"adverse_events\": [\"severe skin rash\", \"redness\", \"itching\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Madison Evans\n",
"madison.evans@email.com\n",
"654 Cedar Drive, Phoenix, AZ 85001\n",
"555-345-6789, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been using Symbicort, and it's causing me to experience shortness of breath. This is worrisome as it's supposed to help with breathing issues.\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Symbicort\", \"adverse_events\": [\"shortness of breath\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Sarah Johnson\n",
"sarah.johnson@email.com\n",
"123 Elm Street, New York, NY 10001\n",
"555-123-4567, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I received Rituximab treatment for non-Hodgkin's lymphoma, and I developed a severe skin rash with blistering and peeling. Is this a known side effect?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Rituximab\", \"adverse_events\": [\"severe skin rash\", \"blistering and peeling\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Michael Johnson,\n",
"mjohnson@example.com\n",
"2525 Birch Avenue, Riverside, CA 92507,\n",
"951-555-2525, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I'm taking Celexa and have recently had a seizure. Is this a known side effect of the medication? Regards, Michael Johnson\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Celexa\", \"adverse_events\": [\"seizure\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n",
"### Input:\n",
"Daniel Clark\n",
"daniel.clark@example.com\n",
"666 Elm Street, Denver, CO 80201\n",
"3035551111, United States\n",
"\n",
"Relationship to XYZ Pharma Inc.: Patient\n",
"Reason for contacting: Adverse Event\n",
"\n",
"Message: I've been prescribed Lipitor, and I've noticed a persistent metallic taste in my mouth. It's quite unpleasant, and I'm concerned about this taste being related to the medication. Can you provide some guidance?\n",
"\n",
"### Response:\n",
"{\"drug_name\": \"Lipitor\", \"adverse_events\": [\"persistent metallic taste in mouth\"]}\n",
"---------------------------------------------------------\n",
"\n",
"\n"
]
}
],
"source": [
"test_data_with_prediction = []\n",
"for sample in test_data:\n",
" # Generate prompt from sample\n",
" prompt = generate_prompt(sample)\n",
" fabric.print(prompt)\n",
" \n",
" # Encode the prompt\n",
" encoded = tokenizer.encode(prompt, device=fabric.device)\n",
" \n",
" # Generate the prediction from the LLM\n",
" y = generate(model, encoded, max_returned_tokens, temperature=temperature, top_k=top_k, eos_id=tokenizer.eos_id)\n",
" output = tokenizer.decode(y)\n",
" \n",
" # Process the predicted completion\n",
" output = output.split(\"### Response:\")[1].strip()\n",
" \n",
" # Store prediction along with input and ground truth\n",
" sample['prediction'] = output\n",
" test_data_with_prediction.append(sample)\n",
" \n",
" fabric.print(output)\n",
" fabric.print(\"---------------------------------------------------------\\n\\n\")"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "1616278a-0dca-48b7-b254-f1bd957942ef",
"metadata": {},
"outputs": [],
"source": [
"# Write the predictions data to a file\n",
"with open(predictions_file_name, 'w') as file:\n",
" json.dump(test_data_with_prediction, file, indent=4)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "047cb010-58dd-4913-a0e5-fe167d32c320",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "new",
"language": "python",
"name": "new"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}