Function Composition
Learn about function composition and how it works to create seamless, multi-step commerce interactions.
Function composition is the process of combining multiple functions to create a new, cohesive workflow. This involves defining the inputs and outputs of each function and how they interact with each other. The design of these functions is crucial for both the user experience and the model’s ability to generate the correct output.
Finding the Perfect Car
Using Drivly’s Concierge API, let’s walk through a complex car-buying scenario where various functions work together to meet specific customer needs, and incorporating additional service workflows.
In this guide, we’ll follow an example customer request:
I need a new big car. Requirements are:
- Drive cross-country, quickly and reliably, twice a year.
- Seat 6+ people fairly often.
- REAL off-road capability.
- Excellent driver assist/“self driving” technology.
Key Functions
Function | Description |
---|---|
searchListings | Searches for available cars based on user preferences. |
lookupVehicleDetails | Retrieves detailed information about a specific car. |
scheduleTestDrive | Schedules a test drive for the selected car. |
buyVehicle | Finalizes the purchase of the car. |
submitCreditApplication | Submits a credit application for financing. |
addVscProduct | Adds a Vehicle Service Contract (VSC) from Drivly F&I products. |
arrangeTransport | Arranges transport and delivery for the vehicle. |
Interactions
By leveraging Drivly’s AI functions you can provide a powerful experience with dynamic intent handling, and key service integrations. Ultimately providing a complete customer journey – from finding the perfect car, to driveway delivery.
<User>: "I need a new big car. Requirements are: drive cross-country, seat 6+, real off-road capability, excellent driver assist."
<Function>: `searchListings({ "requirements": ["cross-country", "6+ seats", "off-road", "driver assist"] })`
<Model>: "Here are some cars that match your requirements: Toyota Land Cruiser, Ford Expedition, Tesla Model X."
<User>: "Tell me more about the Toyota Land Cruiser."
<Function>: `lookupVehicleDetails("Toyota Land Cruiser", "[features...]", "[reviews...]", "[specs...]")`
<Model>: "The Toyota Land Cruiser has these features: [detailed features...]"
<User>: "I want to schedule a test drive for this Saturday."
<Function>: `scheduleTestDrive("Toyota Land Cruiser", "Saturday", "[location...]")`
<Model>: "Your test drive is scheduled for Saturday. Would you like to proceed with a purchase if you like the car?"
<User>: "Yes, if I like how it drives, I'm buying it."
<Function>: `buyVehicle("Toyota Land Cruiser", "after test drive")`
<Model>: "Great! Let me know how the car drives afterwards and we can start the purchase."
<User>: "Test drive went well. I loved the car and want to finance it."
<Function>: `submitCreditApplication("Doug DeMiro", "Toyota Land Cruiser", "[VIN]", "[...]")`
<Model>: "Thanks Doug! Your credit application has been submitted. Do you want to add any F&I products, like a Vehicle Service Contract (VSC)?"
<User>: "Yes, add the VSC to my purchase. I want all the options."
<Function>: `addVscProduct("VSC", "BestVscPackage", "Toyota Land Cruiser", "[terms...]")`
<Model>: "The VSC has been added to your purchase. Would you like me to ship the vehicle to your home address?"
<User>: "That would be perfect. Pleae arrange transport to my home address."
<Function>: `arrangeTransport("Toyota Land Cruiser", "Doug DeMiro", "123 Bay Beach lane", "Arrive in 5 days")`
<Model>: "Done! Transport and delivery has been arranged. Your vehicle will be there in 5 business days."
...