Skip to content

Proof of Concept - Addressing Issue #311 #378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package org.springframework.ai.ollama.api;

/**
* Helper class for common Ollama models.
*
* @author Siarhei Blashuk
* @since 0.8.1
*/
public enum OllamaModel {

/**
* Llama 2 is a collection of language models ranging from 7B to 70B parameters.
*/
LLAMA2("llama2"),
/**
* The 7B parameters model
*/
MISTRAL("mistral"),
/**
* The 2.7B uncensored Dolphin model
*/
DOLPHIN_PHI("dolphin-phi"),
/**
* The Phi-2 2.7B language model
*/
PHI("phi"),
/**
* A fine-tuned Mistral model
*/
NEURAL_CHAT("neural-chat"),
/**
* Starling-7B model
*/
STARLING_LM("starling-lm"),
/**
* Code Llama is based on Llama 2 model
*/
CODELLAMA("codellama"),
/**
* Orca Mini is based on Llama and Llama 2 ranging from 3 billion parameters to 70
* billion
*/
ORCA_MINI("orca-mini"),
/**
* Llava is a Large Language and Vision Assistant model
*/
LLAVA("llava"),
/**
* Gemma is a lightweight model with 2 billion and 7 billion
*/
GEMMA("gemma"),
/**
* Uncensored Llama 2 model
*/
LLAMA2_UNCENSORED("llama2-uncensored");

private final String id;

OllamaModel(String id) {
this.id = id;
}

public String id() {
return id;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
@JsonInclude(Include.NON_NULL)
public class OllamaOptions implements ChatOptions, EmbeddingOptions {

public static final String DEFAULT_MODEL = "mistral";
public static final String DEFAULT_MODEL = OllamaModel.MISTRAL.id();

// @formatter:off
/**
Expand Down Expand Up @@ -244,6 +244,9 @@ public class OllamaOptions implements ChatOptions, EmbeddingOptions {
*/
@JsonProperty("model") private String model;

/**
* @param model The ollama model names to use. See the {@link OllamaModel} for the common models.
*/
public OllamaOptions withModel(String model) {
this.model = model;
return this;
Expand Down