HelidonHelidon4.5.6

Cohere

LangChain4j Cohere

Overview

This module adds support for selected Cohere models.

Maven Coordinates

In addition to the Helidon integration with LangChain4j core dependencies, you must add the following:

pom.xml
<dependency>
  <groupId>io.helidon.integrations.langchain4j.providers</groupId>
  <artifactId>helidon-integrations-langchain4j-providers-cohere</artifactId>
</dependency>

CohereEmbeddingModel

To automatically create and add CohereEmbeddingModel to the service registry add the following lines to application.yaml:

application.yaml
langchain4j:
  providers:
    cohere:
      api-key: "${COHERE_TOKEN}"

  models:
    cohere-embedding-model:
      provider: cohere
      model-name: "embed-english-v3.0"

If enabled is set to false, the configuration is ignored, and the component is not created.

Configuration options

KeyTypeDescription
api-keystringRequired. The API key used to authenticate requests to the Cohere API.
base-urlstringThe base URL for the model API. If not present, the default value supplied from LangChain4j is used.
custom-headersMap<string, string>A map containing custom headers.
enabledbooleanIf set to false, this component will not be available even if configured.
input-typestringInput type.
log-requestsbooleanWhether to log API requests.
log-responsesbooleanWhether to log API responses.
max-segments-per-batchintMaximum number of segments per batch.
model-namestringThe model name to use.
timeoutdurationThe timeout setting for API requests. See here for the format.

CohereScoringModel

To automatically create and add CohereScoringModel to the service registry add the following lines to application.yaml:

application.yaml
langchain4j:
  providers:
    cohere:
      api-key: "${COHERE_TOKEN}"

  models:
    cohere-scoring-model:
      provider: cohere
      model-name: "rerank-english-v3.0"

If enabled is set to false, the configuration is ignored, and the component is not created.

Configuration options

KeyTypeDescription
api-keystringRequired. The API key used to authenticate requests to the Cohere API.
base-urlstringThe base URL for the model API. If not present, the default value supplied from LangChain4j is used.
custom-headersMap<string, string>A map containing custom headers.
enabledbooleanIf set to false, this component will not be available even if configured.
http-client-builderinjected beanHTTP client builder to use. The default service is injected when available; select a named service with http-client-builder.service-registry.named.
http-client-builder-discover-servicesbooleanWhether to enable automatic service discovery for http-client-builder. Defaults to true.
log-requestsbooleanWhether to log API requests.
log-responsesbooleanWhether to log API responses.
max-retriesintThe maximum number of retries for failed API requests.
model-namestringThe model name to use.
proxyinjected beanDeprecated. Legacy HTTP or SOCKS proxy. The default service is injected when available; select a named service with proxy.service-registry.named.
proxy-discover-servicesbooleanWhether to enable automatic service discovery for the deprecated proxy option. Defaults to true.
timeoutdurationThe timeout setting for API requests. See here for the format.

Prefer http-client-builder for new configurations. The deprecated proxy option remains available for compatibility and supports direct (no proxy), HTTP, and SOCKS modes. A programmatically or declaratively configured, including named, http-client-builder takes precedence over proxy. An equivalently configured proxy takes precedence over a default-discovered HTTP client builder. If both options are only default-discovered, the HTTP client builder takes precedence.

Additional Information

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