Tag: java
All the articles with the tag "java".
-
Prompt templates in Spring AI — stop hardcoding your prompts
Hardcoded prompt strings in Java code are hard to review, impossible to change without a redeploy, and a maintenance nightmare at scale. Spring AI's PromptTemplate solves this. Here is how to use it properly.
-
Understanding Spring AI's ChatClient — the heart of every AI call
ChatClient is the central abstraction in Spring AI. This post covers the builder API, default system prompts, per-call options, advisors, and the difference between call() and stream() — everything you need to use it effectively.
-
Setting up Spring AI in a Spring Boot project — step by step
Module 2 starts with code. This post walks through adding Spring AI to a Spring Boot project, configuring OpenAI and Ollama, and making your first real LLM API call from Java.
-
Prompt engineering basics every developer needs before writing any code
A prompt is not just a question — it is an instruction set. This post covers the anatomy of effective prompts, zero-shot vs few-shot prompting, chain-of-thought reasoning, and the most common mistakes developers make when writing their first prompts.
-
Choosing an AI model for your Java application — OpenAI, Anthropic, or local
With Spring AI abstracting the model layer, switching providers is mostly a config change. The harder question is which model to pick for your use case. This post gives you a practical comparison and a decision guide.