Skip to main content

build_cloud_request

Function build_cloud_request 

Source
pub fn build_cloud_request(
    messages: &[Message],
    options: &ChatOptions,
    max_tokens: u32,
    stream: bool,
    anthropic_version: &str,
) -> Value
Expand description

Build an Anthropic Messages-API-shaped request body for the multi-cloud transports (crate::bedrock, crate::vertex, crate::foundry).

AWS Bedrock, Google Vertex AI, and Azure AI Foundry all select the model through the request URL (a path segment or deployment), not the JSON body, and all three require an explicit anthropic_version string in the body in place of the direct API’s top-level model field. Everything else — system prompt extraction, message conversion, sampling options, tools/tool_choice, and additional_properties passthrough — is identical to build_request, via the same fill_request_body helper, so the two stay in lockstep by construction rather than by convention.