Skip to main content

Documentation 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.

The Chatbot API exposes a single public endpoint that accepts a natural-language message and returns a response generated by Llama 3.3 70B running on Groq. On each request the server queries the database for all currently available (disponible=True) products and injects them as context into the system prompt, so the model always reasons over live menu data. An optional conversation history lets the model maintain context across multiple turns. The endpoint requires no authentication — it is accessible to any visitor.
The server requires the GROQ_API_KEY environment variable to be set. If the variable is missing or invalid, the LLM call will fail and the endpoint returns the error string "Error al procesar tu consulta. Intenta de nuevo mas tarde." with a 200 OK status.

Send a Chatbot Message

POST /api/chatbot/

Request Body

mensaje
string
required
The user’s message or question (max 500 characters). Natural language questions about the menu, prices, ingredients, or availability are all valid. Special trigger words (see Surprise Mode below) activate a different response format.
historial
array
Optional conversation history to maintain multi-turn context. Each element is an object with role ("user" or "assistant") and content (the message text). The server uses only the last 6 entries to stay within Groq token limits — pass a rolling window from your client.
[
  { "role": "user", "content": "¿Tienen hamburguesas?" },
  { "role": "assistant", "content": "Sí, tenemos la Burger Clásica a $18,500." }
]
categoria
string
Optional category name filter. When provided, only products whose categoria__nombre matches this string (case-insensitive) are included in the LLM context. Useful for narrowing recommendations to a specific menu section.
restaurante
string
Optional restaurant name filter. When provided, only products from the matching restaurant are injected into the LLM context.

Normal Response

For most messages the endpoint returns a plain text LLM response.
curl -s -X POST https://gastromovil.online/api/chatbot/ \
  -H "Content-Type: application/json" \
  -d '{
    "mensaje": "¿Qué platos recomiendas para dos personas?",
    "historial": [],
    "restaurante": "Beer & Grill"
  }'
200 OK
respuesta
string
The chatbot’s natural-language answer based on the live product data and the provided conversation history.
{
  "respuesta": "Para dos personas te recomiendo la Burger Clásica ($18,500) y las Papas Fritas ($8,000) de Beer & Grill. ¡Es una combinación perfecta para compartir! 🍔🍟"
}

Surprise Mode

When the mensaje field contains any of the following trigger words (checked case-insensitively), the server bypasses the normal LLM flow, selects a random available product, asks the model for a short appetising reason to order it, and returns a structured JSON payload embedded inside the respuesta string. Trigger words: sorpréndeme, sorprendeme, recomiéndame, recomiendame, sorpresa

Example Request

curl -s -X POST https://gastromovil.online/api/chatbot/ \
  -H "Content-Type: application/json" \
  -d '{"mensaje": "sorpréndeme con algo rico"}'

Surprise Response

200 OKrespuesta is a JSON string. Parse it to extract the product card data.
respuesta
string
A JSON-encoded string containing the surprise product details. Deserialize this string to read the individual fields below.
{
  "respuesta": "{\"modo\": \"sorpresa\", \"producto_id\": 14, \"nombre\": \"Burger Clásica\", \"precio\": \"18500.00\", \"restaurante\": \"Beer & Grill\", \"descripcion\": \"Carne de res 200g, lechuga, tomate y salsa especial.\", \"url\": \"http://localhost:8000/restaurantes/restaurante/3/#cat-2\", \"imagen\": \"http://localhost:8000/media/burger_clasica.png\", \"razon\": \"Jugosa y con la sazón perfecta, no podrás comer sólo una.\"}"
}
In your frontend, detect surprise mode by checking whether JSON.parse(respuesta).modo === 'sorpresa' before rendering. For a standard response the parse will fail or return a string, which you can display directly.

Error Response

If the Groq API call fails for any reason (network error, invalid key, rate limit), the endpoint still returns 200 OK with the following body instead of propagating an exception.
{
  "respuesta": "Error al procesar tu consulta. Intenta de nuevo mas tarde."
}

Multi-turn Conversation Example

The following example shows how to maintain a conversation across two turns. Pass the previous exchange back in historial on the second request; the server caps to the last 6 messages before sending to Groq.
# Turn 1
curl -s -X POST https://gastromovil.online/api/chatbot/ \
  -H "Content-Type: application/json" \
  -d '{
    "mensaje": "¿Tienen algo vegetariano?",
    "historial": []
  }'

# Turn 2 — include the first exchange in historial
curl -s -X POST https://gastromovil.online/api/chatbot/ \
  -H "Content-Type: application/json" \
  -d '{
    "mensaje": "¿Y tiene gluten?",
    "historial": [
      { "role": "user", "content": "¿Tienen algo vegetariano?" },
      { "role": "assistant", "content": "Sí, tenemos la Ensalada Mediterránea ($12,000)." }
    ]
  }'

Environment Variable

The chatbot requires exactly one environment variable to be configured on the server:
VariableDescription
GROQ_API_KEYAPI key issued by console.groq.com. Required for all LLM calls.
Never expose GROQ_API_KEY in client-side code or version control. All LLM requests are proxied through the GastroMóvil backend — the key is only used server-side.

Build docs developers (and LLMs) love