Building a Knowledge Assistant with Spring AI
Build a Spring AI knowledge assistant with document ingestion, vector search, team filtering, source evidence and focused tests for missing or outdated content.
Build a Spring AI knowledge assistant with document ingestion, vector search, team filtering, source evidence and focused tests for missing or outdated content.
Configure Spring AI sampling and structured output, validate classifications, and measure repeatability separately from correctness with focused Java tests.
Connect Spring AI tools to an existing REST API, pass trusted customer context, handle lookup failures and test the adapter without a language model.
Handle Spring AI request failures, timeouts, invalid structured output and interrupted streams with configuration, code examples and focused tests.
During unit testing of an e-commerce application, we can easily test a method that calculates an order count by comparing the test result with the expected number. But what if an LLM explains that count? “Three orders went to Pune” and “Pune received three orders” are both correct, even though …
Build a custom Spring Boot 4 starter with conditional auto-configuration, configuration properties, a consuming app, and tests for defaults and bean overrides.
Learn how to extract data from invoices with AI in Python using a local Ollama model, Pydantic, OCR and checks, with accuracy measured on 24 invoices.
Screen resumes with AI in Python. Redact names, check each requirement with a local Ollama model, verify every quote, and leave the decision to a human.
Find root cause of errors in logs with AI. Group logs with Drain3, mask secrets, ask a local Ollama model for ranked causes, and check every cited line.
In multi-agent AI system, each agent has its own instructions and a specific part of the task to complete. The agents can use the same language model.
Compare Spring AI, LangChain4j, Embabel, and AgentScope Java with the same ticket-lookup example. Choose a starting framework for Spring Boot, plain Java, or agents that need planning.
Reduce Claude Code costs with measured changes to CLAUDE.md, prompts, subagents and sessions, tested on a Spring Boot project with a passing test suite.
Debug a Java memory leak step by step with a runnable example, jcmd commands, heap dumps, Eclipse MAT screenshots, and measured results before and after the fix.
Practice 40 DSA problems by pattern, with direct problem links, approach hints, edge-case traces and a flexible study plan.
Spring AI interview questions with answers for Spring AI 2.0: ChatClient, advisors, chat memory, tool calling, MCP, RAG, structured output and testing.
Spring AI 2.0 migration guide: upgrade a Spring AI 1.x app to 2.0.1 step by step, with the build errors you will see and the fix for each one.
Spring AI Docker Model Runner example: run LLMs locally with the OpenAI starter and a base URL, then keep a second model in Ollama in the same app.
Spring AI Bedrock Converse in Spring Boot: the starter, AWS credentials, model access, a local model beside it, and switching model families by id.
Spring AI DeepSeek setup in Spring Boot: the starter, the API key, two ChatClients for DeepSeek and a local model, and reasoning mode in Spring AI 2.0.
Spring AI Gemini setup in Spring Boot: the starter, the API key, two ChatClients for Gemini and a local model, and the thinking budget in Spring AI 2.0.
Spring AI Anthropic Claude setup in Spring Boot: the starter, the API key, two ChatClients for Claude and a local model, and extended thinking.
Spring AI moderation with Llama Guard on Ollama and OpenAI’s ModerationModel: check customer messages in an advisor and block the unsafe ones.
Spring AI observability with Micrometer: read token and latency metrics in Actuator, trace one RAG request in Zipkin, and turn tokens into cost.
Spring AI testing at three levels: unit tests with a fake ChatModel, integration tests with Ollama in Testcontainers, and evaluators as judges.
Build Spring AI agents with five workflow patterns: chain, routing, parallelization, orchestrator and workers, and evaluator and optimizer, with real runs.
Build a Spring AI MCP server with @McpTool, @McpResource and @McpPrompt, test it with MCP Inspector, and call its tools from a Spring AI MCP client.
Spring AI advisors explained: how the advisor chain works, the built-in advisors, why their order matters, and how to write your own call advisor.
Spring AI RAG with Ollama: add QuestionAnswerAdvisor and RetrievalAugmentationAdvisor, compare them on real questions and fix wrong or missing answers.
Spring AI vector store comparison: the same app on SimpleVectorStore, Chroma, pgvector, Redis and Qdrant, with real timings, setup, traps and a rule.
Spring AI Redis vector store example: run Redis Stack, configure RedisVectorStore, declare metadata fields for filters, and fix the common Redis errors.
Spring AI multimodality with Ollama: send a parcel photo and a question to a vision model, accept an upload, and map the answer to a Java record.
Spring AI chat memory with Ollama: add MessageChatMemoryAdvisor, keep one conversation per customer, save it in HSQLDB with JDBC and pick a window size.
Spring AI streaming with Server-Sent Events in Spring MVC: return a Flux, test it with curl, read it in the browser with EventSource and keep the spaces.
Spring AI ChatClient examples: default system prompt, template parameters, Java records with entity(), token usage, per-request options and two clients.
Prompt injection in LLM apps explained: direct and indirect attacks run against a Python assistant, five defenses, and the attack counts after each.
Fine tuning vs RAG vs prompt engineering for LLM apps: what each changes, cost and data needed, a Java prompt example, and a flow to pick one.
Run LLMs locally from Java with Ollama, Docker Model Runner or LM Studio: compare the three, then call any of them with one plain Java HttpClient class.
Retrieval augmented generation (RAG) explained for Java developers: index, retrieve, generate, the key terms, a runnable offline example and the trap.
Build a Spring Boot and Vaadin CRUD app with a Grid, a validated form and Spring Data JPA. Complete code for every file, run steps and real screenshots.
TypeScript 7 ports the compiler to Go, and tsc is now a native binary. We measure it against TypeScript 6 on 1,001 modules and migrate a tsconfig step by step.
MCP tool poisoning hides instructions in a tool description. See it demonstrated in Python, with hash pinning, scanning and sandboxing as defenses.
Free-threaded Python (python3.14t) runs threads in parallel without the GIL. We install the build, reproduce race conditions and write thread-safe code with locks and queues.
CPython’s experimental JIT compiler (PEP 744) explained: how to enable it, a real from-source benchmark, and when it helps today.
Python 3.15 adds the lazy keyword (PEP 810) for imports that load on first use. This guide measures start-up time with -X importtime, shows a CLI tool that starts in 57 ms instead of 141 ms, and compares the older alternatives.
Context bloat is the growth of an LLM request with tokens the model does not need. Measure a real agent request and cut it with six techniques.
Python 3.15 makes UTF-8 the default encoding of open() on every platform. What breaks with cp1252 files on Windows, and the six steps to migrate safely.
Stateless MCP means every request carries what the server needs. What revision 2026-07-28 removed and added, shown with a stateful and a stateless Python server behind a two-instance proxy.
Upgrade the Python version of an existing project in seven steps with pip and venv: fix the deprecation warnings on the old version, check the wheels, test on both versions, then switch. Shown on a real project moving from 3.12 to 3.15.
A SKILL.md file holds on-demand instructions for a coding agent. This guide covers the format, the description that triggers it, a validator and two tests.
Fix the Dropwizard error Failed to parse configuration, could not resolve type id ‘http’ as a subtype of ConnectorFactory: add the Shade services merge.
HowToDoInJava provides tutorials and how-to guides on Java and related technologies.
It also shares the best practices, algorithms & solutions and frequently asked interview questions.