IBM watsonx.ai Chat and Generation Models

IBM watsonx.ai enables the development of generative AI applications using foundation models from IBM and Hugging Face.

This extension supports IBM watsonx as a service on IBM Cloud only.

Prerequisites

To use watsonx.ai models, configure the following required values in your application.properties file:

Base URL

The base-url depends on the region of your service instance:

quarkus.langchain4j.watsonx.base-url=https://us-south.ml.cloud.ibm.com

Project ID

Obtain the Project Id via:

quarkus.langchain4j.watsonx.project-id=23d...
You may use the optional space-id as an alternative.

API Key

Create an API key by visiting https://cloud.ibm.com/iam/apikeys and clicking Create +.

quarkus.langchain4j.watsonx.api-key=your-api-key
You can also use the QUARKUS_LANGCHAIN4J_WATSONX_API_KEY environment variable.

Dependency

Add the following dependency to your project:

<dependency>
  <groupId>io.quarkiverse.langchain4j</groupId>
  <artifactId>{provider-artifact}</artifactId>
  <version>1.7.2</version>
</dependency>

Even better, if you use the Quarkus platformn BOM (default for projects generated), add the Quarkus Langchain4J BOM and all dependency versions will align:

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>${quarkus.platform.group-id}</groupId>
                <artifactId>${quarkus.platform.artifact-id}</artifactId>
                <version>${quarkus.platform.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>${quarkus.platform.group-id}</groupId>
                <artifactId>quarkus-langchain4j-bom</artifactId> (1)
                <version>${quarkus.platform.version}</version> (2)
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
      <dependency>
        <groupId>io.quarkiverse.langchain4j</groupId>
        <artifactId>{provider-artifact}</artifactId>
        (3)
      </dependency>
    </dependencies>
1 In your dependencyManagement section, add the quarkus-langchain4j-bom
2 Inherit the version from your platform version
3 Voilà, no need for version alignment anymore

If no other extension is installed, AI Services will automatically use this provider.

Chat Model

IBM watsonx.ai provides a variety of foundation models for text generation, chat-based interactions, and instruction-following tasks. These include both IBM-built models and third-party / community models. Quarkus integrates the LangChain4j WatsonxChatModel, exposing it as ChatModel / StreamingChatModel bean.

See the full model catalog:

Configuration

Configure the chat model in your application.properties:

quarkus.langchain4j.watsonx.mode=chat

Each mode has its own configuration namespace:

  • chat: quarkus.langchain4j.watsonx.chat-model

  • generation: quarkus.langchain4j.watsonx.generation-model

Chat Mode Example

quarkus.langchain4j.watsonx.base-url=${BASE_URL}
quarkus.langchain4j.watsonx.api-key=${API_KEY}
quarkus.langchain4j.watsonx.project-id=${PROJECT_ID}

# Chat model
quarkus.langchain4j.watsonx.chat-model.model-name=ibm/granite-4-h-small

# Optional generation parameters
quarkus.langchain4j.watsonx.chat-model.max-output-tokens=0
quarkus.langchain4j.watsonx.chat-model.temperature=0.2

If a chat model is configured, Quarkus automatically registers a ChatModel / StreamingChatModel bean.

Injection

@Inject
ChatModel chatModel;

@Inject
StreamingChatModel chatModel;

Enabling Thinking / Reasoning Output

Some foundation models can include internal reasoning (also referred to as thinking) steps as part of their responses. Depending on the model, this reasoning may be embedded in the same text as the final response, or returned separately in a dedicated field from watsonx.ai.

To correctly enable and capture this behavior in Quarkus, you must configure the chat model with either thinking.tags (for ExtractionTags) or thinking.effort / thinking (for ThinkingEffort or boolean flag) in your application.properties. This ensures that LangChain4j can automatically extract the reasoning and response content from the model output.

Models that return reasoning and response together

Use ExtractionTags when the model outputs reasoning and response in the same text string. The tags define XML-like markers used to separate the reasoning from the final response.

# Example configuration for ibm/granite-3-3-8b-instruct
quarkus.langchain4j.watsonx.chat-model.model-name=ibm/granite-3-3-8b-instruct
quarkus.langchain4j.watsonx.chat-model.thinking.tags.think=think
quarkus.langchain4j.watsonx.chat-model.thinking.tags.response=response

Behavior

  • If both tags are specified, they are used directly to extract reasoning and response segments.

  • If only the reasoning tag is specified, everything outside that tag is considered the response.

@Inject
ChatModel thinkingChatModel;

var chatResponse = thinkingChatModel.chat(UserMessage.from("Why is the sky blue?"));
System.out.println(chatResponse.aiMessage().thinking());
System.out.println(chatResponse.aiMessage().text());

Models that return reasoning and response separately

For models that already return reasoning and response as separate fields, use the thinking.effort property to control how much reasoning the model applies during generation, or enable it using the boolean flag.

# Example configuration for openai/gpt-oss-120b
quarkus.langchain4j.watsonx.chat-model.model-name=openai/gpt-oss-120b
quarkus.langchain4j.watsonx.chat-model.thinking.effort=HIGH

Streaming Example

@Inject
StreamingChatModel streamingChatModel;

List<ChatMessage> messages = List.of(UserMessage.from("Why is the sky blue?"));

ChatRequest chatRequest = ChatRequest.builder()
    .messages(messages)
    .build();

streamingChatModel.chat(chatRequest, new StreamingChatResponseHandler() {

    @Override
    public void onPartialResponse(String partialResponse) {
        System.out.println("Partial: " + partialResponse);
    }

    @Override
    public void onPartialThinking(PartialThinking partialThinking) {
        System.out.println("Thinking: " + partialThinking.content());
    }

    @Override
    public void onCompleteResponse(ChatResponse completeResponse) {
        System.out.println("Complete: " + completeResponse);
    }

    @Override
    public void onError(Throwable error) {
        error.printStackTrace();
    }
});
  • Ensure that the selected model supports reasoning output.

  • Use thinking.tags for models that embed reasoning and response in a single text string.

  • Use thinking.effort or thinking=true for models that already separate reasoning and response automatically.

Embedding Model

IBM watsonx.ai provides multiple embedding models for converting text into vector representations suitable for semantic search, RAG pipelines, similarity comparison, and vector database integrations.

Quarkus integrates the LangChain4j WatsonxEmbeddingModel, exposing it as EmbeddingModel bean.

A list of supported embedding models can be found here:

Configuration

Configure the embedding model by specifying its model name in application.properties:

# Base Watsonx configuration
quarkus.langchain4j.watsonx.base-url=${BASE_URL}
quarkus.langchain4j.watsonx.api-key=${API_KEY}
quarkus.langchain4j.watsonx.project-id=${PROJECT_ID}

# Embedding model configuration
quarkus.langchain4j.watsonx.embedding-model.model-name=ibm/slate-125m-english-rtrvr

If an embedding model is configured, Quarkus will automatically create and register a EmbeddingModel bean.

Injection

@Inject
EmbeddingModel embeddingModel;

Usage

Generating an embedding for a single text:

var response = embeddingModel.embed("Hello Watsonx!");

assertNotNull(response);
var embedding = response.content();

System.out.println("Embedding size: " + embedding.vector().length());

Generating embeddings for multiple text segments:

var embeddings = embeddingModel.embedAll(
    List.of(
        TextSegment.from("First document"),
        TextSegment.from("Second document")
    )
);

Scoring Model

IBM watsonx.ai provides scoring (reranking) models that evaluate the relevance between a query and a piece of text. Quarkus integrates the LangChain4j WatsonxScoringModel, exposing it as ScoringModel implementation.

Scoring models are especially useful for RAG pipelines, document ranking, and semantic relevance evaluation.

A list of supported scoring/reranker models is available here:

Configuration

Configure the model by specifying its name in application.properties:

# Base Watsonx configuration
quarkus.langchain4j.watsonx.base-url=${BASE_URL}
quarkus.langchain4j.watsonx.api-key=${API_KEY}
quarkus.langchain4j.watsonx.project-id=${PROJECT_ID}

# Scoring model configuration
quarkus.langchain4j.watsonx.scoring-model.model-name=cross-encoder/ms-marco-minilm-l-12-v2

If an score model is configured, Quarkus will automatically create and register a ScoringModel bean.

Injection

@Inject
ScoringModel scoringModel;

Usage

You can score a single text against a query:

var response = scoringModel.score("Rerank this!", "Test to rerank 1");

assertNotNull(response);
assertNotNull(response.content());

double score = response.content();
System.out.println("Score: " + score);

Or score multiple documents at once:

var scores = scoringModel.scoreAll(
    List.of(
        TextSegment.from("Document A"),
        TextSegment.from("Document B")
    ),
    "User query"
);

System.out.println(scores); // list of relevance scores

Moderation Model

IBM watsonx.ai provides moderation capabilities through multiple detectors that can identify unsafe, sensitive, or policy-violating content. Quarkus integrates the LangChain4j WatsonxModerationModel, exposing each detector type as a dedicated configuration group.

Supported detector types include:

  • PII – Detects Personally Identifiable Information

  • HAP – Detects hate, abuse, or profanity

  • Granite Guardian – Detects harmful or risky content

Each detector can be enabled individually.

Configuration

Enable detectors in application.properties using their dedicated flags:

# Base Watsonx configuration
quarkus.langchain4j.watsonx.base-url=${BASE_URL}
quarkus.langchain4j.watsonx.api-key=${API_KEY}
quarkus.langchain4j.watsonx.project-id=${PROJECT_ID}

# Enable specific moderation detectors
quarkus.langchain4j.watsonx.moderation-model.hap.enabled=true
quarkus.langchain4j.watsonx.moderation-model.pii.enabled=true
quarkus.langchain4j.watsonx.moderation-model.granite-guardian.enabled=true

Each detector configuration group may also expose additional settings depending on its capabilities. If an score model is configured, Quarkus will automatically create and register a ModerationModel bean.

Injection

@Inject
ModerationModel moderationModel;

Usage

var response = moderationModel.moderate("Some text to analyze");

boolean flagged = response.content().flagged();
Map<String, Object> metadata = response.metadata();

System.out.println("Flagged? " + flagged);
System.out.println("Metadata: " + metadata);

Metadata

A moderation response includes metadata describing the detection:

Key Description

detection

The assigned label for the detected content

detection_type

Detector that triggered the flag

start

Start index of the detected segment

end

End index of the detected segment

score

Confidence score

Example:

System.out.println(metadata.get("detection_type"));
System.out.println(metadata.get("score"));

Text Extraction

The TextExtraction feature enables developers to extract text from high-value business documents stored in IBM Cloud Object Storage. Extracted text can be used for AI processing, key information identification, or further document analysis.

The API supports text extraction from the following file types:

  • PDF

  • GIF

  • JPG

  • PNG

  • TIFF

  • BMP

  • DOC

  • DOCX

  • HTML

  • JFIF

  • PPT

  • PPTX

The extracted text can be output in the following formats:

  • JSON

  • MARKDOWN

  • HTML

  • PLAIN_TEXT

  • PAGE_IMAGES

Configuration

To enable TextExtraction in your application, configure the following properties:

quarkus.langchain4j.watsonx.base-url=${BASE_URL}
quarkus.langchain4j.watsonx.api-key=${API_KEY}
quarkus.langchain4j.watsonx.project-id=${PROJECT_ID}
quarkus.langchain4j.watsonx.text-extraction.cos-url=<base-url>
quarkus.langchain4j.watsonx.text-extraction.document-reference.connection=<connection-id>
quarkus.langchain4j.watsonx.text-extraction.document-reference.bucket-name=<bucket-name>
quarkus.langchain4j.watsonx.text-extraction.results-reference.connection=<connection-id>
quarkus.langchain4j.watsonx.text-extraction.results-reference.bucket-name=<bucket-name>
  • cos-url: The endpoint where the IBM Cloud Object Storage instance is deployed. To find the appropriate value, refer to the IBM Cloud Object Storage endpoint table.

  • document-reference.connection: The connection asset ID containing credentials to access the source storage.

  • document-reference.bucket-name: The bucket where documents to be processed will be uploaded.

  • results-reference.connection: The connection asset ID containing credentials to access the output storage.

  • results-reference.bucket-name: The bucket where extracted text documents will be saved as new files.

The document reference properties define the source storage for input and uloaded files, while the results reference properties specify where the extracted content is stored. Both can refer to the same bucket or different ones.

For more information on how to get the connection parameter for the document-reference and results-reference you can refer to the documentation at this link.

Using Text Extraction

The TextExtraction class provides multiple methods for extracting text from documents. You can either extract text from an existing file in IBM Cloud Object Storage or upload a file and extract its content. To use TextExtraction, you need to inject an instance into your application. If multiple configurations are defined, you can specify the appropriate one using the @ModelName qualifier.

@Inject
TextExtractionService textExtraction;

@Inject
@ModelName("custom")
TextExtractionService customTextExtraction;

You can start the extraction process in two ways.

First, if the document is already stored in IBM Cloud Object Storage, you can initiate the extraction by using the following method:

TextExtractionResponse response = textExtraction.startExtraction("path/to/document");
String id = response.metadata().id();

Alternatively, if you’re working with a local file, you can upload it and start the extraction process with:

File file = new File("path/to/document");
File response = textExtraction.uploadAndStartExtraction(file);
String id = response.metadata().id();

After starting the extraction, you can check its status by calling:

TextExtractionResponse response = textExtraction.fetchExtractionRequest(extractionId);
String result = response.entity().results().status();

If you need to extract and retrieve the text immediately, you have two options.

You can either extract text from an existing file directly:

String extractedText = textExtraction.extractAndFetch("path/to/document");

Or upload the file and retrieve the extracted text immediately:

File file = new File("path/to/document");
String extractedText = textExtraction.uploadExtractAndFetch(file);

All extraction methods can accept a Parameters object to customize the behavior of the text extraction request.

The Parameters object allows fine-grained control over the extraction process.

var parameters = TextExtractionParameters.builder()
        .removeOutputFile(true)
        .removeUploadedFile(true)
        .requestedOutputs(MD)
        .mode(Mode.HIGH_QUALITY)
        .autoRotationCorrection(false)
        .outputDpi(16)
        .build()

File file = new File("path/to/document.pdf");
String extractedText = textExtraction.uploadExtractAndFetch(file, parameters));

Text Classification

The TextClassification feature enables you to classify text in your documents to identify whether the data in your file matches the key-value pair format in schema definitions for various document types.

By pre-processing the document, you can quickly verify whether a document is classified into one of the pre-defined schemas or a custom schema without performing key-value pair extraction, which can be a longer, resource-intensive process. You can then decide which schema to use to correctly extract text into fields in a key-value pair format.

The API supports text classification from the following file types:

  • BMP

  • DOC

  • DOCX

  • GIF

  • HTML

  • JFIF

  • JPG

  • MARKDOWN

  • PDF

  • PNG

  • PPT

  • PPTX

  • TIFF

  • XLSX

Configuration

To enable TextClassification in your application, configure the following properties:

quarkus.langchain4j.watsonx.base-url=${BASE_URL}
quarkus.langchain4j.watsonx.api-key=${API_KEY}
quarkus.langchain4j.watsonx.project-id=${PROJECT_ID}
quarkus.langchain4j.watsonx.text-classification.cos-url=<base-url>
quarkus.langchain4j.watsonx.text-classification.document-reference.connection=<connection-id>
quarkus.langchain4j.watsonx.text-classification.document-reference.bucket-name=<bucket-name>
  • cos-url: The endpoint where the IBM Cloud Object Storage instance is deployed. To find the appropriate value, refer to the IBM Cloud Object Storage endpoint table.

  • document-reference.connection: The connection asset ID containing credentials to access the source storage.

  • document-reference.bucket-name: The bucket where documents to be processed will be uploaded (or are already stored).

For more information on how to get the connection parameter for the document-reference you can refer to the documentation at this link.

Using Text Classification

The TextClassificationService class provides multiple methods for classifying documents. You can either classify text from an existing file in IBM Cloud Object Storage or upload a file and classify its content. To use TextClassificationService, you need to inject an instance into your application. If multiple configurations are defined, you can specify the appropriate one using the @ModelName qualifier.

@Inject
TextClassificationService classificationService;

@Inject
@ModelName("custom")
TextClassificationService customClassificationService;

You can start the classification process in two ways.

First, if the document is already stored in IBM Cloud Object Storage, you can initiate the classification by using the following method:

TextClassificationResponse response = classificationService.startClassification("path/to/document");
String id = response.metadata().id();

Alternatively, if you’re working with a local file, you can upload it and start the classification process with:

File file = new File("path/to/document");
TextClassificationResponse response = classificationService.uploadAndStartClassification(file);
String id = response.metadata().id();

After starting the classification, you can check its status by calling:

TextClassificationResponse response = classificationService.fetchClassificationRequest(classificationId);
String result = response.entity().results().status();

If you need to classify and retrieve the results immediately, you have two options.

You can either classify an existing file directly:

ClassificationResult result = classificationService.classifyAndFetch("path/to/document");

Or upload the file and retrieve the classification result immediately:

File file = new File("path/to/document");
ClassificationResult result = classificationService.uploadClassifyAndFetch(file);

All classification methods can accept a TextClassificationParameters object to customize the behavior of the request.

The TextClassificationParameters object allows fine-grained control over the classification process, including Classification Modes, OCR settings, and Semantic Configuration.

var parameters = TextClassificationParameters.builder()
        .classificationMode(ClassificationMode.EXACT)
        .languages(Language.ENGLISH, Language.FRENCH)
        .ocrMode(OcrMode.AUTO)
        .autoRotationCorrection(true)
        .removeUploadedFile(true)
        .build();

File file = new File("path/to/document.pdf");
ClassificationResult result = classificationService.uploadClassifyAndFetch(file, parameters));

Semantic Configuration

You can provide a TextClassificationSemanticConfig to the parameters. This allows you to define custom schemas, enabling the service to identify specific document types based on the presence of key-value pair fields you define.

The following example shows how to configure the service to classify a document as a specific "Invoice" type:

// 1. Define the fields expected in the document
var fields = KvpFields.builder()
    .add("invoice_date", KvpField.of("The date when the invoice was issued.", "2024-07-10"))
    .add("invoice_number", KvpField.of("The unique number identifying the invoice.", "INV-2024-001"))
    .add("total_amount", KvpField.of("The total amount to be paid.", "1250.50"))
    .build();

// 2. Define the Schema using the fields
var mySchema = Schema.builder()
    .documentDescription("A vendor-issued invoice listing purchased items, prices, and payment information.")
    .documentType("Invoice")
    .fields(fields)
    .build();

// 3. Create the Semantic Configuration
var semanticConfig = TextClassificationSemanticConfig.builder()
    .schemasMergeStrategy(SchemaMergeStrategy.REPLACE)
    .schemas(mySchema)
    .build();

// 4. Pass the configuration to the parameters
var parameters = TextClassificationParameters.builder()
    .languages(Language.ENGLISH)
    .semanticConfig(semanticConfig)
    .build();

ClassificationResult result = classificationService.uploadClassifyAndFetch(file, parameters);

Managing Requests and Files

The service also provides utility methods to manage the lifecycle of your requests and files:

// Delete a classification request history
classificationService.deleteRequest(requestId,
    TextClassificationDeleteParameters.builder().hardDelete(true).build());

// Delete a file from the bucket
classificationService.deleteFile("bucket-name", "filename.pdf");

Configuration

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

Type

Default

Whether the model should be enabled.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_ENABLED

boolean

true

Whether the embedding model should be enabled.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_EMBEDDING_MODEL_ENABLED

boolean

true

Whether the scoring model should be enabled.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_SCORING_MODEL_ENABLED

boolean

true

Specifies the mode of interaction with the LLM model.

This property allows you to choose between two modes of operation:

  • chat: prompts are automatically enriched with the specific tags defined by the model

  • generation: prompts require manual specification of tags

Allowable values: [chat, generation]

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_MODE

string

chat

Specifies the base URL of the watsonx.ai API.

A list of all available URLs is provided in the IBM Watsonx.ai documentation at the this link.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_BASE_URL

string

IBM Cloud API key.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_API_KEY

string

Timeout for watsonx.ai calls.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_TIMEOUT

Duration 

10s

The version date for the API of the form YYYY-MM-DD.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_VERSION

string

2025-04-23

The space that contains the resource.

Either space_id or project_id has to be given.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_SPACE_ID

string

The project that contains the resource.

Either space_id or project_id has to be given.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_PROJECT_ID

string

Whether the watsonx.ai client should log requests.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_LOG_REQUESTS

boolean

false

Whether the watsonx.ai client should log responses.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_LOG_RESPONSES

boolean

false

Whether the watsonx.ai client should log requests as cURL commands.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_LOG_REQUESTS_CURL

boolean

false

Whether to enable the integration. Defaults to true, which means requests are made to the watsonx.ai provider. Set to false to disable all requests.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_ENABLE_INTEGRATION

boolean

true

Base URL of the IAM Authentication API.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_IAM_BASE_URL

URL

https://iam.cloud.ibm.com

Timeout for IAM authentication calls.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_IAM_TIMEOUT

Duration 

10s

Grant type for the IAM Authentication API.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_IAM_GRANT_TYPE

string

urn:ibm:params:oauth:grant-type:apikey

Base URL of the Cloud Object Storage API.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_TEXT_EXTRACTION_BASE_URL

string

required

The ID of the connection asset that contains the credentials required to access the data.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_TEXT_EXTRACTION_DOCUMENT_REFERENCE_CONNECTION

string

required

The name of the bucket containing the input document.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_TEXT_EXTRACTION_DOCUMENT_REFERENCE_BUCKET_NAME

string

required

The ID of the connection asset used to store the extracted results.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_TEXT_EXTRACTION_RESULTS_REFERENCE_CONNECTION

string

required

The name of the bucket where the output files will be written.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_TEXT_EXTRACTION_RESULTS_REFERENCE_BUCKET_NAME

string

required

Whether the Cloud Object Storage client should log requests.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_TEXT_EXTRACTION_LOG_REQUESTS

boolean

false

Whether the Cloud Object Storage client should log responses.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_TEXT_EXTRACTION_LOG_RESPONSES

boolean

false

Specifies the model to use for the chat completion.

A list of all available models is provided in the IBM watsonx.ai documentation at the this link.

To use a model, locate the API model ID column in the table and copy the corresponding model ID.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_MODEL_NAME

string

meta-llama/llama-4-maverick-17b-128e-instruct-fp8

Specifies how the model should choose which tool to call during a request.

This value can be:

  • auto: The model decides whether and which tool to call automatically.

  • required: The model must call one of the available tools.

If toolChoiceName is set, this value is ignored.

Setting this value influences the tool-calling behavior of the model when no specific tool is required.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_TOOL_CHOICE

auto, required, none

Specifies the name of a specific tool that the model must call.

When set, the model will be forced to call the specified tool. The name must exactly match one of the available tools defined for the service.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_TOOL_CHOICE_NAME

string

Positive values penalize new tokens based on their existing frequency in the generated text, reducing the likelihood of the model repeating the same lines verbatim.

Possible values: -2 < value < 2

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_FREQUENCY_PENALTY

double

0

Specifies whether to return the log probabilities of the output tokens.

If set to true, the response will include the log probability of each output token in the content of the message.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_LOGPROBS

boolean

false

An integer specifying the number of most likely tokens to return at each token position, each with an associated log probability. The option logprobs must be set to true if this parameter is used.

Possible values: 0 ≤ value ≤ 20

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_TOP_LOGPROBS

int

The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model’s context length. Set to 0 for the model’s configured max generated tokens.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_MAX_TOKENS

int

1024

Specifies how many chat completion choices to generate for each input message.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_N

int

1

Applies a penalty to new tokens based on whether they already appear in the generated text so far, encouraging the model to introduce new topics rather than repeat itself.

Possible values: -2 < value < 2

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_PRESENCE_PENALTY

double

0

Random number generator seed to use in sampling mode for experimental repeatability.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_SEED

int

Defines one or more stop sequences that will cause the model to stop generating further tokens if any of them are encountered in the output.

This allows control over where the model should end its response. If a stop sequence is encountered before the minimum number of tokens has been generated, it will be ignored.

Possible values: 0 ≤ number of items ≤ 4

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_STOP

list of string

Specifies the sampling temperature to use in the generation process.

Higher values (e.g. 0.8) make the output more random and diverse, while lower values (e.g. 0.2) make the output more focused and deterministic.

Possible values: 0 < value < 2

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_TEMPERATURE

double

${quarkus.langchain4j.temperature:1.0}

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

Possible values: 0 < value < 1

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_TOP_P

double

1

Specifies the desired format for the model’s output.

Allowable values: [text, json_object, json_schema]

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_RESPONSE_FORMAT

string

Whether chat model requests should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_LOG_REQUESTS

boolean

false

Whether chat model responses should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_CHAT_MODEL_LOG_RESPONSES

boolean

false

The id of the model to be used.

All available models are listed in the IBM Watsonx.ai documentation at the link: following link.

To use a model, locate the API model_id column in the table and copy the corresponding model ID.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_MODEL_NAME

string

meta-llama/llama-4-maverick-17b-128e-instruct-fp8

Represents the strategy used for picking the tokens during generation of the output text. During text generation when parameter value is set to greedy, each successive token corresponds to the highest probability token given the text that has already been generated. This strategy can lead to repetitive results especially for longer output sequences. The alternative sample strategy generates text by picking subsequent tokens based on the probability distribution of possible next tokens defined by (i.e., conditioned on) the already-generated text and the top_k and top_p parameters.

Allowable values: [sample,greedy]

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_DECODING_METHOD

string

greedy

Represents the factor of exponential decay. Larger values correspond to more aggressive decay.

Possible values: > 1

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_LENGTH_PENALTY_DECAY_FACTOR

double

A number of generated tokens after which this should take effect.

Possible values: ≥ 0

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_LENGTH_PENALTY_START_INDEX

int

The maximum number of new tokens to be generated. The maximum supported value for this field depends on the model being used. How the "token" is defined depends on the tokenizer and vocabulary size, which in turn depends on the model. Often the tokens are a mix of full words and sub-words. Depending on the users plan, and on the model being used, there may be an enforced maximum number of new tokens.

Possible values: ≥ 0

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_MAX_NEW_TOKENS

int

200

If stop sequences are given, they are ignored until minimum tokens are generated.

Possible values: ≥ 0

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_MIN_NEW_TOKENS

int

0

Random number generator seed to use in sampling mode for experimental repeatability.

Possible values: ≥ 1

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_RANDOM_SEED

int

Stop sequences are one or more strings which will cause the text generation to stop if/when they are produced as part of the output. Stop sequences encountered prior to the minimum number of tokens being generated will be ignored.

Possible values: 0 ≤ number of items ≤ 6

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_STOP_SEQUENCES

list of string

A value used to modify the next-token probabilities in sampling mode. Values less than 1.0 sharpen the probability distribution, resulting in "less random" output. Values greater than 1.0 flatten the probability distribution, resulting in "more random" output. A value of 1.0 has no effect.

Possible values: 0 ≤ value ≤ 2

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_TEMPERATURE

double

${quarkus.langchain4j.temperature:1.0}

The number of highest probability vocabulary tokens to keep for top-k-filtering. Only applies for sampling mode. When decoding_strategy is set to sample, only the top_k most likely tokens are considered as candidates for the next generated token.

Possible values: 1 ≤ value ≤ 100

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_TOP_K

int

Similar to top_k except the candidates to generate the next token are the most likely tokens with probabilities that add up to at least top_p. Also known as nucleus sampling. A value of 1.0 is equivalent to disabled.

Possible values: 0 < value ≤ 1

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_TOP_P

double

Represents the penalty for penalizing tokens that have already been generated or belong to the context. The value 1.0 means that there is no penalty.

Possible values: 1 ≤ value ≤ 2

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_REPETITION_PENALTY

double

Represents the maximum number of input tokens accepted. This can be used to avoid requests failing due to input being longer than configured limits. If the text is truncated, then it truncates the start of the input (on the left), so the end of the input will remain the same. If this value exceeds the maximum sequence length (refer to the documentation to find this value for the model) then the call will fail if the total number of tokens exceeds the maximum sequence length. Zero means don’t truncate.

Possible values: ≥ 0

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_TRUNCATE_INPUT_TOKENS

int

Pass false to omit matched stop sequences from the end of the output text. The default is true, meaning that the output will end with the stop sequence text when matched.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_INCLUDE_STOP_SEQUENCE

boolean

Whether chat model requests should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_LOG_REQUESTS

boolean

false

Whether chat model responses should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_LOG_RESPONSES

boolean

false

Delimiter used to concatenate the ChatMessage elements into a single string. By setting this property, you can define your preferred way of concatenating messages to ensure that the prompt is structured in the correct way.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_GENERATION_MODEL_PROMPT_JOINER

string

Specifies the ID of the model to be used.

A list of all available models is provided in the IBM watsonx.ai documentation at the this link.

To use a model, locate the API model ID column in the table and copy the corresponding model ID.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_EMBEDDING_MODEL_MODEL_NAME

string

ibm/granite-embedding-278m-multilingual

Specifies the maximum number of input tokens accepted. This can be used to prevent requests from failing due to input exceeding the configured token limits.

If the input exceeds the specified token limit, the input will be truncated from the end (right side), ensuring that the start of the input remains intact. If the provided value exceeds the model’s maximum sequence length (refer to the documentation for the model’s maximum sequence length), the request will fail if the total number of tokens exceeds the maximum limit.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_EMBEDDING_MODEL_TRUNCATE_INPUT_TOKENS

int

Whether embedding model requests should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_EMBEDDING_MODEL_LOG_REQUESTS

boolean

false

Whether embedding model responses should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_EMBEDDING_MODEL_LOG_RESPONSES

boolean

false

The id of the model to be used.

All available models are listed in the IBM Watsonx.ai documentation at the link: following link.

To use a model, locate the API model_id column in the table and copy the corresponding model ID.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_SCORING_MODEL_MODEL_NAME

string

cross-encoder/ms-marco-minilm-l-12-v2

Specifies the maximum number of input tokens accepted. This helps to avoid requests failing due to input exceeding the configured token limits.

If the input exceeds the specified token limit, the text will be truncated from the end (right side), ensuring that the start of the input remains intact. If the provided value exceeds the model’s maximum sequence length (refer to the documentation for the model’s maximum sequence length), the request will fail if the total number of tokens exceeds the maximum limit.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_SCORING_MODEL_TRUNCATE_INPUT_TOKENS

int

Whether embedding model requests should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_SCORING_MODEL_LOG_REQUESTS

boolean

false

Whether embedding model responses should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_SCORING_MODEL_LOG_RESPONSES

boolean

false

Base URL for the built-in service.

All available URLs are listed in the IBM Watsonx.ai documentation at the following link.

Note: If empty, the URL is automatically calculated based on the watsonx.base-url value.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_BUILT_IN_SERVICE_BASE_URL

string

IBM Cloud API key.

If empty, the api key inherits the value from the watsonx.api-key property.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_BUILT_IN_SERVICE_API_KEY

string

Timeout for built-in tools APIs.

If empty, the api key inherits the value from the watsonx.timeout property.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_BUILT_IN_SERVICE_TIMEOUT

Duration 

10s

Whether the built-in rest client should log requests.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_BUILT_IN_SERVICE_LOG_REQUESTS

boolean

false

Whether the built-in rest client should log responses.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_BUILT_IN_SERVICE_LOG_RESPONSES

boolean

false

Maximum number of search results.

Possible values: 1 < value < 20

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX_BUILT_IN_SERVICE_GOOGLE_SEARCH_MAX_RESULTS

int

10

Named model config

Type

Default

Specifies the mode of interaction with the LLM model.

This property allows you to choose between two modes of operation:

  • chat: prompts are automatically enriched with the specific tags defined by the model

  • generation: prompts require manual specification of tags

Allowable values: [chat, generation]

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__MODE

string

chat

Specifies the base URL of the watsonx.ai API.

A list of all available URLs is provided in the IBM Watsonx.ai documentation at the this link.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__BASE_URL

string

IBM Cloud API key.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__API_KEY

string

Timeout for watsonx.ai calls.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__TIMEOUT

Duration 

10s

The version date for the API of the form YYYY-MM-DD.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__VERSION

string

2025-04-23

The space that contains the resource.

Either space_id or project_id has to be given.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__SPACE_ID

string

The project that contains the resource.

Either space_id or project_id has to be given.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__PROJECT_ID

string

Whether the watsonx.ai client should log requests.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__LOG_REQUESTS

boolean

false

Whether the watsonx.ai client should log responses.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__LOG_RESPONSES

boolean

false

Whether the watsonx.ai client should log requests as cURL commands.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__LOG_REQUESTS_CURL

boolean

false

Whether to enable the integration. Defaults to true, which means requests are made to the watsonx.ai provider. Set to false to disable all requests.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__ENABLE_INTEGRATION

boolean

true

Base URL of the IAM Authentication API.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__IAM_BASE_URL

URL

https://iam.cloud.ibm.com

Timeout for IAM authentication calls.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__IAM_TIMEOUT

Duration 

10s

Grant type for the IAM Authentication API.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__IAM_GRANT_TYPE

string

urn:ibm:params:oauth:grant-type:apikey

Base URL of the Cloud Object Storage API.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__TEXT_EXTRACTION_BASE_URL

string

required

The ID of the connection asset that contains the credentials required to access the data.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__TEXT_EXTRACTION_DOCUMENT_REFERENCE_CONNECTION

string

required

The name of the bucket containing the input document.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__TEXT_EXTRACTION_DOCUMENT_REFERENCE_BUCKET_NAME

string

required

The ID of the connection asset used to store the extracted results.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__TEXT_EXTRACTION_RESULTS_REFERENCE_CONNECTION

string

required

The name of the bucket where the output files will be written.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__TEXT_EXTRACTION_RESULTS_REFERENCE_BUCKET_NAME

string

required

Whether the Cloud Object Storage client should log requests.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__TEXT_EXTRACTION_LOG_REQUESTS

boolean

false

Whether the Cloud Object Storage client should log responses.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__TEXT_EXTRACTION_LOG_RESPONSES

boolean

false

Specifies the model to use for the chat completion.

A list of all available models is provided in the IBM watsonx.ai documentation at the this link.

To use a model, locate the API model ID column in the table and copy the corresponding model ID.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_MODEL_NAME

string

meta-llama/llama-4-maverick-17b-128e-instruct-fp8

Specifies how the model should choose which tool to call during a request.

This value can be:

  • auto: The model decides whether and which tool to call automatically.

  • required: The model must call one of the available tools.

If toolChoiceName is set, this value is ignored.

Setting this value influences the tool-calling behavior of the model when no specific tool is required.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_TOOL_CHOICE

auto, required, none

Specifies the name of a specific tool that the model must call.

When set, the model will be forced to call the specified tool. The name must exactly match one of the available tools defined for the service.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_TOOL_CHOICE_NAME

string

Positive values penalize new tokens based on their existing frequency in the generated text, reducing the likelihood of the model repeating the same lines verbatim.

Possible values: -2 < value < 2

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_FREQUENCY_PENALTY

double

0

Specifies whether to return the log probabilities of the output tokens.

If set to true, the response will include the log probability of each output token in the content of the message.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_LOGPROBS

boolean

false

An integer specifying the number of most likely tokens to return at each token position, each with an associated log probability. The option logprobs must be set to true if this parameter is used.

Possible values: 0 ≤ value ≤ 20

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_TOP_LOGPROBS

int

The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model’s context length. Set to 0 for the model’s configured max generated tokens.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_MAX_TOKENS

int

1024

Specifies how many chat completion choices to generate for each input message.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_N

int

1

Applies a penalty to new tokens based on whether they already appear in the generated text so far, encouraging the model to introduce new topics rather than repeat itself.

Possible values: -2 < value < 2

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_PRESENCE_PENALTY

double

0

Random number generator seed to use in sampling mode for experimental repeatability.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_SEED

int

Defines one or more stop sequences that will cause the model to stop generating further tokens if any of them are encountered in the output.

This allows control over where the model should end its response. If a stop sequence is encountered before the minimum number of tokens has been generated, it will be ignored.

Possible values: 0 ≤ number of items ≤ 4

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_STOP

list of string

Specifies the sampling temperature to use in the generation process.

Higher values (e.g. 0.8) make the output more random and diverse, while lower values (e.g. 0.2) make the output more focused and deterministic.

Possible values: 0 < value < 2

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_TEMPERATURE

double

${quarkus.langchain4j.temperature:1.0}

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

Possible values: 0 < value < 1

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_TOP_P

double

1

Specifies the desired format for the model’s output.

Allowable values: [text, json_object, json_schema]

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_RESPONSE_FORMAT

string

Whether chat model requests should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_LOG_REQUESTS

boolean

false

Whether chat model responses should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__CHAT_MODEL_LOG_RESPONSES

boolean

false

The id of the model to be used.

All available models are listed in the IBM Watsonx.ai documentation at the link: following link.

To use a model, locate the API model_id column in the table and copy the corresponding model ID.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_MODEL_NAME

string

meta-llama/llama-4-maverick-17b-128e-instruct-fp8

Represents the strategy used for picking the tokens during generation of the output text. During text generation when parameter value is set to greedy, each successive token corresponds to the highest probability token given the text that has already been generated. This strategy can lead to repetitive results especially for longer output sequences. The alternative sample strategy generates text by picking subsequent tokens based on the probability distribution of possible next tokens defined by (i.e., conditioned on) the already-generated text and the top_k and top_p parameters.

Allowable values: [sample,greedy]

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_DECODING_METHOD

string

greedy

Represents the factor of exponential decay. Larger values correspond to more aggressive decay.

Possible values: > 1

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_LENGTH_PENALTY_DECAY_FACTOR

double

A number of generated tokens after which this should take effect.

Possible values: ≥ 0

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_LENGTH_PENALTY_START_INDEX

int

The maximum number of new tokens to be generated. The maximum supported value for this field depends on the model being used. How the "token" is defined depends on the tokenizer and vocabulary size, which in turn depends on the model. Often the tokens are a mix of full words and sub-words. Depending on the users plan, and on the model being used, there may be an enforced maximum number of new tokens.

Possible values: ≥ 0

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_MAX_NEW_TOKENS

int

200

If stop sequences are given, they are ignored until minimum tokens are generated.

Possible values: ≥ 0

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_MIN_NEW_TOKENS

int

0

Random number generator seed to use in sampling mode for experimental repeatability.

Possible values: ≥ 1

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_RANDOM_SEED

int

Stop sequences are one or more strings which will cause the text generation to stop if/when they are produced as part of the output. Stop sequences encountered prior to the minimum number of tokens being generated will be ignored.

Possible values: 0 ≤ number of items ≤ 6

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_STOP_SEQUENCES

list of string

A value used to modify the next-token probabilities in sampling mode. Values less than 1.0 sharpen the probability distribution, resulting in "less random" output. Values greater than 1.0 flatten the probability distribution, resulting in "more random" output. A value of 1.0 has no effect.

Possible values: 0 ≤ value ≤ 2

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_TEMPERATURE

double

${quarkus.langchain4j.temperature:1.0}

The number of highest probability vocabulary tokens to keep for top-k-filtering. Only applies for sampling mode. When decoding_strategy is set to sample, only the top_k most likely tokens are considered as candidates for the next generated token.

Possible values: 1 ≤ value ≤ 100

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_TOP_K

int

Similar to top_k except the candidates to generate the next token are the most likely tokens with probabilities that add up to at least top_p. Also known as nucleus sampling. A value of 1.0 is equivalent to disabled.

Possible values: 0 < value ≤ 1

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_TOP_P

double

Represents the penalty for penalizing tokens that have already been generated or belong to the context. The value 1.0 means that there is no penalty.

Possible values: 1 ≤ value ≤ 2

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_REPETITION_PENALTY

double

Represents the maximum number of input tokens accepted. This can be used to avoid requests failing due to input being longer than configured limits. If the text is truncated, then it truncates the start of the input (on the left), so the end of the input will remain the same. If this value exceeds the maximum sequence length (refer to the documentation to find this value for the model) then the call will fail if the total number of tokens exceeds the maximum sequence length. Zero means don’t truncate.

Possible values: ≥ 0

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_TRUNCATE_INPUT_TOKENS

int

Pass false to omit matched stop sequences from the end of the output text. The default is true, meaning that the output will end with the stop sequence text when matched.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_INCLUDE_STOP_SEQUENCE

boolean

Whether chat model requests should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_LOG_REQUESTS

boolean

false

Whether chat model responses should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_LOG_RESPONSES

boolean

false

Delimiter used to concatenate the ChatMessage elements into a single string. By setting this property, you can define your preferred way of concatenating messages to ensure that the prompt is structured in the correct way.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__GENERATION_MODEL_PROMPT_JOINER

string

Specifies the ID of the model to be used.

A list of all available models is provided in the IBM watsonx.ai documentation at the this link.

To use a model, locate the API model ID column in the table and copy the corresponding model ID.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__EMBEDDING_MODEL_MODEL_NAME

string

ibm/granite-embedding-278m-multilingual

Specifies the maximum number of input tokens accepted. This can be used to prevent requests from failing due to input exceeding the configured token limits.

If the input exceeds the specified token limit, the input will be truncated from the end (right side), ensuring that the start of the input remains intact. If the provided value exceeds the model’s maximum sequence length (refer to the documentation for the model’s maximum sequence length), the request will fail if the total number of tokens exceeds the maximum limit.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__EMBEDDING_MODEL_TRUNCATE_INPUT_TOKENS

int

Whether embedding model requests should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__EMBEDDING_MODEL_LOG_REQUESTS

boolean

false

Whether embedding model responses should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__EMBEDDING_MODEL_LOG_RESPONSES

boolean

false

The id of the model to be used.

All available models are listed in the IBM Watsonx.ai documentation at the link: following link.

To use a model, locate the API model_id column in the table and copy the corresponding model ID.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__SCORING_MODEL_MODEL_NAME

string

cross-encoder/ms-marco-minilm-l-12-v2

Specifies the maximum number of input tokens accepted. This helps to avoid requests failing due to input exceeding the configured token limits.

If the input exceeds the specified token limit, the text will be truncated from the end (right side), ensuring that the start of the input remains intact. If the provided value exceeds the model’s maximum sequence length (refer to the documentation for the model’s maximum sequence length), the request will fail if the total number of tokens exceeds the maximum limit.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__SCORING_MODEL_TRUNCATE_INPUT_TOKENS

int

Whether embedding model requests should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__SCORING_MODEL_LOG_REQUESTS

boolean

false

Whether embedding model responses should be logged.

Environment variable: QUARKUS_LANGCHAIN4J_WATSONX__MODEL_NAME__SCORING_MODEL_LOG_RESPONSES

boolean

false

About the Duration format

To write duration values, use the standard java.time.Duration format. See the Duration#parse() Java API documentation for more information.

You can also use a simplified format, starting with a number:

  • If the value is only a number, it represents time in seconds.

  • If the value is a number followed by ms, it represents time in milliseconds.

In other cases, the simplified format is translated to the java.time.Duration format for parsing:

  • If the value is a number followed by h, m, or s, it is prefixed with PT.

  • If the value is a number followed by d, it is prefixed with P.