CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-dev-langchain4j--langchain4j-ollama

Java integration library enabling LangChain4j applications to use Ollama's local language models with support for chat, streaming, embeddings, and advanced reasoning features

Overview
Eval results
Files

types.mddocs/

Supporting Types

This document covers the supporting types used for Ollama model metadata and information.

OllamaModel

Represents an Ollama model with its basic metadata.

Class Signature

package dev.langchain4j.model.ollama;

public class OllamaModel

Mutability: Mutable (has setters)

Thread Safety: Not thread-safe; synchronize if shared across threads

Nullability: All fields can be null

Public Methods

Getters

public String getName()

Returns the model name.

Returns: String - Model name (e.g., "llama2", "mistral")

  • May be null
public long getSize()

Returns the model size in bytes.

Returns: long - Model size

  • Always >= 0
public String getDigest()

Returns the model's content digest (SHA256 hash).

Returns: String - SHA256 digest

  • May be null
public OllamaModelDetails getDetails()

Returns the technical details of the model.

Returns: OllamaModelDetails - Model details

  • May be null
public OffsetDateTime getModifiedAt()

Returns the last modification timestamp.

Returns: OffsetDateTime - Modification time

  • May be null

OllamaModelDetails

Represents technical details about an Ollama model's architecture and quantization.

Class Signature

package dev.langchain4j.model.ollama;

public class OllamaModelDetails

Mutability: Mutable (has setters)

Thread Safety: Not thread-safe

Nullability: All fields can be null

Public Methods

public String getFormat()

Returns the model file format.

Returns: String - Format (e.g., "gguf", "ggml")

  • May be null
public String getFamily()

Returns the model family.

Returns: String - Family name (e.g., "llama", "mistral")

  • May be null
public String getParameterSize()

Returns the parameter size description.

Returns: String - Size (e.g., "7B", "13B", "70B")

  • May be null
public String getQuantizationLevel()

Returns the quantization level.

Returns: String - Quantization (e.g., "Q4_0", "Q5_K_M", "F16")

  • May be null

Common Quantization Levels

LevelBitsQualitySizeUse Case
F1616Very HighVery LargeHigh quality
Q8_08HighLargeProduction
Q5_K_M5GoodMediumBalanced
Q4_K_M4AcceptableSmallFast inference
Q4_04LowerSmallestResource-constrained

OllamaModelCard

Represents detailed information about an Ollama model including license, template, and capabilities.

Class Signature

package dev.langchain4j.model.ollama;

public class OllamaModelCard

Mutability: Mutable (has setters)

Thread Safety: Not thread-safe

Nullability: All fields can be null

Public Methods

public String getLicense()

Returns the model's license information.

Returns: String - License (e.g., "Apache 2.0", "MIT")

  • May be null
public String getTemplate()

Returns the model's prompt template.

Returns: String - Template (e.g., "{{ .Prompt }}")

  • May be null
public OllamaModelDetails getDetails()

Returns the technical details of the model.

Returns: OllamaModelDetails - Model details

  • May be null

RunningOllamaModel

Represents a currently running Ollama model instance with runtime state information.

Class Signature

package dev.langchain4j.model.ollama;

public class RunningOllamaModel

Mutability: Mutable (has setters)

Thread Safety: Not thread-safe

Nullability: All fields can be null

Public Methods

public String getName()

Returns the name of the running model.

Returns: String - Model name (e.g., "llama2", "mistral")

  • May be null
public String getModel()

Returns the full model identifier.

Returns: String - Model identifier

  • May be null
public long getSize()

Returns the model size in bytes.

Returns: long - Model size in memory

  • Always >= 0
public String getDigest()

Returns the model's content digest.

Returns: String - SHA256 digest

  • May be null
public OllamaModelDetails getDetails()

Returns the technical details of the model.

Returns: OllamaModelDetails - Model details

  • May be null
public OffsetDateTime getExpiresAt()

Returns when the model will be unloaded from memory.

Returns: OffsetDateTime - Expiration timestamp

  • May be null if model persists indefinitely

See Also

  • Model Management - Using these types for model management

Install with Tessl CLI

npx tessl i tessl/maven-dev-langchain4j--langchain4j-ollama

docs

architecture.md

chat-models.md

embedding-model.md

index.md

language-models.md

model-management.md

request-parameters.md

spi.md

types.md

README.md

tile.json