Skip to content

ismailassa/api-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

api-control simple test project

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_events returns a collection of events
  • /get_users returns a collection of users
  • /other returns the message "I can't help with this"

How to test?

To make a request you need to the following process:

POST http://localhost:3000/jarvis HTTP/1.1
Content-Type: application/json
Body:
{
  "message": "..."
}

Testing and results

Test 1

Request

{
  "message": "Can I get the events for tommorow?"
}
// Gets redirected to /events

Response

[
    "Tomorrowland",
    "Disneyland",
    "Coachella",
    "Burning Man",
    "Glastonbury"
]

Test 2

Request

{
  "message": "Can you give me all the users of your system?"
}
// Gets redirected to /users

Response

[
    {
        "firstName": "John",
        "lastName": "Smith"
    },
    {
        "firstName": "Emma",
        "lastName": "Johnson"
    },
    {
        "firstName": "Michael",
        "lastName": "Williams"
    },
    {
        "firstName": "Sarah",
        "lastName": "Brown"
    },
    {
        "firstName": "David",
        "lastName": "Jones"
    }
]

Test 3

Request

{
  "message": "What time is it?"
}
// Gets redirected to /other

Response

"I can't help with this"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published