Helpers for working with providers that support JSON-mode outputs.
The helpers exposed here are intentionally lightweight so they can be used from providers, pipelines, and tests without introducing new dependencies.
Summary
Functions
Decodes the response content into a map/list.
Ensures the options passed to a provider request include JSON formatting.
Types
Functions
@spec decode(LlmCore.LLM.Response.t() | binary() | decoded()) :: {:ok, decoded()} | {:error, term()}
Decodes the response content into a map/list.
When the content is already a map or list (for example, the provider returns parsed JSON), it is returned as-is.
Ensures the options passed to a provider request include JSON formatting.
Providers that already set :format or :response_format are left untouched.