Hi,

I’m planning on using AI to auto-categorize user submitted content so that new submissions come in with the correct category. I have the System and User prompt and I am planning to use the API connector to make the AI service call.

The issue is I have a ton of categories, and they will change over time (weekly). I am considering hard coding them into the system prompt, but I prefer to load them once per week from the database.

It seems Do A Search For doesn’t have a get cached values option. I could engineer something external to make a call into my site once per week, and then serve up the categories as an external API, and use that. But, I’m looking for an elegant, Bubble way to inject dynamic categories into my AI system prompt.

Any recommendations?

Thank you.

If you have a field to show which categories are active, just Do a search for Categories (active = yes):format as text

For now, I’m taking the following approach:

  • Use a Cache data type to store the results of a backend workflow getting the categories and fields I need.
  • Have a backend workflow that periodically updates the cache table with the latest categories.

This way I can just do a search for the cache values from the cache table and not have to worry about performance and burning through work units.

Is there a better way to do this?

Where are your categories coming from? Why not just store them in your Bubble database? If they’re coming from an external database, make the request to them whenever you make an AI API call and inject them into the system prompt. If storing in Bubble, provide them using a database search.