0% found this document useful (0 votes)
10 views2 pages

Spring AI Project Setup Guide

The document outlines the steps to create a Spring AI project using Spring Initializr, specifying the setup for IntelliJ IDE, Maven, and Java with the latest Spring Boot version. It details the necessary dependencies, particularly focusing on Spring Web and Spring AI OpenAI Starter, and provides instructions on how to resolve a common error related to the OpenAI API key during project execution. To successfully run the application, users must add their OpenAI API key in the application.properties file.

Uploaded by

phonsaakshit
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Spring AI Project Setup Guide

The document outlines the steps to create a Spring AI project using Spring Initializr, specifying the setup for IntelliJ IDE, Maven, and Java with the latest Spring Boot version. It details the necessary dependencies, particularly focusing on Spring Web and Spring AI OpenAI Starter, and provides instructions on how to resolve a common error related to the OpenAI API key during project execution. To successfully run the application, users must add their OpenAI API key in the application.properties file.

Uploaded by

phonsaakshit
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Lecture 05: Creating a Spring AI Project

Project Setup with Spring Initializr:

● Go to [Link].
● Choose:
○ IDE: Intellij IDE
○ Project Type: Maven
○ Language: Java
○ Spring Boot Version: Latest stable
○ Group ID: [Link]
○ Artifact/Project Name: springAICode

Dependencies to Add:

● Spring Web—for building a web application.


● Spring AI (Model-specific):
○ For OpenAI → add Spring AI OpenAI Starter.
○ For Anthropic → add Anthropic Starter.
○ For Ollama → add Ollama Starter.
○ For Vertex AI (Google) → add Vertex Starter.
● In this lecture, only Spring Web and Spring AI OpenAI Starter are added.

[Link] after Adding Dependencies:

● spring-boot-starter-web

● spring-ai-openai-spring-boot-starter
Running the Project:

● When you run the app, it starts on the Tomcat server.


● But on the first run, it fails.

Why Does It Fail?

● Error: OpenAI API key must be set.


● Missing property: [Link]-key=YOUR_KEY_HERE
● This must be added in [Link].

Note: To fix the error, you need to generate and set the OpenAI API key.

You might also like