Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01G8ikz8xdWuTP5yun8DZ1hk
36 lines
1.7 KiB
Markdown
36 lines
1.7 KiB
Markdown
# langchain4j-demo
|
|
|
|
Companion code for the ankurm.com LangChain4j posts. Every number and transcript quoted in a post
|
|
comes from a file in a module's `output/` folder, and the tests that write those files also assert
|
|
the same facts, so the build fails when a claim stops being true.
|
|
|
|
| Module | Post | What it shows |
|
|
|---|---|---|
|
|
| `ai-services` | LangChain4j AI Services with Spring Boot 4: Declarative LLM Interfaces | prompt templates, chat memory, tools, RAG, and the `@MemoryId` trap |
|
|
| `spring-boot-ai-service` | same post | `@AiService` on Spring Boot 4.1.1 with the 1.22.0-beta32 starter |
|
|
| `agentic` | Agentic Workflows with LangChain4j: Sequential, Parallel, Loop and Supervisor Agents | the five workflow builders, state passing by key, supervisor JSON, error recovery |
|
|
|
|
## Versions (verified on Maven Central, 2026-10-11)
|
|
|
|
| Component | Version | Note |
|
|
|---|---|---|
|
|
| LangChain4j (`langchain4j`, `langchain4j-core`, BOM) | 1.22.0 | GA |
|
|
| LangChain4j beta modules (starters, embeddings, agentic) | 1.22.0-beta32 | beta only, no GA exists; the starter is built against Spring Boot 3.5.13 |
|
|
| Spring Boot (`spring-boot-ai-service`) | 4.1.1 | GA |
|
|
| JDK | 25 LTS | |
|
|
| JUnit | 6.1.3 | |
|
|
|
|
## Run
|
|
|
|
```bash
|
|
export JAVA_HOME=/path/to/jdk-25
|
|
mvn test # everything
|
|
mvn test -pl agentic -am # one module (-am builds the parent and ai-services too)
|
|
```
|
|
|
|
No API key is needed. The tests use `ScriptedChatModel`, a deterministic stand-in for an LLM, so
|
|
they can assert exactly which messages LangChain4j sent. Replace it with `OpenAiChatModel` or any
|
|
other `ChatModel` and the AI Service interfaces do not change.
|
|
|
|
Each module writes its transcripts to `<module>/output/` when you run the tests.
|