GastroMóvil ships an AI-powered menu assistant that lets customers ask natural-language questions about available dishes, filter by restaurant or category, and request a surprise recommendation. The chatbot is backed by LangChain’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/lffiesco-svg/gastromovil/llms.txt
Use this file to discover all available pages before exploring further.
ChatGroq integration pointing at Groq’s Llama 3.3 70B Versatile model. On each request the backend fetches all available products from the database, formats them into a structured prompt context, and forwards the conversation — including the last six exchanges — to the model.
Architecture Overview
LLM Configuration
The model is initialised once at module load time inchatbot/ai/chatbot.py:
temperature=0.5 balances consistency (low temperature) with enough variability to make recommendations feel natural rather than robotic.Product Context Building
Before calling the LLM,construir_contexto_productos() converts the database result set into a plain-text block. Optional categoria and restaurante parameters filter the list first:
Request & Response Format
Request Payload
| Field | Type | Required | Description |
|---|---|---|---|
mensaje | string (max 500) | ✅ | The user’s current message |
historial | array of {role, content} objects | ❌ | Previous conversation turns; last 6 are kept |
categoria | string | ❌ | Filter products to this category name |
restaurante | string | ❌ | Filter products to this restaurant name |
Normal Response
respuesta value is HTML styled with Tailwind CSS classes, as instructed by the system prompt. The frontend renders it directly as inner HTML.
Conversation History
Theresponder_chat function prepends SystemMessage(content=SYSTEM_PROMPT) and then appends the last 6 messages from historial as alternating HumanMessage / AIMessage objects before appending the current user message:
Surprise Mode
If the user’s message contains any of the trigger words —sorpréndeme, sorprendeme, recomiéndame, recomiendame, or sorpresa — the chatbot switches to surprise mode:
Pick a Random Product
random.choice(productos) selects one product from the full available list (no category or restaurant filter is applied in surprise mode).Ask the LLM for a Short Reason
responder_razon(producto) sends a focused prompt to the LLM asking for a maximum of 20 words explaining why the user should order this dish:"modo": "sorpresa" key in the parsed JSON and renders a product card rather than the standard HTML chat bubble.
System Prompt Behaviour
TheSYSTEM_PROMPT in chatbot/ai/prompts.py constrains the model’s behaviour in several important ways:
What the chatbot CAN do
What the chatbot CAN do
- List available products and their prices
- Tell the user which restaurant a product belongs to
- Filter by category, restaurant, or price range
- Give recommendations based only on the product list passed in context
- Use product descriptions to add context to answers
What the chatbot CANNOT do
What the chatbot CANNOT do
- Take orders, confirm purchases, or process payments
- Invent products, prices, restaurants, or URLs not present in the context
- Answer questions about topics unrelated to the menu
Response format rules
Response format rules
The model is instructed to respond exclusively in HTML with Tailwind CSS classes, never in Markdown. Product mentions must follow a specific
<div> template that includes the product name, price, restaurant name, and an orange CTA button linking to the restaurant page. Plain text uses <p class="text-gray-700">.Error Handling
If the Groq API call raises an exception (network error, rate limit, etc.),responder_chat catches it and returns a safe fallback string:
responder_razon falls back to a generic phrase: