promptslab / Promptify

Prompt Engineering | Prompt Versioning | Use GPT or other prompt based models to get structured output. Join our discord for Prompt-Engineering, LLMs and other latest research
https://discord.gg/m88xfYMbK6
Apache License 2.0
3.21k stars 238 forks source link

NER one shot example issue #25

Closed azamiftikhar1000 closed 1 year ago

azamiftikhar1000 commented 1 year ago

This is the network call which happens while doing the NER.

'Request to OpenAI API' method=post path=https://api.openai.com/v1/completions data='{"model": "text-davinci-003", "prompt": "It is related to detection of symptoms and diseases for medical domain\nYou are a highly intelligent and accurate medical domain Named-entity recognition(NER) system. You take Passage as input and your task is to recognize and extract specific types of medical domain named entities in that given passage and classify into a set of following predefined entity types:\n[\'SYMPTOM\', \'DISEASE\']Your output format is only [{{\'T\': type of entity from predefined entity types, \'E\': entity in the input text}},...,{{\'branch\' : Appropriate branch of the passage ,\'group\': Appropriate Group of the passage}}] form, no other form.\n\nExamples:\n\nInput: Leptomeningeal metastases (LM) occur in patients with breast cancer (BC) and lung cancer (LC). The cerebrospinal fluid (CSF) tumour microenvironment (TME) of LM patients is not well defined at a single-cell level. We did an analysis based on single-cell RNA sequencing (scRNA-seq) data and four patient-derived CSF samples of idiopathic intracranial hypertension (IIH)\nOutput: [[{\'E\': \'DISEASE\', \'W\': \'Leptomeningeal metastases\'}, {\'E\': \'DISEASE\', \'W\': \'breast cancer\'}, {\'E\': \'DISEASE\', \'W\': \'lung cancer\'}, {\'E\': \'BIOMARKER\', \'W\': \'cerebrospinal fluid\'}, {\'E\': \'DISEASE\', \'W\': \'tumour microenvironment\'}, {\'E\': \'TEST\', \'W\': \'single-cell RNA sequencing\'}, {\'E\': \'DISEASE\', \'W\': \'idiopathic intracranial hypertension\'}]]\n\nInput: The patient is a 93-year-old female with a medical history of chronic right hip pain, osteoporosis, hypertension, depression, and chronic atrial fibrillation admitted for evaluation and management of severe nausea and vomiting and urinary tract infection\nOutput:", "temperature": 0.7, "max_tokens": 3550, "top_p": 0.1, "frequency_penalty": 0, "presence_penalty": 0, "stop": null}'

We are asking the output to be in the format => {\'T\': type of entity from predefined entity types, \'E\': entity in the input text. }

However, in the one shot examples we provide it in the format E: Entity Type, W: Entity name.

Isn't this incorrect? If it isn't what is the reason for providing the examples in this format?

Screenshot 2023-02-10 at 2 59 08 PM
azamiftikhar1000 commented 1 year ago

@monk1337 @kamalkraj - Could you please help me in here?

I am actually trying to integrate this library for an NLP use case, and came across this. Any inputs would be helpful

monk1337 commented 1 year ago

@azamiftikhar1000 Corrected.