Add ai-services and spring-boot-ai-service modules: prompt templates, per-id chat memory, tools, RAG, the @MemoryId trap, the message-window probe, and @AiService on Spring Boot 4.1.1, 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:
@@ -0,0 +1,6 @@
|
||||
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.
|
||||
Implementation is a java.lang.reflect.Proxy: true
|
||||
@@ -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?
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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'.
|
||||
@@ -0,0 +1,8 @@
|
||||
Memory window = 4. For each call: messages the model received, messages stored at that moment, messages stored afterwards.
|
||||
call 1: model received 1, stored 1, stored afterwards 2
|
||||
call 2: model received 3, stored 3, stored afterwards 4
|
||||
call 3: model received 5, stored 4, stored afterwards 4
|
||||
call 4: model received 5, stored 4, stored afterwards 4
|
||||
call 5: model received 5, stored 4, stored afterwards 4
|
||||
|
||||
Largest number of messages the memory object held after any add, used on its own: 4
|
||||
@@ -0,0 +1,5 @@
|
||||
Command: mvn dependency:tree -pl ai-services (lines mentioning the embedding model and what it brings in)
|
||||
+- dev.langchain4j:langchain4j-embeddings-all-minilm-l6-v2:jar:1.22.0-beta32:compile
|
||||
| +- com.microsoft.onnxruntime:onnxruntime:jar:1.20.0:compile
|
||||
| +- ai.djl:api:jar:0.36.0:compile
|
||||
| \- ai.djl.huggingface:tokenizers:jar:0.36.0:compile
|
||||
Reference in New Issue
Block a user