Skip to main content

Overview

ModelSettings controls how the model generates text — temperature, token limits, and the rest. Pass one to the Agentor class to tune responses. It is provider-neutral on purpose: the parameters below are understood everywhere, and anything else you pass is forwarded to the provider untouched. That means a provider-specific parameter needs no support from Agentor.

Import

Usage

Common Parameters

Every parameter defaults to unset, and unset parameters are left out of the request entirely — so the provider’s own default applies.
float
default:"unset"
Controls randomness in outputs. Lower values (0.0-0.3) make outputs more focused and deterministic. Higher values (0.7-1.0) make outputs more creative and varied.
  • 0.0-0.3: Precise, consistent, factual responses
  • 0.4-0.6: Balanced creativity and consistency
  • 0.7-1.0: Creative, diverse, exploratory responses
int
default:"Model-dependent"
Maximum number of tokens to generate in the response. Limits the length of the model’s output.
float
default:"1.0"
Nucleus sampling parameter. Controls diversity by limiting cumulative probability. Alternative to temperature.
  • 0.1-0.5: More focused, deterministic
  • 0.9-1.0: More diverse outputs
float
default:"0.0"
Penalizes tokens based on whether they appear in the text so far. Range: -2.0 to 2.0.
  • Positive values encourage new topics
  • Negative values encourage staying on topic
float
default:"0.0"
Penalizes tokens based on their frequency in the text. Range: -2.0 to 2.0.
  • Positive values reduce repetition
  • Negative values allow more repetition
str | List[str]
default:"None"
Sequences where the model will stop generating. Maximum of 4 sequences.
int
default:"None"
Ask the provider for reproducible sampling. Support varies by provider.
str | dict
default:"None"
Force or forbid tool use: "auto", "none", "required", or a specific tool.
bool
default:"None"
Allow the model to request several tools in one turn. Agentor runs them concurrently.
str
default:"None"
For reasoning models: how much thinking to do before answering.
str
default:"None"
For models that support it: how long the answer should be.
int
default:"None"
Number of most-likely tokens to return log probabilities for.
dict
default:"None"
Arbitrary key/value pairs attached to the provider request.
dict
default:"{}"
Extra request parameters, passed through verbatim. Unrecognised keyword arguments land here automatically, so ModelSettings(some_provider_flag=True) works without listing it.
A handful of parameters from the pre-0.1.0 settings type have no chat-completions equivalent — truncation, retry, context_management, include_usage, prompt_cache_options, prompt_cache_retention, response_include. They are accepted and dropped with a warning rather than sent and rejected.

Examples

Creative Writing

Precise Technical Responses

Concise Responses

Reducing Repetition

From Markdown File

You can also specify temperature in markdown frontmatter:

Parameter Selection Guide

By Use Case

Combining Parameters

Notes

  • Import it from agentor directly: from agentor import ModelSettings
  • If you pass nothing, no generation parameters are sent and the provider’s defaults apply
  • Temperature and top_p are alternative sampling methods — adjust one or the other, not both
  • Different models interpret these parameters differently, and not every provider supports every one
  • Agentor - Main agent class that uses ModelSettings
  • Model providers - Reach any OpenAI-compatible endpoint
  • LLM - Lightweight LLM client
Last modified on August 28, 2026