approximatelabs / sketch

AI code-writing assistant that understands data content
MIT License
2.21k stars 112 forks source link

<IPython.core.display.HTML object> error #11

Closed smyja closed 1 year ago

smyja commented 1 year ago

I get that error when i try to run it as a python file on vscode and not a jupiter notebook. In the sketch extensions file i can see that ask method has display(HTML(f"""{result}""")) which pretty much means it should be able to output it to console, yet it doesn't. I have also tried to import and apply display to the ask line and it still didn't work. Heres my python file code.

import sketch
import pandas as pd
state_data = pd.read_csv('state.csv')
state_data.sketch.ask("How many columns are there?")
bluecoconut commented 1 year ago

In vscode in jupyter, click on the left ... and then click "change presentation" and select the HTML renderer

bluecoconut commented 1 year ago

also, if you just want the text, you can add the call_display=False to the call

Eg. state_data.sketch.ask("How many columns are there?", call_display=False) (but this won't give you the HTML rendering which can be nice sometimes. (eg. html rendering on howto gives you the copy button))

bluecoconut commented 1 year ago

image image

bluecoconut commented 1 year ago

(Closing for now, since I think these are the 2 paths depending on what you want. Either update the renderer or use call_display=False to get the raw output as a return from the function (you can in a script use this to put into a variable and do whatever you'd like with it))