promptslab/Promptify

Pipeline.fit() got multiple values for argument 'text_input'

Jasydom opened this issue · 2 comments

Hello,

I would like to do MultiLabel Text-Classification

My code:

model        = OpenAI(api_key)
prompter     = Prompter('multilabel_classification.jinja')
pipe         = Pipeline(prompter, model)

classes = ['Medicine','Oncology','Metastasis','Breast cancer','Lung cancer','Cerebrospinal fluid','Tumor microenvironment','Single-cell RNA sequencing','Idiopathic intracranial hypertension']

sent = "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"
result = pipe.fit('multilabel_classification.jinja',
                          n_output_labels = len(classes),
                          domain          = 'Clinical',
                          text_input      = sent,
                          labels          = classes)

print(eval(result['text']))

I got this error Pipeline.fit() got multiple values for argument 'text_input'

Thank you for taking the time to respond to me.

Have a good day

You don't need to pass 'jinja' multiple times, you are passing template in prompter and again in pipe.fit function.

Try this:

result = pipe.fit(sent, 
n_output_labels = len(classes),
domain          = 'Clinical',
labels          = classes)

also no need to eval on output, it will be handle internally.

Thanks for the reply

Have a good day