Beyond the Basics: Building Generative AI Java Applications Using LangChain4j
2h 28mIntermediate2026-01-07
Authors

Frank Greco
Course details
In this intensive, hands-on course, AI expert and senior consultant Frank Greco proves that Java is a first-class citizen in the world of generative AI. Learn how to master LangChain4j, the de facto Java library for working with LLMs and generative AI tools. Using a large repo of example code, Frank demonstrates how to write Java code to build intelligent, context-rich Java applications that combine effective prompts with the power of embeddings, vector stores, ingestion architecture, and retrieval-augmented generation (RAG).
Additional topics covered include advanced prompting with templates, streaming LLM responses in real time, understanding embeddings and similarity, chunking strategies, invoking Java methods, agents, and more.
Learning objectives
Create smooth streaming output from an LLM.
Fully understand the relationship between similarity and embeddings.
Implement a basic RAG application.
Understand the LangChain4j ingestion architecture
Create an LLM application that calls a Java method.
Deploy agents efficiently and appropriately.
Additional topics covered include advanced prompting with templates, streaming LLM responses in real time, understanding embeddings and similarity, chunking strategies, invoking Java methods, agents, and more.
Learning objectives
Create smooth streaming output from an LLM.
Fully understand the relationship between similarity and embeddings.
Implement a basic RAG application.
Understand the LangChain4j ingestion architecture
Create an LLM application that calls a Java method.
Deploy agents efficiently and appropriately.
Concepts
Introduction
- Java GenAI with LangChain4j - Just make it work
Generative AI and Basic LangChain4j Review
- A look at an LLM app without context
- Patterns, taxonomy, and non-deterministic IT
- The critical nature of context
- Prompts and prompt techniques
- Hands-on lab - Build a simple app with context
Advanced Prompting with Templates
- A look at a prompt template with text summarization
- PromptTemplate usage and syntax
- Parameter injection and placeholder formatting
- Hands-on lab - Build an advanced template
Higher-Level Components with LangChain4 Services
- A look at a multi-user chatbot with conversational context
- Review of chatbot architecture
- Introduction to LangChain4j s AiService
- Hands-on lab - Simple AiService for chatbot component
- Multiuser chat
- Hands-on lab - Multiuser AiService
Streaming LLM Responses
- A look at streaming output generated by an LLM
- Benefits of streaming output
- Implementing streaming with LangChain4j
- Streaming with CompletableFuture
- Hands-on lab - Adding streaming to chatbot
Improving Context
- A look at determining similarity of text strings
- Quick review of RAG, similarity, and embeddings
- Generating embeddings using LangChain4j
- Hands-on lab - Comparing two strings via their embeddings
Embedding Vector Stores
- A look at searching for similar text
- Using an EmbeddingStore to store embeddings
- Searching an embedding space
Building a Basic RAG Chatbot
- A look at searching for similar text in our private documents
- Detailed look at LangChain4j's data ingestion architecture
- Loading content into an EmbeddingStore
- Semantic searching
- Hands-on lab - Creating a mini RAG using multiple files
Introduction to Agents
- A look at how LLMs can call our Java methods
- Function-calling
- LangChain4j's tool primitives
- Hands-on lab - Using tools with a simple AiService
- Agents and LangChain4j
Conclusion
- Review and key takeaways