
Discover Spring AI, a Java-based framework for working with generative AI models and large language models, highlighting its features, capabilities, and limitations for developers.
Meet John Thompson, founder of Spring Framework Guru, with over 20 years of Java experience, and learn how AI and large language models shift the Java and Spring landscape.
Block time to complete the course, quizzes, and coding exercises to retain knowledge and apply it to your programming career, and join the Slack community or newsletter.
Block time to complete the course, tackle quizzes and coding exercises, and join the exclusive Slack community for students and the Spring Framework Guru newsletter.
Compare IntelliJ's paid ultimate and community editions to see when a free ide still includes JetBrains support, and why time matters for enterprise Java developers.
Follow a practical Git workflow for the course: fork the repository, clone it to your local workspace, and use per-lesson branches to compare and track changes.
Explore an introduction to AI, define common terminology, discuss AI capabilities and where AI is going, and prepare for working with large language models.
Explore types of artificial intelligence, from narrow AI to general AI (AGI) and super AI, and compare reactive, limited memory, deterministic, and generative approaches.
Explore large language models (LLMs), their data-driven training, tokenization, embeddings, and transformers, and understand their capabilities, limitations, and applications from translation to code generation.
Explore OpenAI's journey from a nonprofit to a capped-profit lab and its groundbreaking models like GPT, multimodal GPT-4, Dall-E, Codex, Clip, and ChatGPT, plus safety and ethical considerations.
Set up a spring ai project, query OpenAI with crafted prompts to receive JSON responses, and map them to a strongly typed program; explore prompt engineering and retrieval augmented generation.
Create a new spring boot project with maven, set java 21 lts on graalvm, add spring web and OpenAI dependencies, and verify with a test after configuring the OpenAI key.
set up the OpenAI API key for Spring AI by using environment variables in IntelliJ, avoiding text files, and configuring runtime and test environments to pass the key securely.
Set up and implement a portable OpenAI service in Spring AI by defining an interface, creating a chat model implementation, and configuring model-agnostic prompts and tests.
Explore the capabilities of large language models by running prompts and scripts to generate Python code, test reasoning, math, and JSON outputs, and observe censorship and jailbreak behavior in OpenAI.
Implement a Spring Boot rest controller with question and answer records, wire an OpenAI service via constructor, and expose endpoints using a prompt template to return answers.
Test the spring mvc controller with Postman by sending post requests to localhost:8080/s, binding the request body to the question record, and verifying the API response.
Learn to implement prompt templates in spring boot by using string templates and resource-backed prompts, bind parameters like state or country, and streamline openai responses for capital queries.
Discover how to direct large language models to format responses, build a rest endpoint for a capital with info, and control formatting while avoiding hallucinations.
Direct the model to respond in json without markdown tags, with a property named answer, and parse it with Jackson's ObjectMapper in Spring Boot to return the answer.
Learn to bind OpenAI responses to a Java record using a bean output parser, generate a detailed JSON schema, and bind the format in the template for clean JSON output.
Use the debugger and a breakpoint to inspect the user prompt, the full input, and the OpenAI model's metadata. Learn about rate limits and token costs in production.
Explore prompt engineering as a field guiding large language models toward reliable results with breadcrumbs and hints, and learn retrieval augmented generation by matching data to user prompts.
Explore the art and science of prompt engineering, including designing prompts, guiding model output, and ethical considerations, with practical examples like formatting to JSON, summarization, translation, sentiment analysis, and tone.
Develop precise prompt instructions to guide language models, experiment with outputs in JSON, XML, and YAML, and test conditional instructions and tone variations like Snoop Dogg and Harry Potter.
Practice step-by-step reasoning prompts that require thinking, translate summaries into Polish, list names in Polish, and output a JSON object, while evaluating and comparing student solutions.
Learn to harness OpenAI to generate concise summaries and compelling sales copy from Amazon reviews of a book, using prompts to combine reviews for a web page selling the book.
Explore how large language models infer sentiment, emotions, and topics from reviews in multiple languages, with tests showing positive and negative sentiments and varying emotion labels.
Explore zero shot and few shot prompts, compare models and temperatures, and learn how to balance cost, speed, and output with options like nano and GPT-4 in large language models.
Discover chain of thought in prompt engineering and how newer reasoning models default to reasoning. Compare traditional llms prompts with GPT-4 mini and few-shot examples to improve results.
Explore how system messages in prompt engineering set the context for OpenAI responses, enabling persona-driven outputs (tourism guide, SEO expert, Hemingway style) without changing user data.
Explore retrieval augmented generation (rag) and how vector databases, embeddings, and semantic search enhance LLM outputs by retrieving relevant information before generation.
Configure a spring project with a vector store and OpenAI API key via environment variable, using application yaml; switch to the simple vector store builder for spring i m5.
Load the top 500 grossing movies into the vector store using a document reader and TikaDocumentReader. Split content, embed with OpenAI, and persist vector representations.
Query the vector store with the user's question to retrieve relevant documents via a similarity search and feed them into the OpenAI prompt, ensuring answers come only from the documents.
Upgrade to the text embedding three small model to improve vector store search, review benchmarks and token costs, and configure embedding options in your project.
Trim extraneous data in the vector store to improve semantic search accuracy, reload the vector store, and tune results by focusing on core fields like title and overview.
Learn to improve model responses by supplying document metadata, such as budget, revenue, currency formatting, runtime, and cast, and see how metadata about data improves the model's formatting and answers.
Explore retrieval augmented generation with Milvus, building an AI expert that matches boats to towing trucks using RAG, and learn to incorporate real-time data via function calls.
Explore the factors that determine tow capacity, including weight, engine power, suspension stiffness, braking, and weight distribution, and learn how to select right trucks using ai-driven recommendations for towing boats.
Explore a spring boot project setup with milvus vector store, openai spring boot starter, and tika document reader; compare GPT 4 turbo to GPT 3, and preview Milvus refactor.
Explore Milvus, a scalable vector database, and configure it in a Spring Boot project using Docker Compose, localhost:19530, with a default database and vector store.
Load boat specifications into a vector store using Yamaha performance bulletins, via text documents or links, and guide the model with tow weights from 21 to 38 foot boats.
Load and initialize the Milvus vector store using Docker Compose, configure a Spring Boot component to test data loading with a TextSplitter and similarity search, and persist the store.
Configure the system prompt and user prompt in a rag setup, using vector results to identify the cheapest capable tow truck.
Learn to augment AI models with function calling by building a weather API, enabling real-time data retrieval via RAG, and explore multimodal features like image generation and speech from text.
Explore how OpenAI function calling enables the model to invoke tools, fetch current data via APIs, and return results, guided by Spring AI tooling for a multi-step workflow.
Review the Spring AI functions project and its Spring MVC controller, showing how to use OpenAI functions to fetch current weather for a city from a weather service.
Obtain an API key from API Ninjas, leverage the Weather API with the X-Api-Key header, and wire the call into an OpenAI-compatible function.
Implement a weather service using the api ninjas weather api by building a java function with a weather request and response, wired via rest client.
Configure function callbacks in Spring AI to enable OpenAI functionality, wire the api key via environment variables, and set up OpenAI chat options with a weather function.
Show how a weather function returns a json response with a json schema containing metadata, using Spring AI utilities to generate and attach the schema for OpenAI to utilize.
Use system messages to enforce locale-specific formats, converting Celsius to Fahrenheit for imperial users and delivering weather data through a weather service example.
Explore AI functions, including callback interactions with multiple functions, and delve into multimodal capabilities such as AI image generation, text-to-image, text-to-speech, and speech-to-text.
OpenAI enables image generation from text prompts, including creation, editing, and variations, though Spring AI currently supports only text-to-image creation; Dall-E 2 and 3 offer different limits and sizes.
Review the Spring AI image project on GitHub, inspect dependencies and environment key setup, and outline creating an endpoint to generate images with OpenAI.
Implement a Spring MVC endpoint in QuestionController to return a png image as a byte array via a post mapping, enabling Postman to render the OpenAI generated image.
Implement the OpenAI image service by building the image model interface, configuring options and prompts, decoding base64 results to byte arrays, and testing via Postman.
Switch from dall-e 2 to dall-e 3 to test prompts, compare outputs, and explore creative compositions like a dog holding a duck near a small boat at sunrise.
Use OpenAI specific image options via the image client to set quality, style, and model (Dall-E 2 vs 3). Explore hd and vivid or natural styles in a Spring workflow.
Explore OpenAI vision, the image understanding feature in GPT-4, with images via base64 or URL up to 20 MB, and review key limitations like medical images and rotation.
Implement a Spring MVC post endpoint to upload an image via multipart form data and return a description by passing the file to getDescription that calls OpenAI's vision endpoint.
Implement a vision service that uses a chat model to describe an image, configuring GPT-4 and passing a JPEG resource to generate a descriptive response.
OpenAI's text-to-speech overview shows how tts-1 and tts-1-hd convert text to speech with six predefined voices. The api outputs mp3 by default and supports multiple languages and formats.
Implement a Spring MVC endpoint with a post mapping at /talk that accepts a question, calls a stub OpenAI service, and returns an audio/mpg byte array testable with Postman.
Implement a text-to-speech workflow with the OpenAI audio speech client, configure speech options and voice, output MP3 as a byte array, test via postman, and handle API keys.
Install the JetBrains AI assistant and JetBrains junior plugin, set up plugins, and select a plan. Manage subscriptions, credits, and model options for AI-enabled coding across JetBrains IDEs.
Learn how JetBrains AI and Juni work together to analyze your project, generate tests, and perform quick edits and refactorings.
Create a Spring Boot project in IntelliJ using initializer, add Lombok, Spring Web, Spring Data JPA, H2, Flyway migrations, and Jakarta validation to build a simple MVC app.
Create a spring data repository for the beer entity and tests for basic create, read, update, delete operations, using Junie to generate code, run tests, and verify repository behavior.
Create a rest endpoint by generating a Spring MVC controller and a service layer backed by Spring Data JPA repositories, adding CRUD operations and corresponding tests with Mockito.
Extend the beer controller by adding update and delete endpoints, create new service methods, and expand mock mvc and unit tests to improve coverage and reliability.
Traditionally accessing Artificial Intelligence Models, such as OpenAI's ChatGPT, has been the domain of programming languages Python and Javascript.
Not any more. Spring AI unlocks the power of Generative AI for Java developers.
The Spring AI project aims to streamline the development of applications that incorporate artificial intelligence functionality without unnecessary complexity.
Spring AI provides support for all major Artificial Intelligence models, including:
OpenAI
Azure OpenAI
Amazon Bedrock
HuggingFace
Ollama
Google VertextAI (PaLM2 and Gemini)
Mistral AI
Antrhopic
WatsonxAI
Spring AI also supports image generation AI models from OpenAI and Stability.
Retrieval Augmented Generation is an important use case for dealing with AI models. Spring AI includes robust support for all major Embedding Models and all popular vector databases.
No prior experience with AI is needed for this course.
You will start the course with a solid overview of what Artificial Intelligence is.
Next you'll have a hands on section to develop a RESTful API to ask OpenAI's ChatGPT questions. In this section, you will learn how we can instruct the model to return data in the format we desire.
Since no AI experience is required, the next section of the course builds upon what you learned with a formal look at Prompt Engineering. Prompt Engineering is a collection techniques to improve the quality and accuracy of responses from AI Models.
Retrieval Augmented Generation (RAG) is an important technique to provide Large Language Models with additional information required to the user's query to complete specialized tasks.
You will see how we can use RAG to develop AI experts to perform high specialized tasks.
The AI models are not just limited to working with textual information.
In this course you will also see how to use AI to create images, create audio files from text, and how to transcribe audio files to text.
Course Updates
Sept 9th, 2024 - Course Updated to Spring AI 1.0.0-M2
October 12th, 2024 - Course Updated to Spring AI 1.0.0-M3, Spring Boot 3.3.4
January 2nd, Course Updated to Spring AI 1.0.0-M5 and Spring Boot 3.3.6
Learn all this and more in Spring A:I Beginner to Guru. Enroll today!