jupyter-ai
jupyter-ai copied to clipboard
Unable to include webpages copy and pasted into context for language models
Description
In this bug, it is difficult to use curl, or just copy and paste text from a website (e.g. in this case, https://uwdata.github.io/mosaic/jupyter/), for use in a prompt:
It looks like something is not being escaped properly.
Reproduce
- Go to https://github.com/jaanli/new-york-real-estate/blob/fdb4e029feeb27f80ca08b87c2637136fa3bdec3/notebooks/load_and_visualize_opencorporates_corporate_entity_data_llc_corp.ipynb
- Copy and paste the text from https://uwdata.github.io/mosaic/jupyter/
- Set the text equal to a python variable (e.g.
example_raw) - Include this variable in a
%%aicell magic thanks to jupyter-ai. - Try to run the cell and see the error about things not being escaped.
Expected behavior
Able to copy and paste text from URLs or CURLs.
Context
- Operating System and version: MacOS latest
- Browser and version: Firefox
- JupyterLab version: Latest
Troubleshoot Output
Paste the output from running `jupyter troubleshoot` from the command line here. You may want to sanitize the paths in the output.
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Browser Output
Paste the output from your browser Javascript console here, if applicable.
It looks like your example_raw variable is undefined (in your notebook). I think this should have a better error message.
So far I was only able to break it like this:
but it is different from your error. Can you provide an example value for example_raw that can reproduce the problem?
Thanks so much for checking! It should be in the reproduce section: https://github.com/jaanli/new-york-real-estate/blob/fdb4e029feeb27f80ca08b87c2637136fa3bdec3/notebooks/load_and_visualize_opencorporates_corporate_entity_data_llc_corp.ipynb
Please let me know if that doesn't work!
I do not have access to Claude but when I try the snippet it works ok:
I suspect that the value you have for prompt or for example_raw variable may be important. Can you share what values do you have on these variables?