$ show langchain4j/langchain4j-community
This repository is a community-maintained extension of LangChain4j, a Java library for building LLM-powered applications. It provides over 50 modular integrations with third-party AI model providers (Cohere, DashScope/Qwen, Zhipu AI, Qianfan, Xinference, OCI GenAI, TwelveLabs, ChatGLM), vector/embedding stores (Redis, Neo4j, CockroachDB, YugabyteDB, SQL Server, ClickHouse, OceanBase, Vearch, DuckDB, LanceDB, DynamoDB, Hazelcast, ArcadeDB, AlloyDB, Cloud SQL PG, S3 Vectors, MemFile, JVector), chat memory stores (SQL, MongoDB, Redis, Neo4j, DuckDB, CockroachDB, YugabyteDB, Hazelcast), web search engines (Brave, Serply, SearXNG, DuckDuckGo, Firecrawl), document loaders (Confluence, GitLab, Exa), document parsers (LlamaParse), document transformers (LLM graph extraction), code execution engines (Docker, local), browser execution engines (Playwright), agent tools (Jira, Xquik, Salt, Darkmoon, Live Tennis, web scraper, browser use), and MCP server support. The architecture follows a modular monorepo pattern with each integration as a separate Maven module, implementing standard LangChain4j interfaces (ChatModel, EmbeddingModel, EmbeddingStore, ChatMemoryStore, WebSearchEngine, Tool, ContentRetriever). All modules use a consistent builder pattern for configuration and provide Spring Boot auto-configuration (both for Spring Boot 3 and 4) via separate starter modules. The codebase includes extensive unit and integration tests using Testcontainers and real API keys, ensuring production readiness. Key entry points include the model classes (e.g., QwenChatModel, CohereChatModel), embedding store classes (e.g., Neo4jEmbeddingStore, RedisEmbeddingStore), and Spring Boot auto-configuration classes. The repository serves as a catalog of community-contributed integrations that extend the core LangChain4j framework, enabling developers to easily connect to various LLM providers and data stores without writing custom adapters.
The LLM identified 5 files worth highlighting for reuse:
Implements Maximum Marginal Relevance (MMR) for selecting diverse and relevant items from a set of embeddings. This stateless utility class can be reused across any embedding store or retrieval system to balance relevance and diversity. It demonstrates a clean, self-contained algorithm implementation with no internal dependencies beyond core LangChain4j types.
Provides type-safe encoding and decoding of float and double values for DynamoDB storage, overcoming DynamoDB's lack of native floating-point support by storing values as tagged strings. This component solves a common data engineering problem when using DynamoDB for vector embeddings and can be extracted and reused in any Java project interacting with DynamoDB.
Defines a strategy pattern interface for serializing and deserializing embedding stores to files. The interface is minimal and generic, allowing multiple serialization formats (JSON, binary, etc.) to be plugged in. This pattern is reusable for any project needing persistent storage of in-memory data structures with swappable serialization backends.
Provides a reusable retry utility with exponential backoff and jitter for handling transient database failures (e.g., serialization errors). The implementation is self-contained, configurable, and can be extracted into any Java project requiring resilient database operations. It demonstrates proper use of Thread.sleep with exponential delay and random jitter to avoid thundering herd problems.
Translates LangChain4j's generic Filter expressions into RedisSearch query syntax, supporting numeric, tag, and text field comparisons. This component exemplifies a clean mapping pattern that can be adapted for other databases or search engines. It handles edge cases like null values, nested conditions, and field type inference, making it a robust foundation for building filter-to-query translators.