Artificial Intelligence 7 min read

What’s New in LangChain4j 1.0.0? A Deep Dive into Java AI SDK Features

LangChain4j 1.0.0 brings official OpenAI SDK support, GitHub Models integration, expanded database and vector store compatibility, customizable HTTP clients, and clear migration steps for renamed interfaces and streaming methods, marking a major milestone for Java AI development.

Java Architecture Diary
Java Architecture Diary
Java Architecture Diary
What’s New in LangChain4j 1.0.0? A Deep Dive into Java AI SDK Features
KoKprS
KoKprS

📌 Introduction

LangChain4j is a leading Java AI SDK that revolutionizes the integration of large language models (LLM) with Java applications, offering comprehensive abstractions and toolchains for rapid development.

Version 1.0.0 marks enterprise‑grade maturity, establishing Java’s dominance in AI application development and surpassing Spring AI.

✨ Core New Features

🔹 Official OpenAI Java SDK Support

LangChain4j now integrates the official OpenAI Java SDK, providing better compatibility, stability, and security.

<code>ChatModel model = OpenAiOfficialChatModel.builder()
    .modelName(ChatModel.GPT_4O)
    .apiKey(System.getenv("OPENAI_API_KEY"))
    .build();</code>

🔹 GitHub Models Integration

The new version supports Azure AI Inference API to access GitHub Models with automatic GITHUB_TOKEN authentication.

<code>ChatModel model = OpenAiOfficialChatModel.builder()
    .modelName(ChatModel.GPT_4O_MINI)
    .isGitHubModels(true)
    .build();</code>

💾 Wider Database and Vector Store Support

🔹 Neo4j Integration

Deep integration with the Neo4j graph database adds:

Neo4jEmbeddingStore for storing and querying vector embeddings in Neo4j.

Neo4jText2CypherRetriever to generate and execute Cypher queries from user questions.

This enables building GraphRAG applications that leverage data relationships to enhance LLM reasoning.

🔹 MongoDB Atlas Integration

Native support for MongoDB Atlas as an embedding store.

<code>MongoClient mongoClient = MongoClients.create("mongodb+srv://...");
MongoCollection<Document> collection = mongoClient
    .getDatabase("langchain4j")
    .getCollection("embeddings");

EmbeddingStore<TextSegment> embeddingStore = MongoDBAtlasEmbeddingStore.builder()
    .collection(collection)
    .build();</code>

🔹 Google Cloud Database Integration

Added support for:

AlloyDB PostgreSQL.

Cloud SQL for PostgreSQL.

🔹 Customizable HTTP Client

LangChain4j 1.0.0 allows custom HTTP client configuration. Two built‑in implementations are provided:

JDK HttpClient – default for core modules.

Spring RestClient – default for Spring Boot integration.

Custom JDK HttpClient example:

<code>HttpClient.Builder httpClientBuilder = HttpClient.newBuilder()
        .sslContext(customSslContext)
        .connectTimeout(Duration.ofSeconds(30));

JdkHttpClientBuilder jdkHttpClientBuilder = JdkHttpClient.builder()
        .httpClientBuilder(httpClientBuilder);

OpenAiChatModel model = OpenAiChatModel.builder()
        .httpClientBuilder(jdkHttpClientBuilder)
        .apiKey(System.getenv("OPENAI_API_KEY"))
        .modelName("gpt-4o-mini")
        .build();</code>

⚠️ Breaking Changes and Migration Guide

Core Interface Renaming

Old interface

ChatLanguageModel

is renamed to

ChatModel

;

StreamingChatLanguageModel

becomes

StreamingChatModel

. Update all references accordingly.

Streaming API Method Adjustments

Method

onNext()

is replaced by

onPartialResponse()

, and

onComplete()

is replaced by

onCompleteResponse()

. Adjust streaming response handling code.

Internal Utility Changes

Some previously public but unintended classes are now marked @Internal and may be renamed or reorganized. Avoid direct usage and rely on the public API.

Deprecated APIs Removal

Interfaces previously marked @deprecated have been removed; migrate to their non‑deprecated alternatives.

📝 Summary

LangChain4j 1.0.0 is a milestone release that introduces extensive new features, broader database support, customizable networking, and a stable API, while providing clear migration guidance for breaking changes.

For a complete tutorial updated to 1.0.0, visit the official documentation at https://javaai.pig4cloud.com/introduction.

JavaLLMOpenAIMongoDBNeo4jLangChain4jAI SDK
Java Architecture Diary
Written by

Java Architecture Diary

Committed to sharing original, high‑quality technical articles; no fluff or promotional content.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.