Table of Contents

Class OllamaOption

Namespace
OllamaSharp.Models
Assembly
OllamaSharp.dll

Collection of options available to Ollama

public class OllamaOption
Inheritance
OllamaOption
Inherited Members

Constructors

OllamaOption(string)

Collection of options available to Ollama

public OllamaOption(string name)

Parameters

name string

The name of the setting like defined in the Ollama api docs

Properties

F16kv

Enable f16 key/value. (Default: False)

public static OllamaOption F16kv { get; }

Property Value

OllamaOption

FrequencyPenalty

The penalty to apply to tokens based on their frequency in the prompt. (Default: 0.0)

public static OllamaOption FrequencyPenalty { get; }

Property Value

OllamaOption

LogitsAll

Return logits for all the tokens, not just the last one. (Default: False)

public static OllamaOption LogitsAll { get; }

Property Value

OllamaOption

LowVram

Enable low VRAM mode. (Default: False)

public static OllamaOption LowVram { get; }

Property Value

OllamaOption

MainGpu

This option controls which GPU is used for small tensors. The overhead of splitting the computation across all GPUs is not worthwhile. The GPU will use slightly more VRAM to store a scratch buffer for temporary results. By default, GPU 0 is used.

public static OllamaOption MainGpu { get; }

Property Value

OllamaOption

MaxOutputTokens

The number of tokens to generate in the output. (Default: -1, infinite generation)

public static OllamaOption MaxOutputTokens { get; }

Property Value

OllamaOption

MinP

Alternative to the top_p, and aims to ensure a balance of quality and variety.min_p represents the minimum probability for a token to be considered, relative to the probability of the most likely token.For example, with min_p=0.05 and the most likely token having a probability of 0.9, logits with a value less than 0.05*0.9=0.045 are filtered out. (Default: 0.0)

public static OllamaOption MinP { get; }

Property Value

OllamaOption

MiroStat

Enable Mirostat sampling for controlling perplexity. (default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0)

public static OllamaOption MiroStat { get; }

Property Value

OllamaOption

MiroStatEta

Influences how quickly the algorithm responds to feedback from the generated text. A lower learning rate will result in slower adjustments, while a higher learning rate will make the algorithm more responsive. (Default: 0.1)

public static OllamaOption MiroStatEta { get; }

Property Value

OllamaOption

MiroStatTau

Controls the balance between coherence and diversity of the output. A lower value will result in more focused and coherent text. (Default: 5.0)

public static OllamaOption MiroStatTau { get; }

Property Value

OllamaOption

Name

Gets the name of the Ollama setting

public string Name { get; }

Property Value

string

NumBatch

Prompt processing maximum batch size. (Default: 512)

public static OllamaOption NumBatch { get; }

Property Value

OllamaOption

NumCtx

Sets the size of the context window used to generate the next token. (Default: 2048)

public static OllamaOption NumCtx { get; }

Property Value

OllamaOption

NumGpu

The number of layers to send to the GPU(s). On macOS it defaults to 1 to enable metal support, 0 to disable.

public static OllamaOption NumGpu { get; }

Property Value

OllamaOption

NumGqa

The number of GQA groups in the transformer layer. Required for some models, for example it is 8 for llama2:70b

public static OllamaOption NumGqa { get; }

Property Value

OllamaOption

NumKeep

Number of tokens to keep from the initial prompt. (Default: 4, -1 = all)

public static OllamaOption NumKeep { get; }

Property Value

OllamaOption

NumPredict

Maximum number of tokens to predict when generating text. (Default: 128, -1 = infinite generation, -2 = fill context)

public static OllamaOption NumPredict { get; }

Property Value

OllamaOption

NumThread

Sets the number of threads to use during computation. By default, Ollama will detect this for optimal performance. It is recommended to set this value to the number of physical CPU cores your system has (as opposed to the logical number of cores).

public static OllamaOption NumThread { get; }

Property Value

OllamaOption

Numa

Enable NUMA support. (Default: False)

public static OllamaOption Numa { get; }

Property Value

OllamaOption

PenalizeNewline

Penalize newline tokens (Default: True)

public static OllamaOption PenalizeNewline { get; }

Property Value

OllamaOption

PresencePenalty

The penalty to apply to tokens based on their presence in the prompt. (Default: 0.0)

public static OllamaOption PresencePenalty { get; }

Property Value

OllamaOption

RepeatLastN

Sets how far back for the model to look back to prevent repetition. (Default: 64, 0 = disabled, -1 = num_ctx)

public static OllamaOption RepeatLastN { get; }

Property Value

OllamaOption

RepeatPenalty

Sets how strongly to penalize repetitions. A higher value (e.g., 1.5) will penalize repetitions more strongly, while a lower value (e.g., 0.9) will be more lenient. (Default: 1.1)

public static OllamaOption RepeatPenalty { get; }

Property Value

OllamaOption

Seed

Sets the random number seed to use for generation. Setting this to a specific number will make the model generate the same text for the same prompt. (Default: 0)

public static OllamaOption Seed { get; }

Property Value

OllamaOption

Stop

Sets the stop sequences to use. When this pattern is encountered the LLM will stop generating text and return. Multiple stop patterns may be set by specifying multiple separate stop parameters in a modelfile.

public static OllamaOption Stop { get; }

Property Value

OllamaOption

Temperature

The temperature of the model. Increasing the temperature will make the model answer more creatively. (Default: 0.8)

public static OllamaOption Temperature { get; }

Property Value

OllamaOption

TfsZ

Tail free sampling is used to reduce the impact of less probable tokens from the output. A higher value (e.g., 2.0) will reduce the impact more, while a value of 1.0 disables this setting. (default: 1)

public static OllamaOption TfsZ { get; }

Property Value

OllamaOption

Think

Gets or sets a value to enable or disable thinking. Use reasoning models like OpenThinker, Qwen3, DeepSeek-R1, Phi4-Reasoning that support thinking when activating this option. (Default: Null)

public static OllamaOption Think { get; }

Property Value

OllamaOption

TopK

Reduces the probability of generating nonsense. A higher value (e.g. 100) will give more diverse answers, while a lower value (e.g. 10) will be more conservative. (Default: 40)

public static OllamaOption TopK { get; }

Property Value

OllamaOption

TopP

Works together with top-k. A higher value (e.g., 0.95) will lead to more diverse text, while a lower value (e.g., 0.5) will generate more focused and conservative text. (Default: 0.9)

public static OllamaOption TopP { get; }

Property Value

OllamaOption

TypicalP

The typical-p value to use for sampling. Locally Typical Sampling implementation described in the paper https://arxiv.org/abs/2202.00666. (Default: 1.0)

public static OllamaOption TypicalP { get; }

Property Value

OllamaOption

UseMlock

Lock the model in memory to prevent swapping. This can improve performance, but it uses more RAM and may slow down loading. (Default: False)

public static OllamaOption UseMlock { get; }

Property Value

OllamaOption

UseMmap

Models are mapped into memory by default, which allows the system to load only the necessary parts as needed. Disabling mmap makes loading slower but reduces pageouts if you're not using mlock. If the model is bigger than your RAM, turning off mmap stops it from loading. (Default: True)

public static OllamaOption UseMmap { get; }

Property Value

OllamaOption

VocabOnly

Load only the vocabulary, not the weights. (Default: False)

public static OllamaOption VocabOnly { get; }

Property Value

OllamaOption