Building an HR-bot Using ChatGPT

Discover how an HR chatbot streamlines employee record management and simplifies HR processes.

·

6 min read

Play this article

This article summarizes the talk by the ChatGPT challenge winners at GeekyAnts. They explain their OpenAI-powered HR bot that simplifies employee record management and empowers employees to access the necessary information without relying on HR.

Introduction

We created an HR chatbot as part of the ChatGPT challenge. This article will discuss how we built the bot, the different factors we considered, the features we have implemented, and how it works. As the name suggests, the bot is related to HR. Specifically, it involves tasks where employees can connect with HR to perform certain operations on employee records and other related tasks.

What is Our HR bot About?

Our HR bot is an innovative solution designed to simplify employee record management and provide assistance with employee queries. It consists of two main components: policy-based queries and administrative tasks and queries.

With our policy-based queries, you can easily search for information related to various policies in our organization, such as leaves, payrolls, or travel policies. These policies can often be quite lengthy and challenging to navigate. Our bot streamlines the process by swiftly searching the entire document to find the specific information you need, saving you time and effort.

Our bot's administrative tasks and queries section is here to help with tasks like updating employee information or answering general queries. This empowers employees to access the information they need without relying on HR, making the process more efficient for everyone involved.

Overall, our HR bot is a valuable tool for managing employee records and promptly addressing employee queries. It's a win-win for HR and employees alike!

The Tech Stacks Involved

Let's look closer at the technology stack behind our HR-bot application. For the frontend, we utilized Nuxt.js, a powerful framework, and Vuetify, a component library built on MaterialUI, seamlessly integrating with Nuxt.js. We initially planned to use Node.js on the backend for a monolithic application. However, we faced challenges, leading us to adopt a microservice architecture. As a result, we incorporated Node.js with Express and Python with Flask for our microservices. Additionally, we leveraged LangChain, an OpenAI framework, to simplify embedding processes and related tasks.

To handle our database needs, we employed PostgresSQL. Throughout the development process, we encountered scenarios requiring database manipulation and validation. To streamline these processes, we integrated Hasura into our application.

How Does The Application Work?

Screenshot 2023-06-30 at 3.48.12 PM.png

Microservices Architecture

Curious about how our HR bot works? Let's take a closer look at its architecture. Our application is built using a microservices approach. The first microservice is responsible for the front end, while the second microservice, implemented in Node.js, connects to the database and handles requests. The Flask Service, our third microservice, handles the queries, while the Node.js service manages administrative tasks.

Screenshot 2023-06-30 at 3.48.36 PM.png

Builder Backend Service and OpenAI Interaction

Regarding query endpoints, we have a Python-based builder service in place. It receives the query endpoint request, performs a similarity search on the stored vector, and forwards the query to OpenAI via Langchain. OpenAI then resolves the query, and the answer is sent back to the users.

Screenshot 2023-06-30 at 3.49.20 PM.png

Node.js Backend Service and OpenAI Interaction

For administrative tasks and operations, the Node.js service plays a crucial role. When a query request is made, it is directed to the Node.js service. For tasks like database reads or operations, the service maintains the database schema and communicates with OpenAI. The ChatGPT model resolves the query schema and provides specific SQL queries. LangChain provides SQL agents that run on Node.js to manipulate the database when necessary.

Some Challenges Encountered

During the development process, we faced certain challenges that we'd like to share with you. Here are some of the key hurdles we encountered:

  • Security Concerns: We explored unconventional approaches, such as sending document embeddings to OpenAI for questions and providing direct access to our database for data manipulation. While these approaches have their merits, they also raise security concerns. Directly granting AI access to sensitive organizational data is not recommended.

  • Newness of OpenAI APIs: As developers, we encountered the novelty of OpenAI APIs. While they offer incredible features and utility, community support and familiarity with OpenAI integrations are still emerging. OpenAI frequently releases new features, such as their plugins, which are beneficial but require time and effort to understand and utilize effectively.

  • Creating Two Microservices: To ensure language support, we leveraged the LangChain framework. Although available in both JavaScript and Python, we found the Python version to be more stable. Consequently, we created two separate microservices—one in Python and one in JavaScript—to harness the strengths of both languages. Python boasts improved documentation and a user-friendly interface. However, the JavaScript version is still in the static phase and lacks certain functionalities.

  • Security Threats and Privacy Concerns: As previously mentioned, granting direct access to our documents or databases to AI raises security and privacy concerns, given the sensitive nature of the data involved.

Future Scope of Our Application

We have exciting plans for the future of our HR-bot application. Here's a glimpse of what you can expect in version 2:

  • Role-Based Access Control (RBAC): We aim to implement RBAC, which will provide granular control over administrative tasks. Logging in as an HR Manager won't automatically grant permission for every administrative task. Instead, access will be role-specific, ensuring that only authorized personnel can perform specific tasks. RBAC enhances security and streamlines task delegation.

  • Manual Confirmation for DML Operations: We plan to replace direct Data Manipulation Language (DML) operations with fetching queries that require manual confirmation from HR. For instance, if HR wishes to change an employee's reporting manager, the system won't directly update the record. Instead, it will seek confirmation from HR in plain language, describing the intended action. HR must confirm before the operation is executed. This extra layer of confirmation enhances data security and prevents unintended changes.

  • Third-Party Integrations: We recognize the value of third-party integrations. Integrating popular platforms like Google Calendar, Google Meet, or Slack bot would enable seamless notifications and interactions. Employees could receive Slack notifications about reporting manager changes or email notifications via Google Mail for one-on-one meetings scheduled by HR. We plan to integrate with various third-party platforms, ensuring you receive notifications and invitations directly through your preferred channels.

Conclusion

Our HR bot is a powerful tool designed to simplify employee record management and provide efficient assistance with employee queries. By incorporating policy-based queries and administrative tasks into a single application, we have created a comprehensive solution that benefits HR and employees. By continuously improving and expanding our HR bot, we aim to create a valuable resource for organizations to streamline HR processes, improve employee satisfaction, and enhance overall operational efficiency. With its user-friendly interface and powerful capabilities, our HR bot is poised to make a significant impact on human resources.


This article was written by Prajjwal AroraSoftware Engineer - II, Rajeev MohanSoftware Engineer - I, Priyanshu SinghSoftware Engineer - I, and Nilesh Kumar, Software Engineer - I, for the GeekyAnts blog.