Table of Contents

Property MaxCompletionTokens

Namespace
LMKit.Agents
Assembly
LM-Kit.NET.dll

MaxCompletionTokens

Gets or sets the maximum number of tokens for completion per turn.

public int? MaxCompletionTokens { get; set; }

Property Value

int?

Examples

Controlling response length:

using LMKit.Model;
using LMKit.Agents;

using var model = new LM("path/to/model.gguf");
var agent = new Agent(model);

// Short summary
var shortOptions = new AgentExecutionOptions
{
    MaxCompletionTokens = 100
};
var summary = agent.Run("Summarize machine learning in brief.", shortOptions);

// Detailed explanation
var longOptions = new AgentExecutionOptions
{
    MaxCompletionTokens = 2000
};
var detailed = agent.Run("Explain machine learning in detail.", longOptions);

Remarks

Controls the maximum length of the agent's response. Set to null to use the default (2048 tokens). Set to -1 to disable the limit entirely.

Lower values are useful for:

  • Summary tasks requiring concise responses.
  • Reducing latency in chat applications.
  • Controlling output costs.