Blog

Building and Deploying an AI Chatbot with Java: A Comprehensive Guide

By  
Marcus Hellberg
Marcus Hellberg
·
On Jul 28, 2023 5:06:53 PM
·

A while back, I built the Vaadin Docs Assistant, a ChatGPT-based AI assistant that can answer technical questions about developing with Vaadin Flow or Hilla based on the latest available documentation. If you're curious about the concepts behind the assistant, I recommend my earlier blog post.

In this series, we'll deep-dive into the technical side of constructing and deploying an AI chatbot using Java as our backend language. While the internet is awash with tools and projects in Python or JavaScript, I wanted to demonstrate that Java can be used to integrate AI tools just as effectively.

Documentation Assistant answering a question

The articles in this series are:

  1. Calling ChatGPT and OpenAI APIs in Spring Boot with Java, where we explore both simple and streaming responses.
  2. Using a Pinecone vector database with Spring Boot to identify relevant articles to include in the prompt.
  3. Prompt engineering and token counting for a ChatGPT bot in Java, which builds upon the previous articles.
  4. Building a ChatGPT-based AI application using Spring Boot, React, and Hilla that utilizes the services from the preceding articles.
  5. Finally, Deploying a Spring Boot app as a native GraalVM image with Docker.

Source Code for the Completed Application

Find the completed source code for the application on my GitHub.

Marcus Hellberg
Marcus Hellberg
Marcus is the VP of Developer Relations at Vaadin. His daily work includes everything from writing blogs and tech demos to attending events and giving presentations on all things Vaadin and web-related. You can reach out to him on Twitter @marcushellberg.
Other posts by Marcus Hellberg