Skip to content

mohankumar27/spring_ai_101

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring AI 101

A beginner-friendly Spring Boot application that demonstrates how to integrate and use OpenAI's chat capabilities with Spring AI framework.


📚 Read the Detailed Blog Series on Medium!

Learn step-by-step tutorials and deep dives into Spring AI concepts:

➡️ Spring AI 101 Blog Series


📋 Table of Contents

🎯 Overview

This project shows you how to:

  • Create a Spring Boot application
  • Connect to OpenAI's API using Spring AI
  • explore all the chat functionalities provided by Spring AI

Technologies Used:

  • Java 17
  • Spring Boot 3.3.5
  • Spring AI 1.0.1
  • Gradle (build tool)
  • OpenAI API

✅ Prerequisites

Before you start, make sure you have:

  1. Java 17 or higher installed on your computer
  2. Gradle (comes with the project as a wrapper)
  3. OpenAI API Key - Get one from OpenAI
  4. Git (optional, for cloning the repository)

🚀 Getting Started

Step 1: Clone or Download the Project

git clone <repository-url>
cd spring_ai_101

Step 2: Set Up Your OpenAI API Key

Create a file named .env or set an environment variable:

Option A: Using .env file

OPENAI_API_KEY=your_openai_api_key_here

Option B: Using application.properties Create src/main/resources/application.properties:

spring.ai.openai.api-key=your_openai_api_key_here
spring.ai.openai.chat.options.model=gpt-4

Step 3: Run the Application

Using Gradle:

./gradlew bootRun

Or if you're on Windows:

gradlew.bat bootRun

The application will start at http://localhost:8080

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published