HelidonHelidon4.5.0

In-Process Embedding Models

Helidon LangChain4j in-process embedding models provider

Maven Coordinates

In addition to the LangChain4j integration core dependencies, add:

pom.xml
<dependency>
  <groupId>io.helidon.integrations.langchain4j.providers</groupId>
  <artifactId>helidon-integrations-langchain4j-providers-lc4j-in-process</artifactId>
</dependency>

Depending on configured model type, add model artifact dependencies as follows:

  • For type: all_minilm_l6_v2, add:
    pom.xml
    <dependency>
      <groupId>dev.langchain4j</groupId>
      <artifactId>langchain4j-embeddings-all-minilm-l6-v2</artifactId>
    </dependency>
    
  • For type: all_minilm_l6_v2_q, add:
    pom.xml
    <dependency>
      <groupId>dev.langchain4j</groupId>
      <artifactId>langchain4j-embeddings-all-minilm-l6-v2-q</artifactId>
    </dependency>
    
  • For type: custom, no additional model-specific dependency is required. Configure path-to-model, path-to-tokenizer, and pooling-mode.

In-Process Embedding Model

Provider key: lc4j-in-process.

LangChain4j in-process embedding models run ONNX embedding inference locally in your process (see LangChain4j documentation).

In Helidon, a named entry under langchain4j.models with provider: lc4j-in-process is created as a named singleton declarative service bean in the Helidon service registry. This is how foo-bar-embedding-model becomes available for content retrievers and direct injection.

application.yaml
langchain4j:

  models:
    foo-bar-embedding-model:1
      provider: lc4j-in-process
      type: all_minilm_l6_v2_q2

  content-retrievers:
    foo-bar-content-retriever:
      provider: lc4j-content-retriever
      embedding-model: foo-bar-embedding-model3
      embedding-store: foo-bar-inmemory-embedding-store
  1. Creates a named embedding model singleton bean (foo-bar-embedding-model) in Helidon.
  2. Sets provider defaults for in-process embedding model creation.
  3. Uses the named in-process embedding model from the service registry.

For type: custom, configure model and tokenizer paths and pooling mode:

application.yaml
langchain4j:
  models:
    foo-bar-content-retriever:
      provider: lc4j-in-process
      type: custom1
      path-to-model: "/models/custom-embeddings/model.onnx"2
      path-to-tokenizer: "/models/custom-embeddings/tokenizer.json"3
      pooling-mode: mean4
  1. Uses user-provided ONNX model.
  2. Required for custom type.
  3. Required for custom type.
  4. Required for custom type; maps to LangChain4j pooling mode.

If type: custom is selected but any of path-to-model, path-to-tokenizer, or pooling-mode is missing, Helidon fails startup with a configuration exception.

@Service.Singleton
public class EmbeddingModelConsumer {
    EmbeddingModelConsumer(@Service.Named("foo-bar-embedding-model") EmbeddingModel embeddingModel) {1
    }
}
  1. Injects the named in-process embedding model bean directly into another Helidon declarative service.

Configuration properties:

Configuration options

KeyTypeDefaultDescription
path-to-tokenizerPathThe path to the tokenizer file (e.g., "/path/to/tokenizer.json")
path-to-modelPathThe path to the modelPath file (e.g., "/path/to/model.onnx")
executorThreadPoolConfigExecutor configuration used by the embedding model
pooling-modePoolingModeThe pooling model to use
typeInProcessModelTypeWhich in-process ONNX model variant should be used
enabledBooleantrueWhether the embedding model is enabled

Additional Information

Copyright © 2018, 2026 Oracle and/or its affiliates.