Enterprise AI Hub: LLM AI Agent built with OpenAI & Java
Tags: development, ai, openai
Published: 2024-04-13 12:40:51

## Overview
This is live product based on OpenAI + Spring and Tools4AI. Please look at my previous articles to learn more about LLM Agents, Autonomous Agents and Function calling. In this article I will be demonstrating a fully working working version of enterprise autonomous agent
 
## Enterprise AI Hub

Fully working product is deployed [here](https://huggingface.co/spaces/VishalMysore/EnterpriseAIHub)

The enterprise AI Hub, a sophisticated Large Language Model (LLM) Agent or Large Action Model Agent, functions as a central intelligence system. It is meticulously integrated with an array of enterprise applications, including a pet store, bookstore, service management system, bug tracking system, and employee management system. Crafted entirely in Java and utilizing OpenAI's capabilities, this hub stands as a testament to the versatility and power of modern AI technologies in enterprise applications.

The configurations are present [here](https://huggingface.co/spaces/VishalMysore/EnterpriseAIHub/blob/main/swagger_actions.json)

As you can see from configuration the hub is connected to Petstore, Bookstore, and a bugs and ticketing system , you can visit the respective swagger url to look at the apis they expose via REST Calls

```java
{
  "endpoints" : [
    {
      "swaggerurl": "https://fakerestapi.azurewebsites.net/swagger/v1/swagger.json",
      "group": "Books Author Activity",
      "description": "This is for all the actions related books , Authors, photos and users trying to read books and view photos",
      "baseurl": "https://fakerestapi.azurewebsites.net/",
      "id": "fakerestapi"
    },
    {
      "swaggerurl": "https://petstore3.swagger.io/api/v3/openapi.json",
      "baseurl": "https://petstore3.swagger.io/",
      "group": "Petstore API",
      "description": "This is for all the actions related to pets",
      "id": "petstore"
    } ,
    {
      "swaggerurl": "https://vishalmysore-instaservice.hf.space/v3/api-docs",
      "baseurl": "https://vishalmysore-instaservice.hf.space/",
      "group": "Enterprise Support and Tickeing System",
      "description": "This action is to create tickets track bugs across the enterprise",
      "id": "InstaService"
    }      
  ]
}
```

he central hub can be tested using simple prompts - test it using [this url ](https://huggingface.co/spaces/VishalMysore/EnterpriseAIHub)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rkv4604ixzs8k827sfy3.png)

## /getAllGroupNames
Provides the list of all the enterprise systems connected to this hub, (these are your ticketing system, employee management system , HR system) basically any system exposing REST API

```java
[
  {
    "groupName": "default",
    "groupDescription": "group for all the tasks"
  },
  {
    "groupName": "Books Author Activity",
    "groupDescription": "This is for all the actions related books , Authors, photos and users trying to read books and view photos"
  },
  {
    "groupName": "Petstore API",
    "groupDescription": "This is for all the actions related to pets"
  },
  {
    "groupName": "Enterprise Support and Tickeing System",
    "groupDescription": "This action is to create tickets track bugs across the enterprise"
  }
]
```

## /getAllActionsForGroup
This REST api provides all the actions associated with that application if you trigger with groupName = Petstore API , you get this result

```java
updatePet,addPet,findPetsByStatus,findPetsByTags,getPetById,updatePetWithForm,deletePet,uploadFile,getInventory,placeOrder,getOrderById,deleteOrder,createUser,createUsersWithListInput,loginUser,logoutUser,getUserByName,updateUser,deleteUser
```

## /actionOpenAI

Any action can be triggered by simple English prompts
for example 
if you provide a prompt "create a ticket for me with number 1 and issue is compture not working" it will automatically create a ticket on InstaService you can view the logs here https://huggingface.co/spaces/VishalMysore/InstaService?logs=container

Try out with different prompts and validate that corresponding actions have been triggered
1) My Customer name is Vishal , his computer needs repair - will trigger this [action](https://github.com/vishalmysore/SpringActions/blob/main/src/main/java/io/github/vishalmysore/service/RaiseCustomerTicket.java)
2) Can you compare Honda City to Toyota Corolla - this prompt will trigger Car Compare [action](https://github.com/vishalmysore/SpringActions/blob/main/src/main/java/io/github/vishalmysore/service/CompareCarService.java)
3) Can i Go out without Jacket in Toronto today - This prompt will trigger weather service [action](https://github.com/vishalmysore/SpringActions/blob/main/src/main/java/io/github/vishalmysore/service/WeatherService.java)
4) what would vishal want to eat today? - this prompt will trigger this [action](https://github.com/vishalmysore/SpringActions/blob/main/src/main/java/io/github/vishalmysore/service/SimpleService.java)