Skip to main content

responses_include

Function responses_include 

Source
pub fn responses_include(options: &ChatOptions, implicit: bool) -> Option<Value>
Expand description

Build the Responses request’s include array.

A reasoning item must be replayed verbatim on the follow-up turn of a tool loop, and the service only accepts it when it carries its id and encrypted_content. When the conversation is held service-side the model already has that item, but on a stateless request nothing is stored — so unless the request asks for reasoning.encrypted_content, the item comes back without it and the replay in messages_to_input has nothing valid to re-send. This adds it implicitly in exactly that case, mirroring upstream’s _prepare_options.

A caller’s own include entries (passed through ChatOptions::additional_properties) are always preserved, and an explicit reasoning.encrypted_content is honored even when implicit is falseimplicit gates only whether it is added on the caller’s behalf. Foundry passes false here: it does not want encrypted reasoning unless asked for it by name (upstream #7536).

Returns None when the array would be empty, so a request that needs no include does not carry an empty one.

pub for the same reason as extract_instructions: agent-framework-azure’s Responses client builds its own body and reuses this step rather than reimplementing it.