Add ai-services module: prompt templates, per-id chat memory, tools, RAG, and the @MemoryId trap, each with a captured transcript

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01G8ikz8xdWuTP5yun8DZ1hk
This commit is contained in:
2026-10-11 07:41:41 +00:00
co-authored by Claude Sonnet 5.5
commit 16d6781675
16 changed files with 481 additions and 0 deletions
@@ -0,0 +1,5 @@
Messages LangChain4j sent to the model:
SYSTEM: You are a concise support agent for Acme Vault. Answer in one sentence.
USER: Customer asks: How do I reset my password?
Reply: Reset it from Settings > Security.
+11
View File
@@ -0,0 +1,11 @@
Messages the model saw on each call (memory window = 4 stored messages):
call 1: 1 messages
call 2: 3 messages
call 3: 1 messages
call 4: 5 messages
call 5: 5 messages
Second call, in full:
USER: My name is Alice
AI: noted (1 messages seen)
USER: What is my name?
+10
View File
@@ -0,0 +1,10 @@
Tool specification sent with the first request: [orderStatus - Looks up the shipping status of an order by its id]
Second request (after the tool ran):
USER: Where is order A-1001?
AI: tool calls [orderStatus{"orderId":"A-1001"}]
TOOL_EXECUTION_RESULT: Order A-1001 shipped on 2026-10-08, arriving 2026-10-13
Java methods actually executed: [orderStatus(A-1001)]
Model round trips: 2
Final reply: Your order is on its way and arrives on 2026-10-13.
+5
View File
@@ -0,0 +1,5 @@
What the model received after retrieval (maxResults=1):
USER: How long do refunds take?
Answer using the following information:
Refunds are issued to the original payment method within 5 business days.
+2
View File
@@ -0,0 +1,2 @@
Building an interface where ONE method has @MemoryId, with no ChatMemoryProvider:
IllegalConfigurationException: In order to use @MemoryId, please configure the ChatMemoryProvider on the 'com.ankurm.lc4j.aiservices.AiServicesTest$MemoryIdMixed'.