modelfacts

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package modelfacts keeps what Blitz has learned about models from their own refusals (spec_056_conversation_adapters CA-13, CA-14): a model that refused tools, images, a setting or a stream, or stated its context window or maximum output, has the fact saved per provider and model in ~/.blitz/models.learned.toml, with when and why, so every workspace and every restart knows it. A fact is tried again after Recheck, and `blitz models forget <ref>` clears a model's.

Index

Constants

View Source
const (
	NoTools       = "no_tools"         // the model doesn't call tools
	NoImages      = "no_images"        // the model doesn't read images
	NoStream      = "no_stream"        // the model (or its server) doesn't stream
	NoParam       = "no_param"         // the model refuses a setting: Value names it
	ContextWindow = "context_window"   // the model's context window: Value in tokens
	MaxOutput     = "max_output"       // the model's maximum output: Value in tokens
	NoSystem      = "no_system"        // the model refuses system instructions
	NoStructured  = "no_structured"    // the model refuses a response schema
	NoThinking    = "no_thinking"      // the model refuses thinking or effort settings
	NoProvTool    = "no_provider_tool" // the model refuses a provider tool: Value names it
)

The facts a refusal teaches.

View Source
const Recheck = 30 * 24 * time.Hour

Recheck is how long a learned fact holds before the model is asked again: servers and models are updated.

Variables

This section is empty.

Functions

func Key

func Key(provider, model string) string

Key names a model: its provider and its name, lower case.

func Path

func Path(dir string) string

Path is where the facts are kept: models.learned.toml in dir (Blitz's home, ~/.blitz).

Types

type Fact

type Fact struct {
	Kind  string    `toml:"kind"`
	Value string    `toml:"value,omitempty"`
	Why   string    `toml:"why"`
	At    time.Time `toml:"at"`
}

Fact is one thing learned about a model.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is the learned facts, in one file.

func Open

func Open(path string) *Store

Open is the store at path; the file is read on first use and again whenever it changes (another process learned or forgot something).

func (*Store) All

func (s *Store) All() map[string][]Fact

All is every model's facts, by key, for listing.

func (*Store) Facts

func (s *Store) Facts(provider, model string, now time.Time) []Fact

Facts are what's known of provider's model, without those due to be asked again.

func (*Store) Forget

func (s *Store) Forget(ref string) ([]string, error)

Forget clears what's known of the models ref names: a provider's model ("anthropic/claude-x"), or a bare model name, under any provider. It returns the keys it cleared.

func (*Store) Learn

func (s *Store) Learn(provider, model string, f Fact) (bool, error)

Learn saves f for provider's model, replacing an earlier fact of its kind (and value, for the kinds that name one). It reports whether the fact is new, so the person is told once.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL