Interface OllamaChatModelConfig
- All Superinterfaces:
Prototype.Api
- All Known Implementing Classes:
OllamaChatModelConfig.BuilderBase.OllamaChatModelConfigImpl
Configuration class for the Ollama chat model,
OllamaChatModel
.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
Fluent API builder forOllamaChatModelConfig
.static class
OllamaChatModelConfig.BuilderBase<BUILDER extends OllamaChatModelConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends OllamaChatModelConfig> Fluent API builder base forOllamaChatModelConfig
. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbaseUrl()
The base URL for the Ollama API.builder()
Create a new fluent API builder to customize configuration.builder
(OllamaChatModelConfig instance) Create a new fluent API builder from an existing instance.static OllamaChatModelConfig
create()
Create a new instance with default values.static OllamaChatModelConfig
Create a new instance from configuration.A map containing custom headers.boolean
enabled()
If set tofalse
(default), Ollama model will not be available even if configured.format()
The format of the generated output.Whether to log API requests.Whether to log API responses.The maximum number of retries for failed API requests.The name of the Ollama model to use.The number of tokens to generate during text prediction.The penalty applied to repeated tokens during text generation.seed()
The seed for the random number generator used by the model.stop()
The list of sequences where the API will stop generating further tokens.The sampling temperature to use, between 0 and 2.timeout()
The timeout setting for API requests.topK()
The maximum number of top-probability tokens to consider when generating text.topP()
The nucleus sampling value, where the model considers the results of the tokens with top_p probability mass.
-
Field Details
-
CONFIG_ROOT
Default configuration prefix.- See Also:
-
-
Method Details
-
builder
Create a new fluent API builder to customize configuration.- Returns:
- a new builder
-
builder
Create a new fluent API builder from an existing instance.- Parameters:
instance
- an existing instance used as a base for the builder- Returns:
- a builder based on an instance
-
create
Create a new instance from configuration.- Parameters:
config
- used to configure the new instance- Returns:
- a new instance configured from configuration
-
create
Create a new instance with default values.- Returns:
- a new instance
-
temperature
The sampling temperature to use, between 0 and 2. Higher values make the output more random, while lower values make it more focused and deterministic.- Returns:
- an
Optional
containing the sampling temperature
-
topK
The maximum number of top-probability tokens to consider when generating text. Limits the token pool to thetopK
highest-probability tokens, controlling the balance between deterministic and diverse outputs.A smaller
topK
(e.g., 1) results in deterministic output, while a larger value (e.g., 50) allows for more variability and creativity.- Returns:
- an
Optional
containing the topK value
-
topP
The nucleus sampling value, where the model considers the results of the tokens with top_p probability mass.- Returns:
- an
Optional
containing the nucleus sampling value
-
repeatPenalty
The penalty applied to repeated tokens during text generation. Higher values discourage the model from generating the same token multiple times, promoting more varied and natural output.A value of
1.0
applies no penalty (default behavior), while values greater than1.0
reduce the likelihood of repetition. Excessively high values may overly penalize common phrases, leading to unnatural results.- Returns:
- an
Optional
containing the repeat penalty
-
seed
The seed for the random number generator used by the model.- Returns:
- an
Optional
containing the seed
-
numPredict
The number of tokens to generate during text prediction. This parameter determines the length of the output generated by the model.- Returns:
- an
Optional
containing the numPredicts value
-
stop
The list of sequences where the API will stop generating further tokens.- Returns:
- the list of stop sequences
-
format
The format of the generated output. This parameter specifies the structure or style of the text produced by the model, such as plain text, JSON, or a custom format.Common examples:
"plain"
: Generates unstructured plain text."json"
: Produces output formatted as a JSON object.- Custom values may be supported depending on the model's capabilities.
- Returns:
- an
Optional
containing the response format
-
enabled
boolean enabled()If set tofalse
(default), Ollama model will not be available even if configured.- Returns:
- whether Ollama model is enabled, defaults to
false
-
baseUrl
The base URL for the Ollama API.- Returns:
- the base URL
-
logRequests
Whether to log API requests.- Returns:
- an
Optional
containing true if requests should be logged, false otherwise
-
logResponses
Whether to log API responses.- Returns:
- an
Optional
containing true if responses should be logged, false otherwise
-
customHeaders
A map containing custom headers.- Returns:
- custom headers map
-
timeout
The timeout setting for API requests.- Returns:
- the timeout setting in
Duration.parse(java.lang.CharSequence)
format
-
maxRetries
The maximum number of retries for failed API requests.- Returns:
- an
Optional
containing the maximum number of retries
-
modelName
The name of the Ollama model to use. This parameter determines which pre-trained model will process the input prompt and produce the output.Examples of valid model names:
"llama-2"
: Utilizes the LLaMA 2 model."alpaca"
: Uses a fine-tuned LLaMA model for conversational tasks."custom-model"
: A user-defined model trained for specific use cases.
- Returns:
- an
Optional
containing the model name
-