adk_content (erlang_adk v0.7.0)
View SourceVersioned, JSON-safe model content.
A content value is independent of any model provider. Binary payloads are base64 encoded at this boundary so the canonical value can be persisted, replayed, and encoded as JSON without retaining an ambiguous Erlang binary. Validation is deliberately bounded; callers can lower (but not exceed) the library safety ceilings through content_limits in a provider config.
Summary
Functions
Construct an inline-data part from raw bytes. The canonical part stores RFC 4648 base64, never raw bytes.
Validate limit overrides and return a complete limit map. Unknown keys, zero/negative limits, and values above hard safety ceilings are rejected.
Hard codec ceilings used by trusted persistence boundaries. Provider configs may lower any value, but no public content can exceed this map.
Types
Functions
-spec codec_version() -> pos_integer().
-spec default_limits() -> limits().
-spec file_data(binary(), binary()) -> {ok, part()} | {error, error_reason()}.
-spec file_data(binary(), binary(), map()) -> {ok, part()} | {error, error_reason()}.
-spec function_call(binary(), map()) -> {ok, part()} | {error, error_reason()}.
-spec function_call(binary(), map(), map()) -> {ok, part()} | {error, error_reason()}.
-spec function_response(binary(), map()) -> {ok, part()} | {error, error_reason()}.
-spec function_response(binary(), map(), map()) -> {ok, part()} | {error, error_reason()}.
-spec inline_data(binary(), binary()) -> {ok, part()} | {error, error_reason()}.
Construct an inline-data part from raw bytes. The canonical part stores RFC 4648 base64, never raw bytes.
-spec inline_data(binary(), binary(), map()) -> {ok, part()} | {error, error_reason()}.
-spec new([part()]) -> {ok, content()} | {error, error_reason()}.
-spec new([part()], map()) -> {ok, content()} | {error, error_reason()}.
-spec normalize_limits(map()) -> {ok, limits()} | {error, error_reason()}.
Validate limit overrides and return a complete limit map. Unknown keys, zero/negative limits, and values above hard safety ceilings are rejected.
-spec safety_limits() -> limits().
Hard codec ceilings used by trusted persistence boundaries. Provider configs may lower any value, but no public content can exceed this map.
-spec text(term()) -> {ok, part()} | {error, error_reason()}.
-spec validate(term()) -> {ok, content()} | {error, error_reason()}.
-spec validate(term(), map()) -> {ok, content()} | {error, error_reason()}.