harn-stdlib 0.8.18

Embedded Harn standard library source catalog
Documentation
// @harn-entrypoint-category llm.stdlib
import { pick_keys } from "std/collections"

fn __llm_call_option_keys() {
  return [
    "model",
    "model_tier",
    "provider",
    "route_policy",
    "prefer",
    "fallback_strategy",
    "strategy",
    "fallback_chain",
    "budget_usd",
    "system",
    "messages",
    "session_id",
    "system_preamble",
    "system_prefix",
    "system_context",
    "system_prompt_parts",
    "system_appendix",
    "system_suffix",
    "max_tokens",
    "temperature",
    "top_p",
    "top_k",
    "logprobs",
    "top_logprobs",
    "stop",
    "seed",
    "frequency_penalty",
    "presence_penalty",
    "response_format",
    "output_format",
    "schema",
    "json_schema",
    "output_schema",
    "output_validation",
    "schema_retries",
    "schema_retry_nudge",
    "retries",
    "schema_recover",
    "repair",
    "llm_repair",
    "thinking",
    "reasoning_effort",
    "interleaved_thinking",
    "anthropic_beta_features",
    "vision",
    "audio",
    "pdf",
    "tools",
    "tool_choice",
    "tool_search",
    "tool_format",
    "cache",
    "budget",
    "llm_retries",
    "llm_backoff_ms",
    "timeout",
    "idle_timeout",
    "stream",
    "anthropic",
    "openai",
    "openrouter",
    "together",
    "groq",
    "deepseek",
    "fireworks",
    "huggingface",
    "local",
    "mlx",
    "vllm",
    "tgi",
    "dashscope",
    "gemini",
    "azure_openai",
    "bedrock",
    "ollama",
    "vertex",
    "mock",
    "fake",
    "prefill",
    "structural_experiment",
    "transcript",
    "metadata",
  ]
}

/**
 * llm_call_options projects a broader runtime options dict onto the public
 * llm_call option surface.
 */
pub fn llm_call_options(options = nil) {
  return pick_keys(options ?? {}, __llm_call_option_keys(), {drop_nil: true})
}