This project aims to build a Conversational Agent with a memory microservice using OpenAI's GPT-3.5 and FastAPI. The agent is designed to overcome the limitations of traditional chatbot implementations by retaining context during conversations. This is particularly useful in microservice architectures and container orchestration systems like Kubernetes, where services frequently restart, update, and scale.
Conversational Agents are increasingly becoming essential in various applications like customer support, virtual assistants, and information retrieval systems. However, most traditional chatbots lack the ability to maintain context in ongoing conversations, leading to a disjointed and frustrating user experience. This project aims to solve this problem by adding a memory microservice to the conversational agent.
The project is motivated by the need to improve the capabilities of conversational agents, especially in complex environments like Kubernetes. In such systems, microservices are often subject to frequent restarts, updates, and scaling operations. These events can disrupt the state of ongoing conversations in traditional chatbot implementations. By adding a memory microservice, this project aims to preserve the state of conversations, allowing for more natural and continuous interactions.
- OpenAI GPT-3.5: Used for natural language processing tasks, including text generation, conversation management, and context retention. You will need to generate an OpenAI API Key for this.
- FastAPI: Serves as the backbone of the microservice, handling HTTP requests, managing conversation states, and integrating with the OpenAI API.
- Clone the GitHub repository
- Install the required packages using
pip install -r requirements.txt
- Generate your OpenAI API Key and add it to the configuration
- Run the FastAPI server
Once the server is up and running, you can interact with the conversational agent through HTTP requests. The memory microservice will ensure that the context of the conversation is maintained even if the microservice restarts or updates.
Special thanks to Cesar Flores and Towards Data Science for the original tutorial and inspiration for this project. I have made many modifications and additions to the original code, but the core idea remains the same.