Need some help regarding best practices for my use case


Let’s say we’re trying to build a recommendation system for users visiting a grocery store. We have all items in our grocery store in a database(total number of items in the store won’t be more than 500).
I want to build a chatbot that could help visiting customers select out of these items based on their queries. What would be the best approach for this use case?

  1. Using promt engineering to pass the entire items list on every query to OpenAI
  2. using a fine-tuning model
  3. using SQL agent to fetch data
  4. or some other way

I’m very new at OpenAI, so any help would be appreciated. TIA

Hi! Welcome to the community!

Did you plan out any use case scenarios on how exactly you’d expect this interaction to work? What kind of queries are you expecting?


The queries could be something like this -

  1. Recommend some milk based products to me
  2. how much does a pack of eggs cost
  3. I need to make pasta today, what items would I require

Basically, the chat assistant should be able to look up the items of my store and answer any questions related to those. Should be able to handle simple questions for now.

1 and 2 are trivial, 3 is a can of worms.

Using query generation is probably your best bet in general (although I’m not sure about SQL generation by user-facing bots. Sounds like an express train to Pwn-Town unless you’re a super seasoned db administrator.)

You could also use RAG to store topical example queries to improve your first time hit rate :thinking:

I’m a bit skeptical with SQL query generation based on user inputs.
What is you opinion about passing the entire list of items in the prompt itself and asking the model to answer based on that?
How would that be compared to the SQL approach in terms of cost/speed efficiency?

It’s probably doable, but will likely eat into your API costs. You may run into trouble if you have lots of similar items, but it depends on what data you’re working with.

That said, you can just try this approach with a custom GPT or assistant, and see how far it gets you. Pretty low risk prototype.

1 Like