glean/models/anthropic_sampling

Older Anthropic Claude models that still accept temperature, top_p and top_k under the API version glean sends (2023-06-01).

For current models, see glean/models/anthropic.

Types

A Claude (with sampling parameters) model builder. Pick a model with one of the constructors (or custom), chain setters, then call build().

pub opaque type ClaudeSampling

Values

pub fn build(m: ClaudeSampling) -> model.Model

Build a Model to use with agent.new.

pub fn configure(
  m: ClaudeSampling,
  f: fn(config.ProviderConfig) -> config.ProviderConfig,
) -> ClaudeSampling

Change the provider configuration: base URL, timeout, headers, retries.

|> configure(config.timeout(_, 120_000))
pub fn custom(
  api_key key: String,
  model model_id: String,
) -> ClaudeSampling

Any other model ID served by this API, such as one released after this version of glean. Only this module’s setters are available, so check the model accepts them.

pub fn haiku_4_5(api_key key: String) -> ClaudeSampling

Claude Haiku 4.5. Model ID: claude-haiku-4-5.

pub fn max_output_tokens(
  m: ClaudeSampling,
  n: Int,
) -> ClaudeSampling

Set the maximum number of output tokens.

pub fn opus_4_5(api_key key: String) -> ClaudeSampling

Claude Opus 4.5. Model ID: claude-opus-4-5.

pub fn opus_4_6(api_key key: String) -> ClaudeSampling

Claude Opus 4.6. Model ID: claude-opus-4-6.

pub fn sonnet_4_5(api_key key: String) -> ClaudeSampling

Deprecated: claude-sonnet-4-5 retires on Nov 30, 2026. Use anthropic.sonnet_5_5() instead.

Claude Sonnet 4.5. Model ID: claude-sonnet-4-5.

pub fn sonnet_4_6(api_key key: String) -> ClaudeSampling

Claude Sonnet 4.6. Model ID: claude-sonnet-4-6.

pub fn stop_sequences(
  m: ClaudeSampling,
  stops: List(String),
) -> ClaudeSampling

Stop generating when the model writes any of these strings.

pub fn temperature(m: ClaudeSampling, t: Float) -> ClaudeSampling

Set the sampling temperature.

pub fn top_k(m: ClaudeSampling, k: Int) -> ClaudeSampling

Set the top-k sampling value.

pub fn top_p(m: ClaudeSampling, p: Float) -> ClaudeSampling

Set the top-p (nucleus sampling) value.

✨ Search Document