Posts

Showing posts from August, 2025

Springing into AI - Part 8: Chat Memory

Image
     Welcome back. Growing up, or at some stage of your life if you ever watched Batman or numerous series and movies made of that superhero, you would have encountered the famous line being re-iterated every time " I am Batman " to criminals (Joker excluded) . Like these forgetful criminals who needed that reminder every time of his identity, when we interact with LLM's, our intelligent models also forget our interactions and have no recollection of what was asked to them previously, thereby making them completely stateless and preventing end user to have a "conversational" chat with it. In this part of the series we solve this by learning about " Chat Memory ", so let's get into it. You are welcome to skip the theory section and jump to playground directly.  Chat Memory - Theory     Spring offers the benefit of using the mighty Advisor(s). It is through this useful feature where we can tap into the user input request before it reaches the LLM, an...

Springing into AI - Part 7: Observability

Image
 Welcome back, and hope you having a wonderful day. In Part 6 of the series, we had a look at our first exciting chat application where we were finally able to get hands dirty and interact with the LLM that was running on our local machine. Before we get our hands more dirty with more topics, we pause a bit to understand an important concept of  " Observability ".            Backend applications like the one we created previously require love from us engineers. This isn't the same type of love that was shared in Titanic by Leo and Kate, but more of a monitoring love that empowers us to know the state of our application from some fine grained metrics that is of interest to us so that we may have a behavioral sense of our running application. A typical example, in a Java application maybe wanting to know the amount of memory used in JVM (Java Virtual Memory), or the number of threads in use, information about garbage collection, etc. When we speak ...

Springing into AI - Part 6: Chat Client

Image
      Welcome back and hope you having an absolutely marvelous day. I am so excited to finally get you coding your first very basic chat client application in Java using SpringAI. Don't worry, I promise this is not as scary as some of the Conjuring or Annabelle movies. In Part 4  and Part 5  of the series we had a brief look at the core composition of  a very important Java class "ChatClient", that is being offered by SpringAI, and some options at our disposal for working with LLM's, be it locally on your own machine or using third party providers. By the end of this one, we would connect it all together with mission to have our own chat client that we can interact with, and using this as the foundation for future articles as we embark like Bilbo Baggins on this adventurous journey. Let's get started Architecture     The architecture for our application for current and future posts (unless advised otherwise when we deal with Model Context Protocol...

Springing into AI - Part 5: SpringAI

Image
       Welcome back, in Part 4  of this series we had a look at some of the options we can use to work with various foundation models be it running locally or using third party provider. In this post, we look briefly at  SpringAI  that will form a backbone for our journey ahead as we begin to get our hands dirty in writing AI applications that interact with LLM.  Spring AI     Spring has continued to evolve and be adapted as the go to enterprise framework for wide variety of backend applications developed using the Java programming language. Out of the box, Spring AI provides a comprehensive set of API's catered to wide use cases. The figure below shows an overview of the SpringAI eco-system.           From the figure above: LLM Models: From our previous post where we discussed the choices to use a LLM, Spring offers a flexible configuration based approach where we can specify the LLM model that we would be ...