Skip to content

rjtmahinay/watsonx-spring-ai-hilla

Repository files navigation

watsonx-spring-ai-hilla

This is a demonstration of creating a simple chatbot using watsonx.ai and Spring AI. This chatbot includes basic chat and streaming chat.

JDK

The following project uses JDK 21.

Chatbot Environment Variables

The chatbot needs to connect to watsonx.ai platform using an API Key and Project ID. These 2 properties is hidden and is declared in env_vars.properties

  • Under the root project folder (watsonx-spring-ai-hilla), create a folder named config
  • Create a file named env_vars.properties under the config folder
  • Define the properties below in the file:
API_KEY=
PROJECT_ID=

How to Run

Recommended

  • Find in the project directory the class called WatsonxSpringAiHillaApplication
  • Right-click and choose Run

Running the Application

Optional Only: Terminal

The terminal approach assumes that you have a JAVA_HOME environment variable in your laptop and it is pointing in JDK 21.

For people who are inclined to start an application via terminal, please run the command below:

  • In your terminal, change directory to this project (watsonx-spring-ai-hilla)
  • Run the following command
    • Windows
    gradlew bootRun
    • Linux and Mac
      ./gradlew bootRun
    OR
      sh ./gradlew.sh bootRun

Documentations