Skip to content

Releases: expilu/smart-decisions

v0.6.0

Choose a tag to compare

@github-actions github-actions released this 03 Oct 17:00
Immutable release. Only release title and notes can be modified.
62986c9

0.6.0

Minor Changes

  • #26 3c80dd7 - Added mode: 'auto': the question runs System 1 first and escalates exactly once to System 2 when the answer's confidence falls below autoModeThreshold (default 0.7; for noul() the confidence equivalent is max(noul, 1 − noul)). The escalated answer is returned as-is even at low confidence — one deliberate pass, never a loop. Confident System 1 answers complete without touching System 2, so the fast path stays in the milliseconds.

  • #26 3c80dd7 - Added global debug logging: debug: true on any question (both modes) logs the internals to stderr — the prompt, the wire request body, the endpoint, raw responses with their HTTP status, every retry with its reason and backoff, and in System 2 the model's reasoning text and each structured-rejection reason.

  • #26 3c80dd7 - Implement System 2 mode (mode: 'system2') for choice(), score() and noul(): the model deliberates and answers a minimal structured object — one integer 0..10 rating per candidate — and the same answer shapes as System 1 come out of it (winner = argmax, distribution = normalized ratings, same entropy confidence). Requests use response_format with a strict ratings schema, temperature: 0, no default token budget, and a parse-validate-retry fallback that feeds rejection reasons back to the model so engines with broken or missing structured-output support still work. Adds the thinking question option (valid in 'system2'/'auto' mode; false sends reasoning_effort: 'none') and the mode-partitioned question types: Question, ScoreQuestion and NoulQuestion switch from interfaces to unions over mode, so thinking set with mode: 'system1' no longer compiles — breaking for consumers extending those types with interface X extends ... (allowed by semver at 0.x).

v0.5.0

Choose a tag to compare

@github-actions github-actions released this 01 Oct 17:10
Immutable release. Only release title and notes can be modified.
6b34abb

0.5.0

Minor Changes

  • #17 8c84db1 - Add the noul() primitive: answers a yes/no question with the probability that the answer is "yes" (0..1).

v0.4.0

Choose a tag to compare

@github-actions github-actions released this 30 Sep 21:43
Immutable release. Only release title and notes can be modified.
1f2d30f

0.4.0

Minor Changes

  • #15 d88ce52 Thanks @expilu! - feat: score() — rate a position on a spectrum

    New score() primitive for decisions that are a position on a scale of ordered,
    described levels: its answer is a score (the probability-weighted mean of the
    level numbers, so it can fall between two levels), the per-level probabilities
    and legend keyed by level number as string, and the usual 0..1 confidence.
    Accepts 2..10 level descriptions in criteria (an ordered array, low end of the
    scale first); one dimension per question is recommended. Not implemented yet in System 2 mode.

  • #15 d88ce52 Thanks @expilu! - feat: shared System 1 core, shared mode router and the Mode type

    choice() System 1 answers are now produced through src/system1/system1.ts (the
    one-token logprobs engine any System 1 question type reuses) and src/utils/mode/route-mode.ts
    (the mode router: default to System 1, System 2 answers "Not implemented yet" from a single
    stub). New exported types: Mode (the shared 'system1' | 'system2' union) and BaseQuestion
    (the fields every question type carries — Question extends it). No behavior change:
    same prompts, same responses, same errors.

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 28 Sep 16:55
Immutable release. Only release title and notes can be modified.
e1f8511

0.3.0

Minor Changes

  • #12 87127d5 Thanks @expilu! - Breaking (pre-1.0): the provider settings on Question moved into a new Model type.

    • apiBaseUrl, apiKey and model no longer sit flat on Question; they are now
      question.model.{apiBaseUrl, apiKey, model}. This groups everything about how the
      model is reached and served into one reusable object to pass to every choice().
    • Model gains extraBody: extra fields forwarded verbatim into the chat completions
      request body for engine- or model-specific settings (i.e. chat_template_kwargs
      thinking toggles on llama.cpp/vLLM/SGLang, reasoning_effort on OpenAI/OpenRouter/
      Ollama, Ollama's native think). Reserved request keys the library's single-token
      trick depends on (model, messages, stream, logprobs, top_logprobs,
      max_tokens, temperature) cannot be overridden through it; chat_template_kwargs
      merges one level deep with user keys winning per key.
    • System 1's request now asks for top_logprobs: 20 instead of 50: 20 is the highest
      portable window (OpenAI and OpenRouter cap it at 20, vLLM's server default
      --max-logprobs is 20). On llama.cpp (accepts up to 50) the smaller window is
      enough for realistic option counts.
    • New Model type exported from the package root; generateText accepts extra
      top-level body fields via ChatCompletionRequest's index signature.

    Hardening

    • The transport no longer follows redirects (redirect: 'error'): the Bearer token
      stays off unexpected paths, and a misconfigured base URL fails loudly.
    • Response bodies are read under a 10 MB safety cap instead of being buffered
      unconditionally; an over-cap body fails fast and is not retried. A declared
      Content-Length over the cap is refused before reading anything.
    • Non-finite maxRetries (i.e. NaN) no longer causes an infinite retry loop: it
      falls back to the default, negatives clamp to 0 and fractions to whole attempts.
    • extraBody ignores __proto__ and constructor keys, so prototype-smuggled
      config can never re-parent the request object.
    • Malformed entries inside top_logprobs (missing/null token) are skipped instead
      of crashing mid-read.
    • Error messages strip query strings from the request URL, so providers that take
      credentials as query parameters cannot leak them into logs.
    • The endpoint path is joined through the URL API, preserving a query string in
      apiBaseUrl instead of swallowing it, and an invalid base URL throws a clear
      Invalid model.apiBaseUrl error.
    • CI actions are pinned by commit SHA; the release script spawns every subprocess
      as an argv array (no shell), so interpolated values can never be re-parsed as
      shell syntax.

v0.2.0

Choose a tag to compare

@expilu expilu released this 26 Sep 15:26
Immutable release. Only release title and notes can be modified.
c61dca0

0.2.0

Minor Changes

  • #6 0cce138 Thanks @expilu! - Removed the openai SDK dependency: the library now talks to the OpenAI-compatible
    endpoint with an in-library HTTP transport.