AI
The AI module provides RAG-grounded chat completions, intent detection, and conversation threading for property-specific guest interactions. Every response is grounded in your property's knowledge base — menus, policies, FAQs, and SOPs indexed via the Knowledge Base module.
How a chat turn works
- 1. Receive — User message arrives via
POST /v1/ai/chat. - 2. Retrieve — Last user message is embedded and matched against the property's Pinecone namespace. Top-k chunks selected.
- 3. Ground — Retrieved chunks are injected into the system prompt as structured property context.
- 4. Generate — GPT-4o-mini completes the turn with grounded, property-specific knowledge.
- 5. Detect — Intent classification runs on the user message. Detected intents are stored and trigger webhooks.
- 6. Persist — Turn stored to conversation thread. Sources returned in response.
Endpoints
/v1/ai/chatRAG-grounded chat completionSubmit a conversation turn. Returns an assistant message grounded in the property knowledge base, with detected intent and source citations.
Request Body
messagesChatMessage[]requiredFull conversation history. Last message must be role=user.guest_idstringAssociate this turn with a known guest (gst_...). Optional.conversation_idstringContinue an existing thread. Omit to start a new conversation.channelstringOrigin channel: web_chat, voice, widget, api. Default: api.use_knowledgebooleanQuery the knowledge base to ground the response. Default: true.top_kintegerNumber of knowledge chunks to inject. Range 1–10. Default: 4.curl -X POST https://api.escapelife.ai/v1/ai/chat \
-H "Authorization: Bearer sk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{ "role": "user", "content": "What spa treatments do you offer, and what is the price for a deep tissue massage?" }
],
"channel": "web_chat"
}'{
"conversation_id": "cvs_9xk2mp7q",
"message_id": "msg_r4t5y6u7",
"role": "assistant",
"content": "We offer a range of spa treatments at Grand Sunset Resort. Our Deep Tissue Massage runs 90 minutes and is priced at $200 — it's ideal for targeting chronic muscle tension. We also offer a Swedish Massage (60 min, $150), Hot Stone Therapy (75 min, $175), and a Couples Retreat in our private suite (90 min, $320 per couple). Would you like to schedule an appointment?",
"intent": {
"intent": "upsell",
"confidence": 0.80
},
"sources": [
{
"source_id": "ks_abc123",
"source_name": "Spa Treatment Menu — Spring 2026",
"source_type": "menu",
"score": 0.94
}
],
"created_at": "2026-03-15T10:00:01Z"
}curl -X POST https://api.escapelife.ai/v1/ai/chat \
-H "Authorization: Bearer sk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"conversation_id": "cvs_9xk2mp7q",
"messages": [
{ "role": "user", "content": "What spa treatments do you offer?" },
{ "role": "assistant", "content": "We offer a Deep Tissue Massage (90 min, $200)..." },
{ "role": "user", "content": "Can I book the couples retreat for tomorrow evening?" }
],
"guest_id": "gst_a1b2c3d4e5f6"
}'/v1/ai/conversations/{conversation_id}Get a conversationRetrieve conversation metadata — channel, status, guest association, and timestamps.
Path / Query Parameters
conversation_idstringrequiredConversation ID (cvs_...)./v1/ai/conversations/{conversation_id}/messagesList conversation messagesReturn all turns in a conversation thread, ordered chronologically. Includes source citations on assistant messages.
Path / Query Parameters
conversation_idstringrequiredConversation ID (cvs_...).Intent detection
Intent is detected automatically on every user message. When a non-general intent is detected, a GuestIntent record is persisted and a guest.intent.created webhook is fired.
bookingbook, reserve, check-in, availability, dates
service_requestneed, request, bring, fix, broken, housekeeping
complaintdisappointed, problem, issue, unacceptable
upsellupgrade, spa, dinner, experience, add-on
itinerarywhat should I do, schedule, plan, recommend
local_recommendationrestaurant, bar, beach, hike, nearby, local
generaleverything else (no webhook fired)
Model configuration
gpt-4o-minitext-embedding-3-small8000.4top_k (default 4)Per property_id — cross-property retrieval is blockedWebhooks fired by this module
guest.intent.createdA non-general intent was detected from a conversation turn.
conversation.closedA conversation thread was marked closed.