langchain4j-ai-services-patterns

Solid

Provides patterns to build declarative AI Services with LangChain4j for LLM integration, chatbot development, AI agent implementation, and conversational AI in Java. Generates type-safe AI services using interface-based patterns, annotations, memory management, and tools integration. Use when creating AI-powered Java applications with minimal boilerplate, implementing conversational AI with memory, or building AI agents with function calling.

AI & Automation 263 stars 31 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 89/100

Stars 20%
81
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# LangChain4j AI Services Patterns This skill provides guidance for building declarative AI Services with LangChain4j using interface-based patterns, annotations for system and user messages, memory management, tools integration, and advanced AI application patterns that abstract away low-level LLM interactions. ## Overview LangChain4j AI Services define AI functionality using Java interfaces with annotations, providing type-safe, declarative AI with minimal boilerplate. ## When to Use Use this skill when: - Building declarative AI services with minimal boilerplate using Java interfaces - Creating type-safe conversational AI with memory management - Implementing AI agents with function/tool calling capabilities - Designing AI services returning structured data (enums, POJOs, lists) - Integrating RAG patterns declaratively ## Instructions Follow these steps to create declarative AI Services with LangChain4j: ### 1. Define AI Service Interface Create a Java interface with method signatures for AI interactions: ```java interface Assistant { String chat(String userMessage); } ``` ### 2. Add Annotations for System and User Messages Use `@SystemMessage` and `@UserMessage` annotations to define prompts: ```java interface CustomerSupportBot { @SystemMessage("You are a helpful customer support agent for TechCorp") String handleInquiry(String customerMessage); @UserMessage("Analyze sentiment: {{it}}") Sentiment analyzeSentiment(String feedback); } ``` ...

Details

Author
giuseppe-trisciuoglio
Repository
giuseppe-trisciuoglio/developer-kit
Created
7 months ago
Last Updated
1 weeks ago
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Solid

langchain4j-spring-boot-integration

Provides integration patterns for LangChain4j with Spring Boot. Configures AI model beans, sets up chat memory with Spring context, integrates RAG pipelines with Spring Data, and handles auto-configuration, dependency injection, and Spring ecosystem integration. Use when embedding LangChain4j into Spring Boot applications, building Java LLM applications with @Bean configuration, or setting up Spring AI patterns.

263 Updated 1 weeks ago
giuseppe-trisciuoglio
AI & Automation Solid

langchain4j-testing-strategies

Provides unit test, integration test, and mock AI patterns for LangChain4j applications. Creates mock LLM responses, tests retrieval chains, validates RAG workflows, and implements Testcontainers-based integration tests for Java AI services. Use when unit testing AI services, integration testing LangChain4j components, mocking AI models, or testing LLM-based Java applications.

263 Updated 1 weeks ago
giuseppe-trisciuoglio
AI & Automation Listed

java-spring-ai

Use when the user asks to add AI features, integrate Spring AI or LangChain4J, build a chatbot, implement RAG (retrieval-augmented generation), use vector stores, stream LLM responses, or call AI tools/functions in a Spring Boot project.

0 Updated today
limited-grisaille833
AI & Automation Solid

langchain4j-rag-implementation-patterns

Provides Retrieval-Augmented Generation (RAG) implementation patterns with LangChain4j for Java. Generates document ingestion pipelines, embedding stores, vector search, and semantic search capabilities. Use when building chat-with-documents systems, document Q&A over PDFs or text files, AI assistants with knowledge bases, semantic search over document repositories, or knowledge-enhanced AI applications with source attribution.

263 Updated 1 weeks ago
giuseppe-trisciuoglio
AI & Automation Solid

langchain4j-mcp-server-patterns

Provides LangChain4j patterns for implementing MCP (Model Context Protocol) servers, creating Java AI tools, exposing tool calling capabilities, and integrating MCP clients with AI services. Use when building a Java MCP server, implementing tool calling in Java, connecting LangChain4j to external MCP servers, or securing tool exposure for agent workflows.

263 Updated 1 weeks ago
giuseppe-trisciuoglio