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

Copy Markdown View Source

Auto-discovery of Hindsight API endpoints.

Probes default endpoints in order:

  1. http://localhost:8888
  2. http://127.0.0.1:8888

Uses GET /health with 2-second timeout for fast discovery. Results are cached in ETS for session lifetime.

Hindsight 0.4+

Uses REST API (not MCP). Health at /health, operations at /v1/default/banks/....

Summary

Functions

Returns cached discovery result without probing.

Discovers Hindsight endpoint by probing default URLs.

Runs discovery asynchronously (non-blocking).

Probes a specific URL for health via GET /health.

Clears cached discovery and re-probes endpoints.

Functions

cached_url()

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

Returns cached discovery result without probing.

discover()

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

Discovers Hindsight endpoint by probing default URLs.

Returns the first responding endpoint or nil if none found.

discover_async()

@spec discover_async() :: Task.t()

Runs discovery asynchronously (non-blocking).

probe_health(url)

@spec probe_health(String.t()) :: {:ok, map()} | {:error, term()}

Probes a specific URL for health via GET /health.

refresh()

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

Clears cached discovery and re-probes endpoints.