RetoolAI: Implementing Dynamic Variables in AI-Powered Prompts

Hello everyone,

I'm currently working on integrating AI-driven functionalities into my application and I've encountered a stumbling block I'm hoping to get some help with.

I've crafted a prompt for the AI that's supposed to generate content based on specific data drawn from a table—particularly, information from a cell referenced as {{table9.selectedRow.column3}}. The prompt functions flawlessly until I try to incorporate this dynamic variable; once included, the AI responds with an error indicating a lack of context.

Here's the twist: the table in question is populated with data. It's not empty, so theoretically, the AI should have the information it needs to proceed.

Has anyone faced a similar issue? How do you ensure that your AI prompts can properly recognize and utilize variable elements drawn from your data sources? I'm looking for any advice, workarounds, or solutions that could help the AI understand and use the {{table9.selectedRow.column3}} reference effectively in the prompt.

Any input on this would be greatly appreciated. Thank you in advance for your time and assistance!

Hi,

You’re only sending a single column of data to the AI, so it’s only ‘raw’ data. AI doesn’t see the context of the data without the other column/table data. Don’t know what your data looks like, and I think that it only sends an object , not the data in the cells.
So I think you’ll first need to create an array of that data an add proper context.

1 Like

cool, any guidelines of how to do so?

Sorry, didn't read properly, you're adding data from a single cell from the column named "column3". Thought that you were adding data from a whole column.
The value you're adding from {{table9.selectedRow.column3}} would be passed to AI as a string and I guess this should work. What is you data and the context/prompt you're using?

Hi @Netanel_Baruch ,

I wanted to offer a working example of leveraging javascript objects alongside GenAI to create content. In the following video, I've tried to incorporate a use case similar to your question, where I'm leveraging data found in a table to create content with GPT-4.

Please view the solution here: Loom | Free Screen & Video Recording Software | Loom

Do you see your own {{table1.selectedRow.column3}} producing a single data point, or is it producing an array? In my example, I've used a specific column #id 'name' to complete my JS object({{table1.selectedRow.name}}).

Please let me know if you are still impacted by this issue and thank you for your patience and question!
-Brett