#automating booking flow

35 messages · Page 1 of 1 (latest)

rotund fractal
#

i have an idea but am not sure how to implement it. i have built a service booking platform and now want to automate the booking process using ai to make it easier for users

i am thinking of using the groq api since it is free with some limits which is fine for now. the system has three modules: tradesmen, services, and time slots. each tradesman has services representing their skills

the flow is when a user starts chatting with the bot it asks what service they need. the bot looks at the services we offer. i plan to create an api that returns all service names and pass them to the ai as a variable in the prompt. the main challenge is keeping context. after asking for the service the user describes the problem. the ai matches it with available services and then asks for preferred date and time

the main issue is storing this information. i want the selected service, date, and time saved so later when we ask if the user wants automatic booking or manual selection we already have the details

if the user chooses automatic booking i want to call an api with the collected data. if manual selection is chosen i want to redirect them to a page to pick a tradesman

i am confused about how to work with ai, how it should store and retrieve conversation data, where this data should live (ai context, backend session, or database), and how backend queries should be triggered based on what the ai understands

i also want to check tradesman
availability. i plan to create an api like getavailabletimeslots that checks if the tradesman is online, provides the requested service, and is not already booked at that time

if no tradesmen are available the ai should inform the user and suggest the next available time slots based on the api response

my main confusion is saving and retrieving information from the ai, running backend queries with it, and using the api responses to generate the correct message. i would really appreciate help with this thanks in advance

surreal zincBOT
#

-# LLM APIs (Claude/Gemini/GPT) @lyric trail @past crag @prime jay
-# Node.js/Bun JavaScript @flint cedar @latent rivet @prime jay

prime jay
#

i mean sounds reasonable but "backend session" and "database" should kinda mean the same thing

#

it's not a question of "is this data in the database or in the AI context"

#

The LLM is stateless so you'll have to store everything in your database. you then pass the message history to the LLM whenever you need it

#

I think it'd also make sense for you to look at "structured extraction" for your language model

rotund fractal
#

got it so now i have to save all the responses of the model with a conversation id in the db and we will tell the model to pass a flag in the response like is checking out or something so lets say the bot asks for date time and service all of that is saved in the db and when the model passes the flag we will search the specific conversation extract the date time and service from it and show a button like view tradesman or we can directly book the booking with those details is this approach good or are there any mistakes in it

#

@prime jay

prime jay
#

I mean you'll basically always have to store the conversations and then give those to the model again yeah

#

idk what you mean by "passes the flag"

rotund fractal
# prime jay idk what you mean by "passes the flag"

when we save the response there will be a field:boolean in the response object like isCheckingOut when the user says confirm booking we will set isCheckingOut to true in the response object and then trigger an api or pass a link to search for a tradesman using a custom field that works based on the response

#

that api will be called when the response contains a specific keyword which sets isCheckingOut to true in the response object

prime jay
#

right

rotund fractal
prime jay
#

From a technical side of things: Maybe, I'd probably structure it differently

From a business side of things: I don't see the point but do what you think is fun

rotund fractal
prime jay
#

I'd probably cut the AI out lol I recently switched my booking service because they wanted to add some stupid AI chat

#

the one I use now (also much bigger) just has a dropdown with available timeslots + services so I can just click and confirm

rotund fractal
#

Well that's exactly how things are working in my project right now

#

I am just planning how I can make it much easier and also get good hands-on experience with AI

prime jay
#

Ye I find AI to be more of a hindrance for that use-case

rotund fractal
prime jay
#

so first you'd have to figure out how the merchants tell you their availability

#

that's the first important part

rotund fractal
#

on their profile they have an option to go offline which is the first thing

second when a booking is confirmed a time slot is created that includes the date time tradesman and service so i can run a query in the time slots module to retrieve the available time slots

prime jay
#

I mean going offline is for "right now"

But those timeslots only tell you when someone else from the platform has already booked that merchant

#

you'll probably want them to have a general availability? Unless it's literally chatting to the merchant -> takes longer to book anyway

#

thought your goal was to just have a user pick a time and then book that

rotund fractal
#

got it i will let merchants set their general availability for example a security guard can be available at night. users can pick a time and book automatically chat will be optional and only available when the merchant is available. the system can also auto assign the merchant without any chat if the user chooses

rotund fractal
#

@surreal zinc Summarize only the AI flow we discussed, focusing on the isCheckingOut logic and how that process works step by step.

surreal zincBOT
#

-# Writing a response for "Summarize AI flow focusing on isCheckingOut logic"

#

The AI flow for checking out in the booking system involves several steps to validate and confirm a user's booking.

  1. Initiate Checkout: The user expresses intent to book or finalize their selection.
  2. isCheckingOut Flag: A flag, isCheckingOut, is set to true to indicate that the user is in the process of completing a transaction. This prevents other concurrent booking actions or modifications.
  3. Data Validation: The system validates all selected booking details (dates, times, services, user information, etc.) against available inventory and business rules.
  4. Payment Processing (if applicable): If payment is required, the system initiates the payment gateway interaction.
  5. Confirmation Generation: Upon successful validation and payment, a confirmation is generated.
  6. isCheckingOut Reset: The isCheckingOut flag is reset to false once the checkout process is complete (either successfully or failed).

This isCheckingOut logic ensures data integrity and a smooth, uninterrupted checkout experience by temporarily locking the booking state.

rotund fractal
#

@surreal zinc relate it with the chat module

surreal zincBOT
#

-# Writing a response for "Relate isCheckingOut logic with chat module"

#

The isCheckingOut flag indicates a user is finalizing a booking. When true, it means a critical transaction is in progress, so chat interactions need careful management.

How it relates to the chat module:

  1. Temporary Disablement: While isCheckingOut is true, chat might be disabled or read-only to prevent interference with the checkout.
  2. Merchant Availability: Chat is only active if the merchant is available. This check works alongside isCheckingOut.
  3. Data Integrity: Disabling chat during checkout ensures booking details aren't compromised.
  4. User Experience: Focused checkout without chat distractions. Chat can re-enable post-checkout.

Essentially, isCheckingOut acts as a gatekeeper, ensuring chat doesn't disrupt the critical checkout process. If the merchant isn't available, chat is off regardless of the checkout status.