ReqLLM.StreamResponse.MetadataHandle (ReqLLM v1.3.0)

View Source

Asynchronous metadata cache that allows multiple awaiters to share the same result.

The handle starts a background process that runs the supplied fetch fun exactly once. Callers can await the metadata multiple times without causing repeated fetches or task mailbox exhaustion.

Summary

Functions

Returns a specification to start this module under a supervisor.

Types

t()

@type t() :: pid()

Functions

await(handle, timeout \\ :infinity)

@spec await(t(), timeout()) :: map()

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(fetch_fun)

@spec start_link((-> map())) :: {:ok, t()} | {:error, term()}