Sycophant. ModelExtra
(sycophant v0.5.1)
Copy Markdown
Key-agnostic reads of LLMDB.Model and LLMDB.Provider :extra metadata.
LLMDB treats :extra as provider-owned opaque data: snapshot-loaded entries
keep their JSON string keys, while entries built in-process (tests, custom
registries) commonly use atom keys. These helpers accept either shape.
Examples
iex> Sycophant.ModelExtra.get(%{"temperature" => false}, :temperature)
false
iex> Sycophant.ModelExtra.get(%{temperature: false}, :temperature)
false
iex> Sycophant.ModelExtra.get(%{}, :temperature, :missing)
:missing
iex> Sycophant.ModelExtra.get_path(%{"wire" => %{protocol: "openai_chat"}}, [:wire, :protocol])
"openai_chat"
Summary
Functions
Reads key from extra, trying the atom key before its string form.
Walks a nested path through extra, accepting either key form at each level.
Functions
Reads key from extra, trying the atom key before its string form.
Returns default when extra is not a map or the key is absent.
Walks a nested path through extra, accepting either key form at each level.
Returns nil as soon as a segment is missing.