github langchain4j/langchain4j 1.2.0
1.2.0 and 1.2.0-beta8

latest releases: 1.4.0, 1.3.0
one month ago

Announcements

We are excited to announce the release of the stable (1.2.0) version for the next batch of modules:

  • langchain4j-anthropic
  • langchain4j-azure-open-ai
  • langchain4j-bedrock
  • langchain4j-google-ai-gemini
  • langchain4j-mistral-ai
  • langchain4j-ollama

Many of the other LC4j modules are released under the 1.2.0-beta8 version and remain experimental/unstable.

The langchain4j-bom has been released with version 1.2.0 and includes the latest versions of all modules.

Notable Changes

  • Support thinking/reasoning by @dliubarskyi in #3380
  • Streaming partial tool calls by @dliubarskyi in #3303
  • MCP: option to automatically expose resources as tools by @jmartisk in #3302
  • OpenAI: allow setting custom chat request parameters and access raw HTTP responses and SSE events by @dliubarskyi in #2694
  • AI Services: add possibility to transform a ChatRequest before it is sent to the LLM by @mariofusco in #3378
  • AI Services: expose intermediate ChatResponses by @dliubarskyi in #3349
  • Azure OpenAI: report actual TokenUsage when using streaming chat model by @ssmogos in #3412
  • TokenStream: add callback handler before the tool is executed by @ChiaoGeek in #3179

Breaking Changes

  • Vertex AI Gemini: fix streaming model: introduce Executor to make it async by @douglas-DS in #3297
  • Azure OpenAI: removed TokenCountEstimator from streaming models by @dliubarskyi in #3431

Other Changes

  • Ollama - Partial thinking support in Ollama by @bidek in #3135
  • Fix: OpenAI, Azure OpenAI: throw ContentFilteredException in case of content filtered or refusal by @dliubarskyi in #3294
  • Update CONTRIBUTING.md to mention spotless by @glaforge in #3230
  • Gemini: add two boolean features by @neupanerabin in #3245
  • Improve DefaultMcpClient's behavior after closing by @jmartisk in #3234
  • Add mcp server health check by @Cooosin in #3241
  • Fix typo in community BOM dependency declaration by @Cooosin in #3257
  • Update documentation with Neo4j features: entity retrievers, conversation memory and graph construction feature examples by @vga91 in #3250
  • Add some docs about using MCP without AI services by @jmartisk in #3263
  • support pseduo sets in the tool schema by @jtnord in #3152
  • Fix typo in test case names by @alfonsomunozpomer in #3239
  • [minor fix] Remove unnecessary casts in RetryUtils by @vesense in #3237
  • Update grpc-protobuf dependency version to 1.68.1 by @roryp in #3161
  • Missing logprobs response parameter on Google AI Gemini's BaseGeminiChatModel class by @glaforge in #3254
  • chore(deps): replace dependency com.vackosar.gitflowincrementalbuilder:gitflow-incremental-builder with io.github.gitflow-incremental-builder:gitflow-incremental-builder by @renovate[bot] in #2475
  • Fix logging message to reflect correct number of transformed text segments by @minglu7 in #3160
  • Fix broken MCP doc link by updating to archived repository URL by @harikrishna553 in #3243
  • Use isNullOrEmpty and isNullOrBlank functions from Utils class by @TheJavaGuy in #3071
  • Remove the need for Azure dependencies at compile time by @jdubois in #3287
  • MCP: roots support by @jmartisk in #3283
  • Improve JSON extraction from LLM response by @mariofusco in #3268
  • Refactor Azure OpenAI tests to address flackiness by @kpavlov in #3280
  • minor fix wrong example code in neo4j.md by @NeatGuyCoding in #3292
  • Run integration tests on PR and main only on JDK 21 by @kpavlov in #3300
  • Parametrize baseUrl for GoogleAi Gemini models. by @kpavlov in #3272
  • Feat/OpenAI compatible docs by @LizeRaes in #3309
  • Update dependency maven to v3.9.10 by @renovate[bot] in #3314
  • Update dependency com.microsoft.onnxruntime:onnxruntime to v1.22.0 by @renovate[bot] in #3316
  • Update ai.djl.version to v0.33.0 by @renovate[bot] in #3049
  • Update dependency com.google.protobuf:protobuf-java-util to v3.25.8 by @renovate[bot] in #3313
  • Update jlama.version to v0.8.4 by @renovate[bot] in #3048
  • Reorder parameters in VespaEmbeddingStore by @timmhirsens in #3301
  • Update mikepenz/action-junit-report action to v5 by @renovate[bot] in #3318
  • feat: Playwright Support by @vesense in #3282
  • add http1.1 for LMStudio in docs by @LizeRaes in #3324
  • fix memory leak in load() of PlaywrightDocumentLoader by @NeatGuyCoding in #3327
  • Fix for #3335 by @edeandrea in #3336
  • Refactor moderation handling and improve exception details by @kpavlov in #3024
  • [Doc] Fix extra parenthesis in logging section of documentation by @harikrishna553 in #3339
  • Update dependency com.google.guava:guava to v32.1.3-jre by @renovate[bot] in #3341
  • Fix #2711 by @dliubarskyi in #3346
  • Refactor: Extract validation logic from build() into separate methods by @harikrishna553 in #3344
  • Fixed some typo in the documentation by @sunyuhan1998 in #3342
  • support api key authentication for Bedrock API by @0x-fang in #3332
  • Fix anthropic cache to add cache only last item in systemMessage/Tool list by @Claudio-code in #3337
  • fix:extended IT MCP rewiring wait time by @Cooosin in #3325
  • Update OpenAI Java to v2.13.1 by @YSZhuoyang in #3366
  • Fix bedrock streaming model hangs, when using tools. by @tomas1885 in #3397
  • Apply AssertJ best practices as of July 2025 by @timtebeek in #3398
  • Simplify equals() method in TableDefinition using Objects.equals by @harikrishna553 in #3400
  • Fix npe in DefaultToolExecutor by @weiping-code in #3406
  • Introduce SPI for building instances of the GuardrailService by @edeandrea in #3388
  • Fix class-level Javadoc: use singular Document and update Tika format… by @harikrishna553 in #3387
  • Bump on-headers and compression in /docs by @dependabot[bot] in #3376
  • Add support for loading documents with custom DocumentParser by @harikrishna553 in #3386
  • Add some unit tests for tool_calls arguments has null value by @weiping-code in #3407
  • Add overload of load method to SeleniumDocumentLoader for raw content loading by @harikrishna553 in #3371
  • Replaced usage of DefaultCredentialsProvider.create() with DefaultCredentialsProvider.builder().build() by @harikrishna553 in #3368
  • Imorovized the doc and testcases for loadDocument to Support Branch, … by @harikrishna553 in #3367
  • document JSON Codec SPI by @camilojc in #3305
  • Update dependency org.apache.commons:commons-lang3 to v3.18.0 [SECURITY] by @renovate[bot] in #3352
  • Remove unused imports from chat request JSON package by @harikrishna553 in #3350
  • Add varargs overload for splitAll to DocumentSplitter by @harikrishna553 in #3348
  • Update dependency com.google.cloud:libraries-bom to v26.63.0 by @renovate[bot] in #3340
  • Update tinylog.version to v2.7.0 by @renovate[bot] in #3317
  • Update dependency com.google.cloud:google-cloud-aiplatform to v3.68.0 by @renovate[bot] in #3315
  • Fix broken link to self-query retriever documentation by @harikrishna553 in #3411
  • minor fix findJsonEnd for json array by @NeatGuyCoding in #3307
  • fix dependency convergence rule due to commons-lang3 version by @olamy in #3418
  • Refactor equals method to use Objects.equals for improved readability by @harikrishna553 in #3416
  • Add graph transformer section by @vga91 in #3110
  • Update dependency com.fasterxml.jackson:jackson-bom to v2.19.2 by @renovate[bot] in #3422
  • Update dependency com.openai:openai-java to v2.19.1 by @renovate[bot] in #3421
  • Filtering Metadata with Infinispan (#720) by @karesti in #3399
  • Langchain4j DefaultMcpClient resource leak on throwed constructor (#2977) by @Zalewa in #3343
  • [Fix] Fix the testcase should_load_and_parse_html_document by @harikrishna553 in #3430
  • Update dependency maven to v3.9.11 by @renovate[bot] in #3428
  • Add varargs overload for transformAll in TextSegmentTransformer by @harikrishna553 in #3424
  • Update ai-mocks.version to v0.4.6 by @renovate[bot] in #3425
  • Introduce SPI for building instances of the InputGuardrailExecutorBuilder/OutputGuardrailExecutorBuilder instances by @edeandrea in #3434
  • Ollama - Add support for tracking and retrieving capabilities in Ollama models by @bidek in #3134
  • Google Vertex AI: add custom credentials by @mdii in #3393
  • [Fix] fix potential multi-threading problems in InfinispanMetadataFilterMapper and add unit tests by @NeatGuyCoding in #3445

New Contributors

Full Changelog: 1.1.0...1.2.0

Don't miss a new langchain4j release

NewReleases is sending notifications on new releases.