ai.wire.merge_request_body

Deep-merge a client's `request_body` passthrough into its serialized request. Call this as the LAST step of building the wire body:

Reference version

Signature

function ai.wire.merge_request_body(
base: baml.json.json,
overrides: baml.json.json | null
) -> baml.json.json

Deep-merge a client's request_body passthrough into its serialized request. Call this as the LAST step of building the wire body:

let body = baml.json.to_json(typed_request);
let merged = ai.wire.merge_request_body(body, c.request_body);
baml.json.stringify(merged)

Maps merge recursively, a null override value DELETES that key (the engine's removal contract — {"max_tokens": null} removes the default the client injected), and every other value replaces wholesale. A null overrides means "no passthrough configured" and returns base unchanged; it never deletes the whole body.

Source:<builtin>/ai/ns_wire/wire.bamlbytes 1566215870