Add long-term-memory module: file, vector and summary memory on one Spring AI agent. AutoMemoryTools and AutoMemoryToolsAdvisor, fact extraction with a privacy gate into PostgreSQL and pgvector, VectorStoreChatMemoryAdvisor, a versioned summary, updating, forgetting, isolation, expiry, recall with all-MiniLM-L6-v2 and token cost. Scripted ChatModel; no provider or local LLM called. Spring Boot 4.2.0, Spring AI 2.1.0, Java 25.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b4RzcCS5JCAgcxLz7T
This commit is contained in:
Claude
2026-12-05 16:19:40 +05:30
parent c8fa0912f7
commit 5724303728
37 changed files with 1833 additions and 0 deletions
+1
View File
@@ -41,5 +41,6 @@ Runnable companion code for the Spring AI articles on [ankurm.com](https://ankur
| [`rag-eval/`](rag-eval) | Retrieval metrics in plain Java: hit@k, recall@k, precision@k, MRR and nDCG@k with their edge cases (duplicate chunks, short lists, no relevant passage) pinned by tests, a 30-question golden dataset with graded judgements over a 40-passage runbook, a paired bootstrap (no difference between the four retrievers had an interval that excluded zero), and a JUnit gate with a baseline, a tolerance and a no-new-misses rule that fails a build on a tokenizer that drops digits. **The retrievers are BM25, a hashed-trigram vector that is not a neural embedding, and their fusion; the corpus and questions are synthetic. No model was used.** Java 25, JUnit 6.1.3, no Spring. | [Measuring RAG Retrieval Quality in Java: recall@k, MRR, nDCG and a Golden Dataset in JUnit](https://ankurm.com/rag-retrieval-evaluation-java-recall-mrr-ndcg-golden-dataset/) |
| [`cloud-providers/`](cloud-providers) | Keyless Spring AI on Amazon Bedrock and Azure OpenAI, with no API key or secret key in the application: the AWS default credential chain under IRSA and EKS Pod Identity, a managed identity and Microsoft Entra ID bearer tokens on Azure (and why the dedicated Azure OpenAI starter is not in the 2.1.0 BOM), an audit advisor, and the traps reproduced: a leftover static key beats the role, `AWS_REGION` is ignored by Bedrock auto-configuration, short-lived credentials refetched on every call, `azure-identity` missing from the classpath, other modalities defaulting to OpenAI, and the SigV4 session token showing up in AWS SDK DEBUG logs. **No AWS account or Azure subscription was used: a local server stands in for STS, Bedrock, the Azure identity endpoint and Azure OpenAI; the Spring AI, AWS SDK and azure-identity code is real.** Spring Boot 4.2.0, Spring AI 2.1.0, Java 25. | [Spring AI on Amazon Bedrock and Azure OpenAI: Keyless Auth with IAM Roles and Entra ID](https://ankurm.com/spring-ai-bedrock-azure-openai-keyless-auth-iam-entra-id/) |
| [`ai-21-migration/`](ai-21-migration) | Upgrading from Spring AI 2.0.x to 2.1.0: one set of probes run against 2.0.0, 2.0.2, 2.0.3 and 2.1.0, three compile breaks, an API and configuration diff made from the jars, `ChatMemory` to session copying, `VectorStore.upsert` on pgvector, a grep checklist and an OpenRewrite recipe. Scripted and local fake models only; no provider called. Spring Boot 4.2.0, Spring AI 2.1.0, Java 25. | [Spring AI 2.0 to 2.1 Migration Guide](https://ankurm.com/spring-ai-2-0-to-2-1-migration-guide/) |
| [`long-term-memory/`](long-term-memory) | Long-term memory for one agent three ways: file memory with `AutoMemoryTools`/`AutoMemoryToolsAdvisor` (spring-ai-agent-utils 0.14.0), facts extracted with `entity()` into PostgreSQL and indexed in pgvector, and a rolling summary; plus `VectorStoreChatMemoryAdvisor`. Updating, forgetting, user isolation, expiry, recall with all-MiniLM-L6-v2 and token cost at 10, 50 and 200 facts. **The chat model is a scripted `ChatModel`, not a language model; token counts are cl100k_base estimates.** Spring Boot 4.2.0, Spring AI 2.1.0, Java 25. | [Long-Term Memory for Spring AI Agents](https://ankurm.com/spring-ai-long-term-memory-file-vector-summary/) |
Upgrading from Spring AI 1.x: [migration guide](https://ankurm.com/spring-ai-1-to-2-migration-guide/).