Ollama: Remove unused option in chat completion
Signed-off-by: Thomas Vitale <ThomasVitale@users.noreply.github.com>
This commit is contained in:
committed by
Christian Tzolov
parent
7c09c0963b
commit
ea849d9075
@@ -174,10 +174,6 @@ public class OllamaChatClient implements ChatClient, StreamingChatClient {
|
||||
requestBuilder.withKeepAlive(mergedOptions.getKeepAlive());
|
||||
}
|
||||
|
||||
if (mergedOptions.getTemplate() != null) {
|
||||
requestBuilder.withTemplate(mergedOptions.getTemplate());
|
||||
}
|
||||
|
||||
return requestBuilder.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -416,7 +416,6 @@ public class OllamaApi {
|
||||
* @param format The format to return the response in. Currently, the only accepted
|
||||
* value is "json".
|
||||
* @param keepAlive The duration to keep the model loaded in ollama while idle. https://pkg.go.dev/time#ParseDuration
|
||||
* @param template The prompt template (overrides what is defined in the Modelfile).
|
||||
* @param options Additional model parameters. You can use the {@link OllamaOptions} builder
|
||||
* to create the options then {@link OllamaOptions#toMap()} to convert the options into a
|
||||
* map.
|
||||
@@ -428,7 +427,6 @@ public class OllamaApi {
|
||||
@JsonProperty("stream") Boolean stream,
|
||||
@JsonProperty("format") String format,
|
||||
@JsonProperty("keep_alive") String keepAlive,
|
||||
@JsonProperty("template") String template,
|
||||
@JsonProperty("options") Map<String, Object> options) {
|
||||
|
||||
public static Builder builder(String model) {
|
||||
@@ -442,7 +440,6 @@ public class OllamaApi {
|
||||
private boolean stream = false;
|
||||
private String format;
|
||||
private String keepAlive;
|
||||
private String template;
|
||||
private Map<String, Object> options = Map.of();
|
||||
|
||||
public Builder(String model) {
|
||||
@@ -470,11 +467,6 @@ public class OllamaApi {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withTemplate(String template) {
|
||||
this.template = template;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withOptions(Map<String, Object> options) {
|
||||
Objects.requireNonNull(options, "The options can not be null.");
|
||||
|
||||
@@ -489,7 +481,7 @@ public class OllamaApi {
|
||||
}
|
||||
|
||||
public ChatRequest build() {
|
||||
return new ChatRequest(model, messages, stream, format, keepAlive, template, options);
|
||||
return new ChatRequest(model, messages, stream, format, keepAlive, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class OllamaOptions implements ChatOptions, EmbeddingOptions {
|
||||
|
||||
public static final String DEFAULT_MODEL = OllamaModel.MISTRAL.id();
|
||||
|
||||
private static final List<String> NON_SUPPORTED_FIELDS = List.of("model", "format", "keep_alive", "template");
|
||||
private static final List<String> NON_SUPPORTED_FIELDS = List.of("model", "format", "keep_alive");
|
||||
|
||||
// @formatter:off
|
||||
/**
|
||||
@@ -255,13 +255,6 @@ public class OllamaOptions implements ChatOptions, EmbeddingOptions {
|
||||
*/
|
||||
@JsonProperty("keep_alive") private String keepAlive;
|
||||
|
||||
/**
|
||||
* The prompt template to use (overrides what is defined in the Modelfile).
|
||||
* Part of Chat completion <a href="https://github.com/ollama/ollama/blob/main/docs/api.md#parameters-1">advanced parameters</a>.
|
||||
*/
|
||||
@JsonProperty("template") private String template;
|
||||
|
||||
|
||||
/**
|
||||
* @param model The ollama model names to use. See the {@link OllamaModel} for the common models.
|
||||
*/
|
||||
@@ -288,11 +281,6 @@ public class OllamaOptions implements ChatOptions, EmbeddingOptions {
|
||||
return this;
|
||||
}
|
||||
|
||||
public OllamaOptions withTemplate(String template) {
|
||||
this.template = template;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OllamaOptions withUseNUMA(Boolean useNUMA) {
|
||||
this.useNUMA = useNUMA;
|
||||
return this;
|
||||
@@ -469,14 +457,6 @@ public class OllamaOptions implements ChatOptions, EmbeddingOptions {
|
||||
this.keepAlive = keepAlive;
|
||||
}
|
||||
|
||||
public String getTemplate() {
|
||||
return this.template;
|
||||
}
|
||||
|
||||
public void setTemplate(String template) {
|
||||
this.template = template;
|
||||
}
|
||||
|
||||
public Boolean getUseNUMA() {
|
||||
return this.useNUMA;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@ Here are the advanced request parameter for the Ollama chat client:
|
||||
| spring.ai.ollama.chat.options.model | The name of the https://github.com/ollama/ollama?tab=readme-ov-file#model-library[supported models] to use. | mistral
|
||||
| spring.ai.ollama.chat.options.format | The format to return a response in. Currently the only accepted value is `json` | -
|
||||
| spring.ai.ollama.chat.options.keep_alive | Controls how long the model will stay loaded into memory following the request | 5m
|
||||
| spring.ai.ollama.chat.options.template | The prompt template to use (overrides what is defined in the Modelfile) | -
|
||||
|====
|
||||
|
||||
The `options` properties are based on the link:https://github.com/jmorganca/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values[Ollama Valid Parameters and Values] and link:https://github.com/jmorganca/ollama/blob/main/api/types.go[Ollama Types]. The default values are based on: link:https://github.com/ollama/ollama/blob/b538dc3858014f94b099730a592751a5454cab0a/api/types.go#L364[Ollama type defaults].
|
||||
|
||||
Reference in New Issue
Block a user