/generator-jhipster-llm

A Blueprint for adapting JHipster / Spring Boot applications to LLM (Large Language Model)

Primary LanguageEJSApache License 2.0Apache-2.0

JHipster LLM

A Blueprint for adapting JHipster / Spring Boot applications to LLM (Large Language Model)

Introduction

This is a tool for quickly and easily generating Spring Boot application code using the LLM. For code generation, it utilizes JHipster, which can output various variations of Spring Boot application code. The code generation for LLM is achieved by using the Blueprint feature, which extends JHipster's code generation capabilities.

This tool outputs the following code:

In the near future, we plan to support:

  • Other LLM libraries of Spring AI
  • RAG support using VectorDB
  • Other Chat UI support

Prerequisites

  • Java 17 or later
  • Node.js 20 or later
  • Docker is required for running Ollama

Installation

The following command will install the code generator:

npm install -g generator-jhipster-llm

Usage

If you want to create the simplest application, execute the following command. After executing the command, you will be prompted with a series of questions to configure the code generation for the LLM-enabled Spring Boot application.

mkdir myLlmApp
cd myLlmApp
jhipster-llm generate-sample sample.jdl # This is for maven. For gradle, please use 'sample_gradle.jdl' instead.

(Note: Currently, only the minimal JHipster application configuration written in .blueprint/generate-sample/templates/samples/sample.jdl is supported. We plan to support various other configurations in the future.)

Answer the following questions. By default, Spring AI, llama.cpp and mistral 7B are selected.

  • Which LLM framwork do you want to use?
  • Which LLM library do you want to use?
  • Which LLM model do you want to use?

Execute the following to start Spring Boot. The necessary LLM model will be downloaded at startup.

./mvnw

After starting, access the following URL. The chat application will be displayed. http://localhost:8080/chat-ui/index.html

When you open the BetterChatGPT screen, open the API menu,check Use custom API endpoint, and enter http://localhost:8080/api/llm/v1/chat/completions in the API Endpoint.

Try typing something. Congratulations if you get a response! Enjoy building applications with LLM and Java!

Note when choosing Ollama

Ollama runs on Docker. ./mvnw before executing the following command: various services, including Ollama, will be started by Docker.

npm run services:up