View Source LlmComposer.Helpers (llm_composer v0.19.2)

Provides helper functions for the LlmComposer module for handling language model responses.

Summary

Functions

Returns the configured JSON engine module.

Normalizes JSON-like decoded data into maps with string keys.

Functions

@spec json_engine() :: module()

Returns the configured JSON engine module.

Reads :json_engine from application config. Defaults to JSON if available, otherwise falls back to Jason.

@spec normalize_json(term()) :: term()

Normalizes JSON-like decoded data into maps with string keys.

This handles decoders that may emit ordered objects as lists of {key, value} tuples or maps keyed by atoms.