Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The example code fails after installation, MarkupSafe version does not match #9

Closed
Huge opened this issue Jan 30, 2023 · 2 comments
Closed
Assignees
Labels
documentation Improvements or additions to documentation prompter issue related to prompter

Comments

@Huge
Copy link

Huge commented Jan 30, 2023

With python3.10, the code fails with ImportError: cannot import name 'soft_unicode' from 'markupsafe'.

aws/aws-sam-cli#3661 (comment) helps fixing that.
Still with that change, with the introductory example we get

    assert len(variables_missing) == 0, f"Missing required variables in template {variables_missing}"
AssertionError: Missing required variables in template ['labels']

It would be great if the main setup instructions work out of the box.

@monk1337
Copy link
Contributor

Hi, Sorry for the confusion. I have corrected the main readme.md example. You need to pass labels = None and eval(result['text']). Here is a working example

from promptify import OpenAI
from promptify import Prompter

sentence     =  """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"""

model        = OpenAI("your_key")
nlp_prompter = Prompter(model)


result       = nlp_prompter.fit('ner.jinja', domain ='medical', text_input  = sentence, labels = None)
eval(result['text'])

@monk1337 monk1337 self-assigned this Jan 30, 2023
@monk1337 monk1337 added the documentation Improvements or additions to documentation label Jan 30, 2023
@tobwen
Copy link

tobwen commented Jan 31, 2023

That's still an issue. It already occures on from promptify import OpenAI.

One solution is to downgrade markersafe: pip install markupsafe==2.0.1

@monk1337 monk1337 added the prompter issue related to prompter label Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation prompter issue related to prompter
Projects
None yet
Development

No branches or pull requests

3 participants