What you'll learn: Build a high-performance Quarkus REST API that uses LangChain4j and Groq's Llama 3 model for dynamic text processing — summarization, translation, and more — via a single endpoint.
git clone https://github.com/mehedicoder/langchain4j-quarkus.git
cd langchain4j-quarkus
Set your Groq API key as an environment variable:
# Linux/macOS
export GROQ_API_KEY=your_gsk_api_key_here
# Windows (PowerShell)
$env:GROQ_API_KEY="your_gsk_api_key_here"
Review the tech stack: The project uses Quarkus 3.15.1, LangChain4j (Quarkus Extension), and the llama-3.3-70b-versatile model via Groq's OpenAI-compatible API.
Understand the architecture: AI services are declared via Java interfaces using @RegisterAiService — no boilerplate prompt handling required.
Build and run:
./mvnw quarkus:dev
The app starts on the default Quarkus port localhost:8080.
Change the task query parameter to switch between summarization, translation, and other AI tasks.
Run tests:
./mvnw test
Tests use REST-Assured and JUnit 5.
Next steps: Explore the @RegisterAiService interface to understand declarative AI services in LangChain4j. Try swapping the Groq model for another provider by adjusting the LangChain4j configuration.
What you'll learn: Set up a React frontend connected to a LangChain4j-powered Java backend with streaming AI responses for cybersecurity consulting and document intelligence.
Prerequisites
Java 17+ (uses Text Blocks and Records).
Gradle 7+ or Maven as build tool.
Groq API Key set as GROQ_API_KEY environment variable.
Steps
Clone the repository:
git clone https://github.com/mehedicoder/react_langchain4j.git
cd react_langchain4j
Configure the Groq API key:
# Linux/macOS
export GROQ_API_KEY="your_gsk_key_here"
# Windows (PowerShell)
$env:GROQ_API_KEY="your_gsk_key_here"
# Windows (CMD)
set GROQ_API_KEY=your_gsk_key_here
Explore the three applications included:
ITAssistant — Terminal-based AI security consultant with streaming and chat memory.
ITAssistantHumanLike — Same as above with simulated human typing (Teletype effect).
TextSummarizer — Multithreaded text summarizer supporting 10+ summarization levels.
Place text files for summarization: Put .txt files in src/main/resources/ before running the TextSummarizer.
Build and run with Gradle:
./gradlew run
Or run individual classes directly from your IDE.
Interact with the chatbots: Type questions at the Ask> prompt. After each response the system displays TTFT (Time to First Token) and Total Latency metrics. Type exit or quit to end.
Use the Text Summarizer: Run TextSummarizer.java, then follow the prompts — enter filename, summarization level (e.g., executive), and language.
Summary Level Reference
Level
Goal
Output Style
Extractive
Accuracy
Verbatim sentences
Executive
Action
Decision-oriented bullets
Thematic
Understanding
Core concepts & motifs
Analytical
Insight
Interprets "why" and "how"
Ultra-brief
Speed
Single high-impact sentence
Note: The repository README does not detail the React frontend integration steps. Check the source code and build.gradle for the React build configuration.
Next steps: Review the build.gradle for React integration details. Explore the @SystemMessage annotations to customize the AI persona.
What you'll learn: Build an automated invoice processing system using langgraph4j with a hybrid "Human-in-the-Loop" architecture — low-value invoices auto-approved, high-value routed for manual review.
Prerequisites
Java 17+ and Maven.
langgraph4j dependency (included in pom.xml).
Steps
Clone the repository:
git clone https://github.com/mehedicoder/invoice-verifia.git
cd invoice-verifia
Review the Maven configuration: Open pom.xml to understand dependencies including langgraph4j and any LLM provider connectors.
Understand the architecture: The system implements a multi-agent workflow:
Extractor — Reads invoice data and detects amounts.
Router — Evaluates invoice value thresholds; low-value invoices go to the autonomous agent, high-value invoices trigger human authorization.
Persistence — Logs all approvals (automatic and manual).
Responder — Finalizes and outputs invoice status.
Build the project:
./mvnw clean install
Run the application:
./mvnw exec:java
Observe the streaming output as invoices are processed.
Interact with the Human-in-the-Loop: For high-value invoices you'll see a prompt:
Approve [A] or Reject [R]?
Enter A to approve or R to reject. The system logs manual authorization.
Example Output
[Extractor] Detected: $45.00
[Persistence] Logged APPROVED by Agent
[Responder] Finalized Invoice: Status=APPROVED, Total=$45.00
[Extractor] Detected: $150.00
Approve [A] or Reject [R]? A
[Persistence] MANUAL APPROVAL LOGGED: $150.00 authorized by Human.
Note: The README does not include explicit environment variable or LLM API key configuration. Check pom.xml and source code for the specific LLM provider setup.
Next steps: Customize the invoice value threshold for routing. Extend the agent graph to add OCR integration or email notification steps.
LangChain4j AI Playground — Chatbots & Text Summarizer
LangChain4j Basics25 min read
What you'll learn: Run three LLM-powered CLI tools — an IT security chatbot with streaming, a human-like assistant with teletype effect, and a multithreaded text summarizer — all using LangChain4j and Groq's Llama 3.
Prerequisites
Java 17+ (uses Text Blocks and Records).
Gradle 7+ or Maven.
Groq API Key set as GROQ_API_KEY.
Steps
Clone the repository:
git clone https://github.com/mehedicoder/lanchain4j_playground.git
cd lanchain4j_playground
Set the Groq API key:
export GROQ_API_KEY="your_gsk_key_here"
Prepare text files (for summarizer): Place .txt files in src/main/resources/.
Run the IT Guru Chatbot:
java org.assistant.ITAssistant
Type security questions at Ask>. The chatbot retains 20 messages of context and streams responses. Metrics (TTFT, Total Latency) appear after each answer.
Run the Human-Like Assistant:
java org.assistant.ITAssistantHumanLike
Same as above but responses appear with simulated human typing speed via CompletableFuture.
Run the Text Summarizer:
java org.assistant.TextSummarizer
Follow the interactive prompts: enter filename, summarization level (e.g., executive), and output language. Multiple files are processed concurrently using FixedThreadPool.
Type exit or quit to end any chatbot session.
Technical Architecture
Streaming: Uses LangChain4j TokenStream for reactive output.
Concurrency:CountDownLatch and CompletableFuture coordinate async LLM responses with the synchronous CLI.
Prompt Engineering: All prompts use Java Text Blocks. The IT Guru persona is enforced via @SystemMessage for Zero-Trust security principles.
Next steps: Create your own AI agent by defining a new interface with @RegisterAiService and @SystemMessage. Experiment with different Groq models for varied latency/cost tradeoffs.
What you'll learn: Build a 100% private, local-first AI document assistant using Retrieval-Augmented Generation (RAG) with Ollama embeddings and Groq inference — no cloud data uploads required.
Prerequisites
Java 21+ (required for Virtual Threads / Project Loom).
Ollama installed and running on localhost:11434.
Groq API Key set as GROQ_API_KEY environment variable.
Steps
Install and start Ollama: Download from ollama.ai and ensure it's running on the default port 11434.
Pull the embedding model:
ollama pull nomic-embed-text
Clone the repository:
git clone https://github.com/mehedicoder/document-intelligence.git
cd document-intelligence
Set the Groq API key:
export GROQ_API_KEY="your_gsk_key_here"
Prepare your documents: Place files in a local folder. Supported formats:
Documents: .pdf, .docx
Technical: .md, .markdown, .txt
Data: .csv, .json
Build and run:
./mvnw clean install
./mvnw exec:java
The application indexes your documents using Ollama's nomic-embed-text embeddings — all locally, no cloud uploads.
Ask questions: The CLI provides a "thinking" indicator followed by streaming answers. Every response includes a source citation (e.g., (Source: roadmap_2026.pdf)).
Ask follow-up questions: The system maintains conversation context, so you can refine queries without repeating information.
Key Features
100% Data Privacy: All indexing and searching happens on your hardware using local Ollama embeddings.
Virtual Thread Performance: Java 21 Virtual Threads process massive document sets in parallel.
Verified Citations: No hallucinations — every answer cites the source filename.
Streaming & Thinking: Professional CLI with thinking indicators and human-like streaming responses.
Next steps: Add more document types by extending the file parser. Experiment with different Ollama embedding models for improved retrieval quality.