I am trying to use GPT to create executable Python code in the next block in a workflow. The Python code it generates is correct, if I copy and paste the code into the Python code block it works fine. But If I reference the data from the previous block "{{AIPlot.data}}" I get this error "TypeError: unhashable type: 'set' (line 1)". Can anyone help?
Hi @Dan_strawbridge, the type error we are seeing is from adding curly brackets to APIlot.data
. On python and JS blocks, we don't need the extra curly brackets.
On the other hand, I tried the same Retool AI query and here are my findings:
The output of Chat GPT is text that looks like:
` ` ` python
---- all code
` ` `
Using triple backticks for a multi-line string wouldn't work directly with exec()
due to syntax issues with the backticks and formatting.
So I yelled at ChatGPT saying NOT to use backticks:
Which got us closer, but it seems to still have issues with formatting, this is why when you manually paste the output of the query, and fix the indentation, it works like a charm:
Since that worked, I tried yelling at it again to not include the libraries, so we could do something like:
But no success. It may be just a matter of playing with the prompt.