Hi -- I'm trying to add a ChatGPT resource to then reference a Google Sheet that I connected called "Query1". My goal is to create a chatbot that will analyze the data within the google sheet and return answers like how many orders are in the table or which date has the most orders?
I have connected OpenAI via my API key, but I can't get the chat/completions Operation to use Query 1, so not sure what I'm supposed to do to get it to reference my data.
Hi @turps808 -- This is what I'm seeing now. The query to the google sheet seems to be working well since the table is populating the results, but I can't figure out how to get the chatbot to analyze the dataset. If it's easier to use the Retool AI resource, I'm not tied to using ChatGPT. What I'm hoping to do after is add some visual aspects for trending graphs to it so I can ask something like "Which store has had the most orders and show the numbers of orders per day in a trending graph", but the mvp would be to have it able to analyze the table of data to answer simple BI questions.
Hi Andrew. I believe that ChatGPT often expects a string if data is to be used as part of a prompt. I see you are doing this already in the messages section. You could try adding something like {{ return JSON.stringify(data, null, 2) }} to the Transform Results section of Query 1 instead. I would probably also try the Retool AI resources - I have had success with that in the past.
Great question! Also thank you @turps808 for helping out on this!
Turps is correct, for the LLM Chat tool it is limited to strings that are passed in via the query (and the chat component).
Buuuuut there is a new AI tool on the block that you can give it tools such as workflows that run query blocks to grab all the same data that the table is grabbing for added context!
This will be the Agent Chat component! With this component, you will be prompted to set up and agent and its tools. There is also AI chat for helping you build out these tools!
I recorded this video of me asking the agent to build a custom tool, it then created a workflow tool where I then created a query block to grab some google sheet data.
Once that custom tool is set up, you can ask the agent chat about the google sheet table data and it should be able to identify that it should use the custom tool, use that tool to grab the right sheet (either have params or hardcode this into the workflow in the custom tool) and then get that data and reference it as if it was just reading from that table component
We are working on making this simpler by opening up the context of app state that agents have access to but that is still in the works!