OpenAI Integration - Answer question about a table isnt' work properly

I’m trying to use the OpenAI integration but I have two problems:

  1. The answers aren`t correct. I have a simple table of several events and I want that the AI select them according to question: Type, Local, date etc.
  2. The answers are truncated and doens’t show the entire answer.

Can you grab a screenshot showing us how you’ve configured it?



My app is in portuguese and the translation to the app’s text is:
Use AI to search for Event

What kind of experience do you seek in Perdizes?
Please show me all the events for next weekend.

Summer Breeze 9
Location: Latin America Memorial
Type: Festival
Date(s): 04/26/24, 04/27/24, 04/28/24
Time: From 11:00 am to 9:30 pm

Summer 9
Location: Cacilda Becker Theater
Type: Theater
Date(s): 05/21/24
Time: 9:00 pm

The translation for the “Aditional Context” is:
The Source Table contains the event schedule and its columns hold the event information, such as: name, description, event type, location, as well as times, days of the week, and dates on which these events will be held. It also indicates whether the event is free and/or for children.

The output should be ordered by the event start date and formatted as follows:

  • Event Name , should be in bold
  • Location: Event Location
  • Type: Event Type
  • Date(s): Dates in DD/MM/YY format
  • Time: Only the session time*

The output should only include events with dates after today.

So is this a sample answer that OpenAI gave you?

Yes. See that the dates are wrong because these are past events and, in this case, they didn’t trunced but show only two events but thera are much more.

I think that feature is not suited for data aggregation. They are likely to reference only X most related rows from your table, not the whole set, and then you face hallucinations like you have here.

If you can ingest the whole table’s data into the prompt, then it would make more sense.

Sorry, @ThinhDinh! I didn’t understand how to do this. Please, could you give me a example?

One way to do it could be to add a JSON template column in your data table and fill in the fields for the search.

Then from the user profile (or a one row table) add a joined list column and target the JSON template.

Finally use the joined list in a regular open AI request instead of the Answer a question about a table one.

Of course there’s a limit to how much data you can send. If your flow permits maybe you could add some custom filters to limit the number of rows in your joined list/ prompt

1 Like

To be honest, I have no idea haw to use JSON. I’ll try to find a tutorial.

Adding to the comments above:

There’s a character limit with Open AI’s API, so even if you try to cram everything in a single payload, you’re capped by the API capacity.

@Rafael_Salla_Paulilo – We have an intro to JSON post on the Glide blog. You might find it useful?

2 Likes

Yup, this is what I meant when I say “ingest the whole table”. That’s what I do for a recent app as well when “Answer question about a table” doesn’t work.

The alternative is perhaps training your own GPT, if you have the right structure for it. They are offering 1 million free tokens per day.

https://openai.com/index/gpt-4o-fine-tuning/

1 Like

Thanks! I’ll try.

I solved the problem of truncated text! If you don’t put anything in “Maximum Lenght”, they assume 255 tokens (I guess). So, the answer truncee. I put 2.000 and works perfectly.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.