Java integration library enabling LangChain4j applications to use Ollama's local language models with support for chat, streaming, embeddings, and advanced reasoning features
This document covers the supporting types used for Ollama model metadata and information.
Represents an Ollama model with its basic metadata.
package dev.langchain4j.model.ollama;
public class OllamaModelMutability: Mutable (has setters)
Thread Safety: Not thread-safe; synchronize if shared across threads
Nullability: All fields can be null
public String getName()Returns the model name.
Returns: String - Model name (e.g., "llama2", "mistral")
public long getSize()Returns the model size in bytes.
Returns: long - Model size
public String getDigest()Returns the model's content digest (SHA256 hash).
Returns: String - SHA256 digest
public OllamaModelDetails getDetails()Returns the technical details of the model.
Returns: OllamaModelDetails - Model details
public OffsetDateTime getModifiedAt()Returns the last modification timestamp.
Returns: OffsetDateTime - Modification time
Represents technical details about an Ollama model's architecture and quantization.
package dev.langchain4j.model.ollama;
public class OllamaModelDetailsMutability: Mutable (has setters)
Thread Safety: Not thread-safe
Nullability: All fields can be null
public String getFormat()Returns the model file format.
Returns: String - Format (e.g., "gguf", "ggml")
public String getFamily()Returns the model family.
Returns: String - Family name (e.g., "llama", "mistral")
public String getParameterSize()Returns the parameter size description.
Returns: String - Size (e.g., "7B", "13B", "70B")
public String getQuantizationLevel()Returns the quantization level.
Returns: String - Quantization (e.g., "Q4_0", "Q5_K_M", "F16")
| Level | Bits | Quality | Size | Use Case |
|---|---|---|---|---|
F16 | 16 | Very High | Very Large | High quality |
Q8_0 | 8 | High | Large | Production |
Q5_K_M | 5 | Good | Medium | Balanced |
Q4_K_M | 4 | Acceptable | Small | Fast inference |
Q4_0 | 4 | Lower | Smallest | Resource-constrained |
Represents detailed information about an Ollama model including license, template, and capabilities.
package dev.langchain4j.model.ollama;
public class OllamaModelCardMutability: Mutable (has setters)
Thread Safety: Not thread-safe
Nullability: All fields can be null
public String getLicense()Returns the model's license information.
Returns: String - License (e.g., "Apache 2.0", "MIT")
public String getTemplate()Returns the model's prompt template.
Returns: String - Template (e.g., "{{ .Prompt }}")
public OllamaModelDetails getDetails()Returns the technical details of the model.
Returns: OllamaModelDetails - Model details
Represents a currently running Ollama model instance with runtime state information.
package dev.langchain4j.model.ollama;
public class RunningOllamaModelMutability: Mutable (has setters)
Thread Safety: Not thread-safe
Nullability: All fields can be null
public String getName()Returns the name of the running model.
Returns: String - Model name (e.g., "llama2", "mistral")
public String getModel()Returns the full model identifier.
Returns: String - Model identifier
public long getSize()Returns the model size in bytes.
Returns: long - Model size in memory
public String getDigest()Returns the model's content digest.
Returns: String - SHA256 digest
public OllamaModelDetails getDetails()Returns the technical details of the model.
Returns: OllamaModelDetails - Model details
public OffsetDateTime getExpiresAt()Returns when the model will be unloaded from memory.
Returns: OffsetDateTime - Expiration timestamp
Install with Tessl CLI
npx tessl i tessl/maven-dev-langchain4j--langchain4j-ollama@1.11.0