LlmCore.Memory.Hindsight.Config (llm_core v0.3.0)

Copy Markdown View Source

Hindsight-specific configuration with multi-level precedence.

Hindsight 0.4+

Uses REST API. URLs are base URLs (e.g. http://localhost:8888), not MCP paths. Operations use /v1/default/banks/{bank_id}/....

Precedence (highest to lowest)

  1. UI runtime override (ETS, session-only)
  2. Project config (<project>/.llm_core/config.yml)
  3. Global config (~/.llm_core/config.yml)
  4. Environment variable (HINDSIGHT_URL)
  5. Auto-discovered endpoint

Configuration Options

memory:
  hindsight:
    url: http://localhost:8888
    api_key_env: HINDSIGHT_API_KEY
    enabled: true
    default_bank_id: platform
    timeout_health_ms: 2000
    timeout_retain_ms: 10000
    timeout_recall_ms: 30000
    timeout_reflect_ms: 60000
    max_retries: 3
    retry_backoff_ms: [1000, 2000, 4000]
    circuit_failure_threshold: 5
    circuit_reset_ms: 30000
    cache_ttl_ms: 300000
    cache_max_entries: 1000
    prefetch_on_startup: true

Summary

Functions

Clears the runtime override map.

Clears the UI override.

Returns default configuration.

Returns the effective default bank identifier, if configured.

Returns the effective configuration merging all sources.

Returns the effective URL using precedence rules.

Returns the API key for authentication (from configured env var).

Gets the discovered URL if available.

Checks if URL requires authentication (non-localhost).

Stores a discovered URL (from auto-discovery).

Applies a runtime override map sourced from the TOML configuration loader.

Sets a UI override URL (session-only, not persisted).

Types

t()

@type t() :: %LlmCore.Memory.Hindsight.Config{
  api_key_env: String.t(),
  cache_max_entries: pos_integer(),
  cache_reflect_ttl_ms: pos_integer(),
  cache_ttl_ms: pos_integer(),
  circuit_failure_threshold: pos_integer(),
  circuit_reset_ms: pos_integer(),
  default_bank_id: String.t() | nil,
  enabled: boolean(),
  max_retries: non_neg_integer(),
  prefetch_on_startup: boolean(),
  retain_raw_llm: boolean(),
  retry_backoff_ms: [pos_integer()],
  timeout_health_ms: pos_integer(),
  timeout_recall_ms: pos_integer(),
  timeout_reflect_ms: pos_integer(),
  timeout_retain_ms: pos_integer(),
  url: String.t() | nil
}

Functions

clear_runtime_override()

@spec clear_runtime_override() :: :ok

Clears the runtime override map.

clear_ui_override()

@spec clear_ui_override() :: :ok

Clears the UI override.

defaults()

@spec defaults() :: map()

Returns default configuration.

effective_bank_id()

@spec effective_bank_id() :: String.t() | nil

Returns the effective default bank identifier, if configured.

effective_config()

@spec effective_config() :: t()

Returns the effective configuration merging all sources.

effective_url()

@spec effective_url() :: String.t() | nil

Returns the effective URL using precedence rules.

get_api_key()

@spec get_api_key() :: String.t() | nil

Returns the API key for authentication (from configured env var).

get_discovered_url()

@spec get_discovered_url() :: String.t() | nil

Gets the discovered URL if available.

requires_auth?(url)

@spec requires_auth?(String.t() | nil) :: boolean()

Checks if URL requires authentication (non-localhost).

set_discovered_url(url)

@spec set_discovered_url(String.t() | nil) :: :ok

Stores a discovered URL (from auto-discovery).

set_runtime_override(map)

@spec set_runtime_override(map()) :: :ok

Applies a runtime override map sourced from the TOML configuration loader.

set_ui_override(url)

@spec set_ui_override(String.t() | nil) :: :ok

Sets a UI override URL (session-only, not persisted).