LlmComposer.Helpers (llm_composer v0.19.3)

Copy Markdown View Source

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

json_engine()

@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.

normalize_json(data)

@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.