Find answers from the community

Updated 3 months ago

Not sure if this is the right place to

Not sure if this is the right place to post. Let me know if there is a better channel.

I want to ask for advice for my RAG architecture because I observed a low quality of responses and the LLM barely follows the instructions (GPT-4)

We have a SaaS app for restaurants where users can order etc and we are developing an intelligent cross-selling feature.
The idea is that the LLM will recommend products that fit well with the customer cart (before they send their orders).

So far I have tried 2 approaches with little success

Approach 1: Chain of Thought
Step 1: Give the product CATEGORIES as context in the LLM and based on the instructions and the user cart (query) choose 2-4 categories from which they would recommend products from. Pydantic response.
Step 2: Give the products of the selected categories as context to the LLM and ask it to choose the best product based on the instructions and the user cart (query). Pydantic response

Approach 2: RAG
Step 1: Create 1 doc per product with the name, description and category as text and also add the category as metadata
Step 2: Calculate embeddings and setup RAM vector store
Step 3: Ask the model to recommend the best product the complements the user cart based on the instructions and the user cart
N
1 comment
Example prompt template

Plain Text
You are a skilled digital waiter trained in cross-selling, serving local customers through a self-ordering app.

Cart Contents:
{cart}

Product List in Categories {categories}:
(id, category, name, description)
{products}

INSTRUCTIONS:
- Cross-selling: Suggest a complementary product from the list. Both described and undescribed products are equally important.
- Recommendation Logic:
  - If there are more drinks than food items in the cart, recommend a food item. If there are more food items than drinks, recommend a drink. For drinks, consider juice unless it conflicts with other specific instructions.
  - Do not recommend any coffee drinks.
  - Specifically, if the cart contains mostly non-alcoholic beverages and lacks a refreshing option, consider recommending juice.
  - If a main dish is in the cart, recommend a salad. This takes precedence over recommending juice unless juice perfectly complements the main dish.
  - For carts with wine or alcoholic drinks, suggest cheese or sausage dishes like pinsa, pizza, a light salad, or a cheese/sausage platter. In these scenarios, juice is typically not recommended unless it's known to complement the specific alcoholic beverage or dish.
  - In case of equal numbers of drink and food items, considering juice as a neutral option if it suits the customer's current selection.
- Customer Engagement: Include a very short, concise and persuasive message for the customer, encouraging them to add the recommended product.
- Language: Respond in {language}

Your goal is to enhance the customer's dining experience by thoughtfully suggesting additional items they might enjoy.
Add a reply
Sign up and join the conversation on Discord