My goal was to show that you could trigger specific API calls depending on the message you wrote.
This is a really simple test where we have 4 different endpoints:
First, the /jarvis endpoint is a POST and mimics the chatbot layout you have when communicating with an LLM.
Secondly you have the endpoints /get_events, /get_usersand /other
/get_eventsreturns a collection of events/get_usersreturns a collection of users/otherreturns the message "I can't help with this"
To make a request you need to the following process:
POST http://localhost:3000/jarvis HTTP/1.1
Content-Type: application/json
Body:
{
"message": "..."
}
Request
{
"message": "Can I get the events for tommorow?"
}
// Gets redirected to /eventsResponse
[
"Tomorrowland",
"Disneyland",
"Coachella",
"Burning Man",
"Glastonbury"
]Request
{
"message": "Can you give me all the users of your system?"
}
// Gets redirected to /usersResponse
[
{
"firstName": "John",
"lastName": "Smith"
},
{
"firstName": "Emma",
"lastName": "Johnson"
},
{
"firstName": "Michael",
"lastName": "Williams"
},
{
"firstName": "Sarah",
"lastName": "Brown"
},
{
"firstName": "David",
"lastName": "Jones"
}
]Request
{
"message": "What time is it?"
}
// Gets redirected to /otherResponse
"I can't help with this"