Counting Tokens and Estimating Costs When Calling LLMs in Java
How to count tokens locally with JTokkit, calculate costs with BigDecimal, block requests exceeding budget, and reconcile with actual usage from Spring AI.
How to count tokens locally with JTokkit, calculate costs with BigDecimal, block requests exceeding budget, and reconcile with actual usage from Spring AI.
Receive tokens from LLM API via Server-Sent Events using HttpClient and WebClient, then push to browsers, with error handling, timeouts, and tests.
Understand how LLMs call application functions, from raw JSON to @Tool in Spring AI. Includes examples for order lookup, cancellation, and testing without calling the model.
How to force LLM to return JSON matching schema in Spring Boot: map to record with Spring AI, enable native JSON Schema, validate, retry and write tests.
Practical prompt engineering techniques like system prompt, delimiter, few-shot, structured output, and temperature, illustrated with Spring AI.
Understand how temperature, top_p, and max_tokens control LLM output, and configure them correctly with Spring AI in Spring Boot 3 applications.
Understand three foundational LLM concepts: tokens, context window, and sampling. With Java 21 code to count tokens, trim chat history, and tune temperature, top-k, top-p yourself.
Analyzing a production-grade AI architecture that can run at zero cost, from frontend, RAG, local LLM to deployment, with hands-on code examples.
Explains the simultaneous listen-speak (full-duplex) architecture of real-time LLM models, with WebSocket integration examples using Spring Boot.
When source documents change, directly overwriting in the vector store easily causes data inconsistency. This article guides a safe versioning process for RAG.
A comprehensive overview of 12 foundational AI papers — from AlexNet to RAG — with Java code illustrating each core idea.
Learn how LLMs generate tokens one by one during inference, optimization techniques like KV cache, batching, quantization, and how to measure performance using Java/Spring Boot.
Summary of 20 fundamental concepts when working with LLM — token, embedding, RAG, fine-tuning, agent... with easy-to-understand Java/Spring AI code examples.
Practical guide on how to use LLM to reduce time writing code, tests, docs in Spring Boot projects, with runnable examples.